I currently use INT as type for primary key in JavaDB (Apache Derby), but since I'm implementing an distributed system I would like to change the type to java.util.UUID. A few questions about this:
What datatype in JavaDB/Derby should I use for UUID? I have seen
CHAR(16) FOR BIT DATAbeen mentioned but I don't know much about it. IsVARCHAR(16)an alternative?How should I use it with JDBC? E.g. in an
PreparedStatement, how should I set and get an UUID?If I later would likte to change database to SQL Server, is there a compatible datatype to java.util.UUID?
Simply, How should I use UUID with JavaDB/Derby and JDBC?