JDBC 7.3 dev (Java 2 SDK 1.4.0)

Started by snpeover 23 years ago71 messageshackers
Jump to latest
#1snpe
snpe@snpe.co.yu

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();
}
}
}

#2Dave Cramer
pg@fastcrypt.com
In reply to: snpe (#1)
Re: JDBC 7.3 dev (Java 2 SDK 1.4.0)

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
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@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)

#3snpe
snpe@snpe.co.yu
In reply to: Dave Cramer (#2)
Re: JDBC 7.3 dev (Java 2 SDK 1.4.0)

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 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@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

#4snpe
snpe@snpe.co.yu
In reply to: Dave Cramer (#2)
Re: JDBC 7.3 dev (Java 2 SDK 1.4.0)

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 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@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

#5snpe
snpe@snpe.co.yu
In reply to: snpe (#4)
Re: JDBC 7.3 dev (Java 2 SDK 1.4.0)

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 Peco

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@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?

http://archives.postgresql.org

#6snpe
snpe@snpe.co.yu
In reply to: snpe (#1)
Re: JDBC 7.3 dev (Java 2 SDK 1.4.0)

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 fine

Thanks
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 message

Sorry,

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 Peco

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@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?

http://archives.postgresql.org

#7snpe
snpe@snpe.co.yu
In reply to: snpe (#1)
Re: problem with new autocommit config parameter and jdbc

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,
--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@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

#8Barry Lind
barry@xythos.com
In reply to: snpe (#1)
problem with new autocommit config parameter and 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@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

#9Bruce Momjian
bruce@momjian.us
In reply to: Barry Lind (#8)
Re: problem with new autocommit config parameter and jdbc

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
#10snpe
snpe@snpe.co.yu
In reply to: Bruce Momjian (#9)
Re: [JDBC] problem with new autocommit config parameter and jdbc

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 ?

#11Bruce Momjian
bruce@momjian.us
In reply to: snpe (#10)
Re: [JDBC] problem with new autocommit config parameter and

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
#12snpe
snpe@snpe.co.yu
In reply to: Bruce Momjian (#11)
Re: [JDBC] problem with new autocommit config parameter and jdbc

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

#13Joe Conway
mail@joeconway.com
In reply to: Bruce Momjian (#11)
Re: [JDBC] problem with new autocommit config parameter

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

#14snpe
snpe@snpe.co.yu
In reply to: Joe Conway (#13)
Re: [JDBC] problem with new autocommit config parameter

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 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?

Yes.But I don't know like call in JDBC.

#15Barry Lind
barry@xythos.com
In reply to: Bruce Momjian (#9)
Re: [JDBC] problem with new autocommit config parameter

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 ?

#16Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#9)
Re: problem with new autocommit config parameter and jdbc

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

#17Daryl Beattie
dbeattie@insystems.com
In reply to: Barry Lind (#15)
Re: [JDBC] problem with new autocommit config parameter

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 jdbc

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

---------------------------(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

#18Barry Lind
barry@xythos.com
In reply to: Daryl Beattie (#17)
Re: [JDBC] problem with new autocommit config parameter

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 jdbc

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

---------------------------(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

#19Rod Taylor
rbt@rbt.ca
In reply to: Bruce Momjian (#9)
Re: problem with new autocommit config parameter and jdbc

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).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;

Maybe I'm missing something, but isn't that the expected behaviour when
autocommit is turned off?

--
Rod Taylor

#20snpe
snpe@snpe.co.yu
In reply to: Tom Lane (#16)
Re: problem with new autocommit config parameter and jdbc

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

#21Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: snpe (#20)
#22snpe
snpe@snpe.co.yu
In reply to: Rod Taylor (#19)
#23snpe
snpe@snpe.co.yu
In reply to: Stephan Szabo (#21)
#24Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: snpe (#23)
#25Tom Lane
tgl@sss.pgh.pa.us
In reply to: snpe (#20)
#26Curt Sampson
cjs@cynic.net
In reply to: Tom Lane (#25)
#27Curt Sampson
cjs@cynic.net
In reply to: Tom Lane (#16)
#28Tom Lane
tgl@sss.pgh.pa.us
In reply to: Curt Sampson (#27)
#29Tom Lane
tgl@sss.pgh.pa.us
In reply to: Curt Sampson (#26)
#30snpe
snpe@snpe.co.yu
In reply to: Stephan Szabo (#24)
#31Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: snpe (#30)
#32Barry Lind
barry@xythos.com
In reply to: Curt Sampson (#27)
#33Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#29)
#34scott.marlowe
scott.marlowe@ihs.com
In reply to: Stephan Szabo (#31)
#35Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#33)
#36Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#35)
#37Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: scott.marlowe (#34)
#38scott.marlowe
scott.marlowe@ihs.com
In reply to: Stephan Szabo (#37)
#39Tom Lane
tgl@sss.pgh.pa.us
In reply to: Bruce Momjian (#36)
#40Bruce Momjian
bruce@momjian.us
In reply to: Tom Lane (#39)
#41snpe
snpe@snpe.co.yu
In reply to: Tom Lane (#39)
#42snpe
snpe@snpe.co.yu
In reply to: scott.marlowe (#34)
#43Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: snpe (#42)
#44Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Stephan Szabo (#43)
#45snpe
snpe@snpe.co.yu
In reply to: Stephan Szabo (#43)
#46snpe
snpe@snpe.co.yu
In reply to: Stephan Szabo (#44)
#47Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: snpe (#46)
#48snpe
snpe@snpe.co.yu
In reply to: Stephan Szabo (#47)
#49Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: snpe (#48)
#50Curt Sampson
cjs@cynic.net
In reply to: Tom Lane (#29)
#51Curt Sampson
cjs@cynic.net
In reply to: Barry Lind (#32)
#52Curt Sampson
cjs@cynic.net
In reply to: Bruce Momjian (#40)
#53Bruce Momjian
bruce@momjian.us
In reply to: Curt Sampson (#52)
#54Rod Taylor
rbt@rbt.ca
In reply to: Curt Sampson (#50)
#55Barry Lind
barry@xythos.com
In reply to: Curt Sampson (#51)
#56Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: snpe (#48)
#57Curt Sampson
cjs@cynic.net
In reply to: Barry Lind (#55)
#58Rod Taylor
rbt@rbt.ca
In reply to: Stephan Szabo (#56)
#59Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Rod Taylor (#58)
#60Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: Stephan Szabo (#59)
#61snpe
snpe@snpe.co.yu
In reply to: Stephan Szabo (#56)
#62snpe
snpe@snpe.co.yu
In reply to: Stephan Szabo (#49)
#63Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: snpe (#62)
#64snpe
snpe@snpe.co.yu
In reply to: Rod Taylor (#58)
#65snpe
snpe@snpe.co.yu
In reply to: Stephan Szabo (#60)
#66Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: snpe (#65)
#67snpe
snpe@snpe.co.yu
In reply to: Bruce Momjian (#9)
#68snpe
snpe@snpe.co.yu
In reply to: snpe (#67)
#69snpe
snpe@snpe.co.yu
In reply to: Stephan Szabo (#66)
#70Stephan Szabo
sszabo@megazone23.bigpanda.com
In reply to: snpe (#69)
#71Kris Jurka
books@ejurka.com
In reply to: snpe (#68)