JDBC 7.3 dev (Java 2 SDK 1.4.0)
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();
}
}
}
Remove the quotes around id, and let me know what happens
Dave
Show quoted text
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
deletedThanks
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.orgWhat 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@postgresql.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@postgresql.org)
Import Notes
Reply to msg id not found: 200209061652.05575.snpe@snpe.co.yu
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.
Show quoted text
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 deletedThanks
Haris PecoOn 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.orgWhat 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@postgresql.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@postgresql.org)---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
I set autocommit true in postgresql.conf and program work fine
regards
Haris Peco
Show quoted text
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 deletedThanks
Haris PecoOn 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.orgWhat 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@postgresql.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@postgresql.org)---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster
Hello,
If I set db.setAutoCommit(false) after getConnection row is deleted
Driver don't see parameter autocommit in postgresql.conf
regards
Show quoted text
On Friday 06 September 2002 05:21 pm, snpe wrote:
I set autocommit true in postgresql.conf and program work fine
regards
Haris PecoOn 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 deletedThanks
Haris PecoOn 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.orgWhat 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@postgresql.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@postgresql.org)---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?
Hello Dave,
I am find bug with CallableStatement. in Pgsql JDBC (I think that is bug)
CallableStatement interface extends PreparedStatement (jdbc 3.0 specification)
and
command DELETE or UPDATE must work like with PreparedStatement
Pgsql JDBC work only with {[? =] call <some_function> ([? [,?]*]) } form
Next code work in Oracle :
import java.io.*;
import java.sql.*;
import java.text.*;
public class PrepStatTestOra
{
Connection db;
String stat="DELETE FROM org_ban WHERE id = ?";
String delid = "4";
public PrepStatTestOra() throws ClassNotFoundException,
FileNotFoundException, IOException, SQLException
{
Class.forName("oracle.jdbc.OracleDriver");
db = DriverManager.getConnection("jdbc:oracle:thin:@spnew:1521:V9i",
"snpe2001", "snpe2001");
//db.setAutoCommit(false);
//PrepareStatement st = db.prepareStatement(stat);
CallableStatement st = db.prepareCall(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
{
PrepStatTestOra test = new PrepStatTestOra();
}
catch (Exception ex)
{
System.err.println("Exception caught.\n" + ex);
ex.printStackTrace();
}
}
}
This is for pgsql :
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");
db.setAutoCommit(false); // hack for 'autocommit true' in postgresql.conf
//PrepareStatement st = db.prepareStatement(stat); // PreparedStatement work
fine
CallableStatement st = db.prepareCall(stat); // this must work like previous
line with PreparedStatement
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();
}
}
}
Example for Oracle work fine and Pgsql get error (same in JDeveloper) :
Exception caught.
Malformed stmt [DELETE FROM org_ban WHERE "id" = ?] usage : {[? =] call
<some_function> ([? [,?]*]) }
Malformed stmt [DELETE FROM org_ban WHERE "id" = ?] usage : {[? =] call
<some_function> ([? [,?]*]) }
at
org.postgresql.jdbc1.AbstractJdbc1Statement.modifyJdbcCall(AbstractJdbc1Statement.java:1720)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.parseSqlStmt(AbstractJdbc1Statement.java:88)
at
org.postgresql.jdbc1.AbstractJdbc1Statement.<init>(AbstractJdbc1Statement.java:79)
at
org.postgresql.jdbc2.AbstractJdbc2Statement.<init>(AbstractJdbc2Statement.java:32)
at
org.postgresql.jdbc3.AbstractJdbc3Statement.<init>(AbstractJdbc3Statement.java:23)
at
org.postgresql.jdbc3.Jdbc3CallableStatement.<init>(Jdbc3CallableStatement.java:11)
at org.postgresql.jdbc3.Jdbc3Connection.prepareCall(Jdbc3Connection.java:36)
at
org.postgresql.jdbc2.AbstractJdbc2Connection.prepareCall(AbstractJdbc2Connection.java:39)
at PrepStatTest.<init>(PrepStatTest.java:16)
at PrepStatTest.main(PrepStatTest.java:29)
Show quoted text
On Friday 06 September 2002 05:38 pm, you wrote:
Possibly, callable statements are a bit of a hack in postgres, since
they don't really exist. If you can send me something that causes the
errors I can try to fix it.Dave
On Fri, 2002-09-06 at 11:59, snpe wrote:
Hello,
This is postgresql error on DELETE command
'Malformed stmt' is in CallableStatement in JDBC source only
I think that CallableStatement in Pgsql JDBC driver have any
incompatibilty because meratnt drivers (for DB2, MS SQL) work fineThanks
Haris Peco
(org.postgresql.util.PSQLException) Malformed stmt [DELETE FROM org_ban
WHERE "id"=?] usage : {[? =] call <some_function> ([? [,?]*]) }On Friday 06 September 2002 05:21 pm, you wrote:
No, not off hand, I've never used JDeveloper, nor have I seen that
error messageSorry,
Dave
On Fri, 2002-09-06 at 11:36, snpe wrote:
Hi Dave
Have You any cooment on my P.S. (problem with JDeveloper) ?On Friday 06 September 2002 05:07 pm, you wrote:
Hmmm.... interesting, I guess we have to fix that in the driver
Dave
On Fri, 2002-09-06 at 11:21, snpe wrote:
I set autocommit true in postgresql.conf and program work fine
regards
Haris PecoOn 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 deletedThanks
Haris PecoOn 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.orgWhat 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@postgresql.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@postgresql.org)---------------------------(end of
broadcast)--------------------------- TIP 4: Don't 'kill -9'
the postmaster---------------------------(end of
broadcast)--------------------------- TIP 6: Have you searched
our list archives?
Import Notes
Reply to msg id not found: 1031326711.2646.88.camel@inspiron.cramers
Hello Barry,
JDBC driver must find autocommit (off or on) and set autoCommit field
when open connection.
regards
Show quoted text
On Friday 06 September 2002 06:52 pm, Barry Lind wrote:
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,
--Barrysnpe 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 inpostgresql.conf
is off (no auto commit).
I am tried with db.autocommit(true) after getConnection, but no successI thin that is bug in JDBC
PGSql 7.3 beta have new features autocommit on/off and JDBC driverdon't work
with autocommit off
Thanks
P.S
I am play ith Oracle JDeveloper 9i and Postgresql and I get error inprepared
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 FROMorg_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 deletedThanks
Haris PecoOn 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.orgWhat 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@postgresql.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@postgresql.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@postgresql.org so that your
message can get through to the mailing list cleanly
Import Notes
Reply to msg id not found: 3D78DD5B.1060804@xythos.com
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 successI 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 deletedThanks
Haris PecoOn 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.orgWhat 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@postgresql.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@postgresql.org)
---------------------------(end of
broadcast)---------------------------
Show quoted text
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@postgresql.org so that your
message can get through to the mailing list cleanly
Barry Lind wrote:
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?
Yes, I thought that was the best fix for apps that can't deal with
autocommit being off.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
On Saturday 07 September 2002 02:55 am, Bruce Momjian wrote:
Barry Lind wrote:
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?Yes, I thought that was the best fix for apps that can't deal with
autocommit being off.
Can client get information from backend for autocommit (on or off) and that
work like psql ?
snpe wrote:
On Saturday 07 September 2002 02:55 am, Bruce Momjian wrote:
Barry Lind wrote:
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?Yes, I thought that was the best fix for apps that can't deal with
autocommit being off.Can client get information from backend for autocommit (on or off) and that
work like psql ?
Sure, you can do SHOW autocommit.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
On Saturday 07 September 2002 04:07 pm, Bruce Momjian wrote:
snpe wrote:
On Saturday 07 September 2002 02:55 am, Bruce Momjian wrote:
Barry Lind wrote:
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?Yes, I thought that was the best fix for apps that can't deal with
autocommit being off.Can client get information from backend for autocommit (on or off) and
that work like psql ?Sure, you can do SHOW autocommit.
I am interesting with JDBC driver.
When I make connection in base I want that driver find autocommit mode
(from postgresql.conf or call in backend) and set mode true or false
thanks
snpe wrote:
Sure, you can do SHOW autocommit.
I am interesting with JDBC driver.
When I make connection in base I want that driver find autocommit mode
(from postgresql.conf or call in backend) and set mode true or false
You could make a call to current_setting in the backend.
I don't know anything about the jdbc driver, but if it's written in C
something like this should work:
text *autocommit = DatumGetTextP(DirectFunctionCall1(current_setting,
CStringGetDatum("autocommit")));
Would this work?
Joe
On Saturday 07 September 2002 09:12 pm, Joe Conway wrote:
snpe wrote:
Sure, you can do SHOW autocommit.
I am interesting with JDBC driver.
When I make connection in base I want that driver find autocommit mode
(from postgresql.conf or call in backend) and set mode true or falseYou could make a call to current_setting in the backend.
I don't know anything about the jdbc driver, but if it's written in C
something like this should work:text *autocommit = DatumGetTextP(DirectFunctionCall1(current_setting,
CStringGetDatum("autocommit")));Would this work?
Yes.But I don't know like call in JDBC.
Yes it is possible, but according to the jdbc spec, a new connection in
jdbc is always initialized to autocommit=true. So jdbc needs to ignore
whatever the current server setting is and reset to autocommit=true.
--Barry
snpe wrote:
Show quoted text
On Saturday 07 September 2002 02:55 am, Bruce Momjian wrote:
Barry Lind wrote:
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?Yes, I thought that was the best fix for apps that can't deal with
autocommit being off.Can client get information from backend for autocommit (on or off) and that
work like psql ?
Bruce Momjian <pgman@candle.pha.pa.us> writes:
Barry Lind wrote:
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?
Yes, I thought that was the best fix for apps that can't deal with
autocommit being off.
If autocommit=off really seriously breaks JDBC then I don't think a
simple SET command at the start of a session is going to do that much
to improve robustness. What if the user issues another SET to turn it
on?
I'd suggest just documenting that it is broken and you can't use it,
until such time as you can get it fixed. Band-aids that only partially
cover the problem don't seem worth the effort to me.
In general I think that autocommit=off is probably going to be very
poorly supported in the 7.3 release. We can document it as being
"work in progress, use at your own risk".
regards, tom lane
Dear PostgreSQL people,
Sorry for jumping into this conversation in the middle.
Autocommit is very important, as appservers may turn it on or off at
will in order to support EJB transactions (being able to set them up, roll
them back, commit them, etc. by using the JDBC API). If it is broken, then
all EJB apps using PostgreSQL may be broken also. ...This frightens me a
little. Could somebody please explain?
Sincerely,
Daryl.
Show quoted text
-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Monday, September 09, 2002 2:54 PM
To: Bruce Momjian
Cc: Barry Lind; pgsql-jdbc@postgresql.org;
pgsql-hackers@postgresql.org
Subject: Re: [JDBC] [HACKERS] problem with new autocommit config
parameter and jdbcBruce Momjian <pgman@candle.pha.pa.us> writes:
Barry Lind wrote:
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?
Yes, I thought that was the best fix for apps that can't deal with
autocommit being off.If autocommit=off really seriously breaks JDBC then I don't think a
simple SET command at the start of a session is going to do that much
to improve robustness. What if the user issues another SET to turn it
on?I'd suggest just documenting that it is broken and you can't use it,
until such time as you can get it fixed. Band-aids that only
partially
cover the problem don't seem worth the effort to me.In general I think that autocommit=off is probably going to be very
poorly supported in the 7.3 release. We can document it as being
"work in progress, use at your own risk".regards, tom lane
---------------------------(end of
broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
Import Notes
Resolved by subject fallback
Daryl,
The problem is an incompatiblity between a new server autocommit feature
and the existing jdbc autocommit feature. The problem manifests itself
when you turn autocommit off on the server (which is new functionality
in 7.3). If you leave autocommit turned on on the server (which is the
way the server has always worked until 7.3) the jdbc driver correctly
handles issuing the correct begin/commit/rollback commands to support
autocommit functionality in the jdbc driver.
Autocommit will work with jdbc in 7.3 (and it does now as long as you
leave autocommit set on in the postgresql.conf file). We are just need
to decide what to do in this one corner case.
thanks,
--Barry
Daryl Beattie wrote:
Show quoted text
Dear PostgreSQL people,
Sorry for jumping into this conversation in the middle.
Autocommit is very important, as appservers may turn it on or off at
will in order to support EJB transactions (being able to set them up, roll
them back, commit them, etc. by using the JDBC API). If it is broken, then
all EJB apps using PostgreSQL may be broken also. ...This frightens me a
little. Could somebody please explain?Sincerely,
Daryl.
-----Original Message-----
From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
Sent: Monday, September 09, 2002 2:54 PM
To: Bruce Momjian
Cc: Barry Lind; pgsql-jdbc@postgresql.org;
pgsql-hackers@postgresql.org
Subject: Re: [JDBC] [HACKERS] problem with new autocommit config
parameter and jdbcBruce Momjian <pgman@candle.pha.pa.us> writes:
Barry Lind wrote:
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?
Yes, I thought that was the best fix for apps that can't deal with
autocommit being off.If autocommit=off really seriously breaks JDBC then I don't think a
simple SET command at the start of a session is going to do that much
to improve robustness. What if the user issues another SET to turn it
on?I'd suggest just documenting that it is broken and you can't use it,
until such time as you can get it fixed. Band-aids that only
partially
cover the problem don't seem worth the effort to me.In general I think that autocommit=off is probably going to be very
poorly supported in the 7.3 release. We can document it as being
"work in progress, use at your own risk".regards, tom lane
---------------------------(end of
broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly
On Mon, 2002-09-09 at 17:04, snpe wrote:
I'm use 'autocommit=false' and have problem with psql
When any commnad is lost, then next commnad get error for transactions
(simple select command).BTWsnpe> select * from org_ba;
ERROR: relation org_ba does not exists
snpe> select * from org_ban;
ERROR: current transactions is aborted, queries ignored until end of
transaction block
snpe> rollback;
ROLLBACK
snpe> select * from org_ban;
Maybe I'm missing something, but isn't that the expected behaviour when
autocommit is turned off?
--
Rod Taylor
Import Notes
Reply to msg id not found: 200209092304.38918.snpe@snpe.co.yu
On Monday 09 September 2002 08:53 pm, Tom Lane wrote:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
Barry Lind wrote:
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?Yes, I thought that was the best fix for apps that can't deal with
autocommit being off.If autocommit=off really seriously breaks JDBC then I don't think a
simple SET command at the start of a session is going to do that much
to improve robustness. What if the user issues another SET to turn it
on?I'd suggest just documenting that it is broken and you can't use it,
until such time as you can get it fixed. Band-aids that only partially
cover the problem don't seem worth the effort to me.In general I think that autocommit=off is probably going to be very
poorly supported in the 7.3 release. We can document it as being
"work in progress, use at your own risk".
I'm use 'autocommit=false' and have problem with psql
When any commnad is lost, then next commnad get error for transactions
(simple select command).BTW
snpe> select * from org_ba;
ERROR: relation org_ba does not exists
snpe> select * from org_ban;
ERROR: current transactions is aborted, queries ignored until end of
transaction block
snpe> rollback;
ROLLBACK
snpe> select * from org_ban;
this command is ok.
regards
Haris Peco