Quantcast
Channel: MySQL Forums - Connector/J, JDBC and Java
Viewing all articles
Browse latest Browse all 884

PreparedStatement with Hexadecimal Literals (no replies)

$
0
0
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.

Viewing all articles
Browse latest Browse all 884

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>