*
The moose likes JDBC and the fly likes Uniqueidentifier column type is not supporting in prepared statement Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Uniqueidentifier column type is not supporting in prepared statement " Watch "Uniqueidentifier column type is not supporting in prepared statement " New topic
Author

Uniqueidentifier column type is not supporting in prepared statement

Naresh Talluri
Ranch Hand

Joined: Oct 12, 2007
Posts: 115
Hi Folks

I have an issue with storing uniqueidentifier column in Database using prepared statement.

Am using postgre sql database, in postgres we have one uniqueidentifier column type and am using it.
while inserting uniqueidentifier column as string or object using prepared statement it is throwing exception like



here is the sample code :




if the column type is string/int/object i can able to store using prepared statement, but because of uniqueidentifier type am not able to insert into DB.

Could anyone of please give me some idea how to do it using JDBC.

I really appriciate if anyone having any suggestion.


Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30123
    
150

Naresh,
I went through this yesterday for Timestamps. (postgresql is WAY to picky with types.) I haven't had occasion to try for Unique Ids but searched and found this. The suggestion is to use setObject which sounds reasonable.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Naresh Talluri
Ranch Hand

Joined: Oct 12, 2007
Posts: 115
Hi Jeanne

Thank you for your suggestion, but i tried with setObject() as well, and i followed the link and tried as they shown example.


but this is also not work it out.

Could you please let me know if you have any other ideas..

Thank you for your reply.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Uniqueidentifier column type is not supporting in prepared statement
 
Similar Threads
JDBC Error MSSQL Uniqueidentifier
Converting SQLServer 2005 uniqueIdentifier column to java.util.UUID
Exception while using select
escape character using prepared statement.
Unable to cast preparestatement of weblogic6.1 to oracleprpepared statement