Open GoogleCodeExporter opened 9 years ago
MsAccess 2000 adapter is available (based on Jackcess library).
For other formars we are testing commercial drivers (hxtt).
Original comment by jtondato@gmail.com
on 30 Jun 2009 at 3:20
we are waiting for response of hxtt support team, the issue is how to create a
UUID
from the binary obtained for GUIDs fields.
Original comment by jtondato@gmail.com
on 3 Jul 2009 at 3:27
MsAccess represents the GUID as byte[16] 128 bits, the first 8 bytes (64 bits)
are
the most significant bits of the guid and the last 8 bytes (64 bits) are the
least
significant bits of the guid.
For Read a GUID:
byte[] bytes= ...; // bytes read form result set
byte[] bytesMostSignificant = new byte[8];
bytesMostSignificant[0] = bytes[3];
bytesMostSignificant[1] = bytes[2];
bytesMostSignificant[2] = bytes[1];
bytesMostSignificant[3] = bytes[0];
bytesMostSignificant[6] = bytes[7];
bytesMostSignificant[7] = bytes[6];
bytesMostSignificant[4] = bytes[5];
bytesMostSignificant[5] = bytes[4];
Long mostSignificant = ByteBuffer.wrap(bytesMostSignificant).getLong
();
byte[] bytesLestSignificant = new byte[8];
bytesLestSignificant[0] = bytes[8];
bytesLestSignificant[1] = bytes[9];
bytesLestSignificant[2] = bytes[10];
bytesLestSignificant[3] = bytes[11];
bytesLestSignificant[4] = bytes[12];
bytesLestSignificant[5] = bytes[13];
bytesLestSignificant[6] = bytes[14];
bytesLestSignificant[7] = bytes[15];
Long leastSignificant = ByteBuffer.wrap(bytesLestSignificant).getLong
();
UUID uuid = new UUID(mostSignificant, leastSignificant);
For Write a GUID:
UUID uuid = ....; // application guid to save
long mostSignificantBits = uuid.getMostSignificantBits();
ByteArrayOutputStream mostSignificantBAOS = new ByteArrayOutputStream
();
DataOutputStream mostSignificantDOS = new DataOutputStream
(mostSignificantBAOS);
mostSignificantDOS.writeLong(mostSignificantBits);
mostSignificantDOS.flush();
byte[] mostSigBytes = mostSignificantBAOS.toByteArray();
long leastSignificantBits = uuid.getLeastSignificantBits();
ByteArrayOutputStream leastSignificantBAOS = new
ByteArrayOutputStream();
DataOutputStream leastSignificantDOS = new DataOutputStream
(leastSignificantBAOS);
leastSignificantDOS.writeByte(mostSigBytes[3]);
leastSignificantDOS.writeByte(mostSigBytes[2]);
leastSignificantDOS.writeByte(mostSigBytes[1]);
leastSignificantDOS.writeByte(mostSigBytes[0]);
leastSignificantDOS.writeByte(mostSigBytes[5]);
leastSignificantDOS.writeByte(mostSigBytes[4]);
leastSignificantDOS.writeByte(mostSigBytes[7]);
leastSignificantDOS.writeByte(mostSigBytes[6]);
leastSignificantDOS.writeLong(leastSignificantBits);
leastSignificantDOS.flush();
byte[] bytes = leastSignificantBAOS.toByteArray(); // bytes to
write in result set
Original comment by jtondato@gmail.com
on 7 Jul 2009 at 7:09
Original issue reported on code.google.com by
jtondato@gmail.com
on 22 Jun 2009 at 5:13