Here I convert a String into a bytearray before loading it into a MS SQL Server table. The byte array is to be stored in a field of datatype=IMAGE. The 3 fields of the table are: rpt_id (char) rpt_name (char) rpt_data (IMAGE) The code looks like this: String fileData="A,B,C,D,E"; byte defaultBytes = filedata.getBytes(); String insertSQL = "INSERT INTO reports (rpt_id,rpt_name,rpt_data) VALUES ('100','TEST_REPORT'," + defaultBytes + ")"; java.sql.SQLException: [LOUSQL14]Unclosed quotation mark before the character string 'B@2c33ee96)' The above update works if I put defaultBytes within quotes like this: String insertSQL = "INSERT INTO reports (rpt_id,rpt_name,rpt_data) VALUES ('100','TEST_REPORT','" + defaultBytes + "')"; However the problem in this case (I think) is that the bytes gets stored as a textual (literal) value like B@2c33ee96. So when I return the data lateron and convert the bytearray to a string, the string="B@2c33ee96", rather than ="A,B,C,D,E" Please help.
This seems to be more of a JDBC question, so I'm moving it there. In fact you've already posted sopmething like this here, but this post seems to have more useful info in it., so I'll keep it and close the earlier one. Please don't spread your questions out across multiple forums. Thanks.