File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes PSQLException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "PSQLException" Watch "PSQLException" New topic


Sanju Thomas
Ranch Hand

Joined: Dec 29, 2004
Posts: 243
Hi all,

I am trying to move some data from Oracle to postgres. In few occasions I am getting SQLException from postgres driver, as a result program termiates with out completion. I understand that there is something rong with my data, but I did not understand the reason for this. Can any one hrlp me ?

SQLException in createQuery
org.postgresql.util.PSQLException: Zero bytes may not occur in
string parameters.
at org.postgresql.core.v2.SimpleParameterList.setStringParamete(
at org.postgresql.jdbc2.AbstractJdbc2Statement.bindString(
at org.postgresql.jdbc2.AbstractJdbc2Statement.setString(
at org.postgresql.jdbc2.AbstractJdbc2Statement.setString(
at net.assyst.databse.migration.O2P.createQuery(
at net.assyst.databse.migration.O2P.readTables(
at net.assyst.databse.migration.O2P.main(
Annie Smith
Ranch Hand

Joined: Mar 05, 2005
Posts: 172
Are you setting any parameter as "" ??? It might be due to the DB driver.

Cheers!<br /><b>Annie</b>
Avi Abrami
Ranch Hand

Joined: Oct 11, 2000
Posts: 1141

If you post the part of your code that is causing the error, then someone may be able to help you. Otherwise we're just going to have to guess (like Annie did).

Good Luck,
Sanju Thomas
Ranch Hand

Joined: Dec 29, 2004
Posts: 243
Hi Avi,
I was asking on this context.

I was trying to read a table from Oracle and trying to insert the data into Postgres. Perl was used to insert data into Oracle. It must have inserted the NUL character too. So when I was trying to insert the same data into Postgres using JDBC, I got the exception specified in the first post. Now I cleared the problem using "str = str.replaceAll("\\u00","");" ranchers helped me in another thread. Thank you all.
I agree. Here's the link:
subject: PSQLException
It's not a secret anymore!