Skip navigation links

MySQL Forums :: Connector/JDBC and Java :: PreparedStatement with Hexadecimal Literals


Advanced Search

PreparedStatement with Hexadecimal Literals
Posted by: Djellel eddine Difallah ()
Date: July 16, 2013 07:24PM

Hi,

I am trying to insert a Hexadecimal Literal into a varchar column. My overall system logic relies on PreparedStatements, and if I try, setString(1, hexString); my string is wrapped into quotes (note that hexString is a String that stores the hex value):
insert into t1 (col1) values ('X''4D7953514C''');

The goal for the PS is to look like this:
insert into t1 (col1) values (X'4D7953514C');

I have tried setObject() without success, it somehow detects that my variable is a string and wraps it into quotes.

Is it possible to do that with PreparedStatments or do I have to fall back to build the sql query first with a StringBuilder.

Options: ReplyQuote


Subject Written By Posted
PreparedStatement with Hexadecimal Literals Djellel eddine Difallah 07/16/2013 07:24PM
Re: PreparedStatement with Hexadecimal Literals Alexander Soklakov 07/18/2013 03:32AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.