Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JDBC and the fly likes how to insert byte[] into mysql database Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "how to insert byte[] into mysql database" Watch "how to insert byte[] into mysql database" New topic
Author

how to insert byte[] into mysql database

Moiez Gohar
Greenhorn

Joined: Mar 26, 2009
Posts: 8
i want to store byte[] array in the first column (length of this byte array is always 16) and a BigInteger value (<10^78) in the second column. i used this code to create the table:


the table gets created successfully.

i have used this code to insert a row in this table :


i get the following error on executing the insert query:
Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '_binary'Ç♥♦♣♠\"╨↑ºåà8K',1)' at line 1

i am using Connector/J JDBC on MySQL5.0 database..
please tell me why am i getting this error, and what should i do to remove this error, and achieve my objective of storing a byte[] array in the first field and a BigInteger value in the second field.
please guide me.
also, what are the corresponding SQL queries for inserting a byte[] array and a BigInteger?? what datatypes should i use??
please help me.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: how to insert byte[] into mysql database
 
Similar Threads
inserting byte[] into MS Access Database...
java.sql.SQLException-Need help to resolve.
convert Double to BigInteger and retrieving byte array
how to insert a byte array into an MS Access database
Inserting image to MySQL Database