problem with new autocommit config parameter and jdbc

From: Barry Lind <barry(at)xythos(dot)com>
To: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: problem with new autocommit config parameter and jdbc
Date: 2002-09-06 23:30:27
Message-ID: 3D793A93.7030000@xythos.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

Haris,

You can't use jdbc (and probably most other postgres clients) with
autocommit in postgresql.conf turned off.

Hackers,

How should client interfaces handle this new autocommit feature? Is it
best to just issue a set at the beginning of the connection to ensure
that it is always on?

thanks,
--Barry

snpe wrote:

>Hi Dave,
>That is same.Program work with and without quote but row don't deleted.
>Postgresql is 7.3 beta (from cvs) and parameter autocommit in
postgresql.conf
>is off (no auto commit).
>I am tried with db.autocommit(true) after getConnection, but no success
>
>I thin that is bug in JDBC
>PGSql 7.3 beta have new features autocommit on/off and JDBC driver
don't work
>with autocommit off
>
>Thanks
>
>P.S
>I am play ith Oracle JDeveloper 9i and Postgresql and I get error in
prepared
>statement like this error :
>(oracle.jbo.SQLStmtException) JBO-27123: SQL error during call statement
>preparation. Statement: DELETE FROM org_ban WHERE "id"=?
>
>and pgsqlerror is :
>(org.postgresql.util.PSQLException) Malformed stmt [DELETE FROM
org_ban WHERE
>"id"=?] usage : {[? =] call <some_function> ([? [,?]*]) }
>
>I think that JDeveloper call CallableStatement for insert or delete
(select
>and update work fine), but I don't know how.
>
>On Friday 06 September 2002 04:35 pm, Dave Cramer wrote:
>
>
>>Remove the quotes around id, and let me know what happens
>>
>>Dave
>>
>>On Fri, 2002-09-06 at 10:52, snpe wrote:
>>
>>
>>>Hello Dave,
>>> There isn't any error.Program write 'Rows deleted 1', but row hasn't
>>>been deleted
>>>
>>>Thanks
>>>Haris Peco
>>>
>>>On Friday 06 September 2002 04:05 pm, Dave Cramer wrote:
>>>
>>>
>>>>Harris,
>>>>
>>>>What error do you get?
>>>>
>>>>Also you don't need the quotes around id
>>>>
>>>>Dave
>>>>
>>>>On Fri, 2002-09-06 at 10:06, snpe wrote:
>>>>
>>>>
>>>>>Hello,
>>>>> I have simple table with column ID and values '4' in this.
>>>>>I user 7.3 beta1 (from cvs 05.09.2002) and autocommit off in
>>>>>postgresql.conf. Next program don't work .
>>>>>I am tried with compiled postgresql.jar form CVS and with
>>>>>pg73b1jdbc3.jar from 05.09.2002 on jdbc.postgresql.org
>>>>>
>>>>>What is wrong ?
>>>>>
>>>>>regards
>>>>>Haris Peco
>>>>>import java.io.*;
>>>>>import java.sql.*;
>>>>>import java.text.*;
>>>>>
>>>>>public class PrepStatTest
>>>>>{
>>>>> Connection db;
>>>>> String stat="DELETE FROM org_ban WHERE \"id\" = ?";
>>>>> String delid = "4";
>>>>> public PrepStatTest() throws ClassNotFoundException,
>>>>>FileNotFoundException, IOException, SQLException
>>>>> {
>>>>>
Class.forName("org.postgresql.Driver");
>>>>>
db = DriverManager.getConnection("jdbc:postgresql://spnew/snpe",
>>>>>"snpe", "snpe");
>>>>>
PreparedStatement st = db.prepareStatement(stat);
>>>>> st.setString(1, delid);
>>>>> int rowsDeleted = st.executeUpdate();
>>>>>
System.out.println("Rows deleted " + rowsDeleted);
>>>>>
db.commit();
>>>>>
st.close();
>>>>>
db.close();
>>>>> }
>>>>>
>>>>> public static void main(String args[])
>>>>> {
>>>>>
try
>>>>>
{
>>>>>
PrepStatTest test = new PrepStatTest();
>>>>>
}
>>>>>
catch (Exception ex)
>>>>>
{
>>>>>
System.err.println("Exception caught.\n" + ex);
>>>>>
ex.printStackTrace();
>>>>>
}
>>>>> }
>>>>>}
>>>>>
>>>>>
>>>>>---------------------------(end of
>>>>>broadcast)--------------------------- TIP 3: if posting/reading
>>>>>through Usenet, please send an appropriate subscribe-nomail command
>>>>>to majordomo(at)postgresql(dot)org so that your message can get through to
>>>>>the mailing list cleanly
>>>>>
>>>>>
>>>---------------------------(end of
broadcast)---------------------------
>>>TIP 2: you can get off all lists at once with the unregister command
>>> (send "unregister YourEmailAddressHere" to
majordomo(at)postgresql(dot)org)
>>>
>>>
>>---------------------------(end of
broadcast)---------------------------
>>TIP 4: Don't 'kill -9' the postmaster
>>
>>
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
>message can get through to the mailing list cleanly
>
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2002-09-07 00:52:18 Re: Rule updates and PQcmdstatus() issue
Previous Message Barry Lind 2002-09-06 23:30:15 Interesting results using new prepared statements

Browse pgsql-jdbc by date

  From Date Subject
Next Message Barry Lind 2002-09-06 23:30:36 Re: compile of jdbc driver failed - jdk 1.4.0_01
Previous Message snpe 2002-09-06 17:37:15 Re: problem with new autocommit config parameter and jdbc