MySQL Forums
Forum List  »  Connector/JDBC and Java

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
July 16, 2013 07:24PM


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.