my dog learned polymorphism*
The moose likes JDBC and the fly likes convert Double to BigInteger and retrieving byte array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "convert Double to BigInteger and retrieving byte array" Watch "convert Double to BigInteger and retrieving byte array" New topic
Author

convert Double to BigInteger and retrieving byte array

Moiez Gohar
Greenhorn

Joined: Mar 26, 2009
Posts: 8
my application requires BigInteger values to be used as prime numbers used to generate RSA encryption and decryption keys.
I am using Microsoft Jet Driver with MS Access 2000, and so had to go for BigDecimal instead of BigInteger (as BigInteger is not a supported type, neither by JDBC nor by Access 2000).



now, for retrieving the byte[] from the first column, and the BigDecimal from the next, following is the code:


when i insert any row into my table, the insertion is executed successfully.
but when i issue the selection query, i get the result in which the byte arrays are succeeded by a number of 0-valued bytes like: for the byte array: {1,3} i get the result as: 2 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ..... (totally 508 zeroes)

what is wrong with my code?? why am i not getting back the exact byte array as 2 3 ?? please HELP.
Moiez Gohar
Greenhorn

Joined: Mar 26, 2009
Posts: 8
i am sorry for wrongly phrasing the topic...

my objective is to store byte[] in the first column of the table, and a BigInteger in the next column. I am using MS Access 2000. I am using JDBC:ODBC bridge with Microsoft Jet Driver.

what should i do to attain my aforementioned objective??
should i use a different driver, or a different DBMS??
please guide me!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: convert Double to BigInteger and retrieving byte array
 
Similar Threads
BadPaddingException: Data must start with zero
how to insert a byte array into an MS Access database
how to insert byte[] into mysql database
inserting byte[] into MS Access Database...
Conversion problem