aspose file tools*
The moose likes JDBC 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
Bookmark "PSQLException" Watch "PSQLException" New topic
Author

PSQLException

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(SimpleParameterList.java:61)
at org.postgresql.jdbc2.AbstractJdbc2Statement.bindString(AbstractJdbc2Statement.java:2025)
at org.postgresql.jdbc2.AbstractJdbc2Statement.setString(AbstractJdbc2Statement.java:1155)
at org.postgresql.jdbc2.AbstractJdbc2Statement.setString(AbstractJdbc2Statement.java:1145)
at net.assyst.databse.migration.O2P.createQuery(O2P.java:102)
at net.assyst.databse.migration.O2P.readTables(O2P.java:48)
at net.assyst.databse.migration.O2P.main(O2P.java:213)
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: 1121

Sanju,
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,
Avi.
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: http://aspose.com/file-tools
 
subject: PSQLException
 
Similar Threads
update query
PreparedStatement fails to execute
How to Escape single quotes with PreparedStatment while using PostGresql?
Weired error comes while using stored procedure with hibernate