ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Munat <b...@munat.com>
Subject Re: can't update/insert to postgres db
Date Tue, 27 Sep 2005 17:13:38 GMT
Thanks for the idea... unfortunately it didn't work. Any other ideas?

The postgres install I'm using is "PostgreSQL 7.3.4-RH on i386-redhat-linux-gnu, compiled
by GCC i386-redhat-linux-gcc 
(GCC) 3.3.2 20031022 (Red Hat Linux 3.3.2-1)". I've tried the jdbc2 and jdbc3 jars that came
with my local copy of 
postgres 8, and I also went and downloaded the jdbc jar from postgres-7.3... no luck.

Besides the fact that I'm getting no exceptions, the call to the update method returns 6 when
I use the update statement 
with no "where" clause... and that's how many rows are in that table. It acts like it's updating
but when I do a select 
on the table, it's still the old data. Very strange.

Ben

zarar.siddiqi@utoronto.ca wrote:
> Maybe autocommit is set to false. Try specifying it explicitly by putting
> the following line in your <transactionManager> element.
> 
> <property name="JDBC.DefaultAutoCommit" value="true" />
> 
> 
> 
> 
> 
> On Mon, 26 Sep 2005, Ben Munat wrote:
> 
> 
>>Hello. I can't seem to update or insert into a postgres db from ibatis. I don't get
an exception, but when I check the 
>>database the change has not been made. I've tried various insert and update statements
with and without parameters and 
>>none have worked. However, I am selecting data from this db with ibatis just fine.
>>
>>Here's some code I'm using:
>>
>>Reader reader = Resources.getResourceAsReader("sqlMap-config.xml");
>>SqlClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
>>int result = sqlMap.update("updateEmail",user);
>>
>>And from the sqlMap xml file:
>>
>><statement id="updateEmail">
>>     update user set email = 'buzz@boobah.com'
>></statement>
>>
>>(note: I had a where clause there but I'm trying to get it to do anything at this
point!)
>>
>>I've also tried the "update" and "insert" sqlmap xml elements... and tried inserting
updating other tables too. And when 
>>I run the exact same sql from a jdbc ui client, the database is updated sucessfully.
>>
>>Any ideas much appreciated.
>>
>>Ben
>>
> 
> 


Mime
View raw message