This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Converting SQLServer 2005 uniqueIdentifier column to java.util.UUID 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 "Converting SQLServer 2005 uniqueIdentifier column to java.util.UUID" Watch "Converting SQLServer 2005 uniqueIdentifier column to java.util.UUID" New topic
Author

Converting SQLServer 2005 uniqueIdentifier column to java.util.UUID

Sander Evanfield
Greenhorn

Joined: Oct 15, 2004
Posts: 13


I have a uniqueidentifier column in SQLServer 5 table which is retrieved through JDBC (Driver Sparta)

String uniqueColumn = resultSet.getString(1);

actual column in database has value 067e6162-3b6f-4ae2-a171-2470b63dff00

uniqueColumn holds 067e61623b6f4ae2a1712470b63dff00

When I try to get a UUID from uniqueColumn using UUID.fromString(uniqueColumn) I get IllegalStateException as unique column does not hold UUID representation.

Am i missing something here or it is a known bug I can put the dashes in the string and it should work but need an elegant solution supported by JDBC


xxx
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Converting SQLServer 2005 uniqueIdentifier column to java.util.UUID
 
Similar Threads
JDBC Error MSSQL Uniqueidentifier
Oracle or SQL Server?
Uniqueidentifier column type is not supporting in prepared statement
How to view the Datatypes of the Columns of a Table in SQLSERVER
][SQLServer 2000 Driver for JDBC]ResultSet can not re-read