Hi,
You can use PreparedStatement for this and let the database driver handle the conversion. For example you've two columns in your table like
table name is myTable and two columns are
myId integer
myText text datatype
[code]
String sql = "INSERT INTO MYTABLE VALUES(?,?)";
String text = "some text";
PreparedStatement st = connection.prepareStatement(sql);
st.setInt(1, 12345);
st.setObject(2,text);
st.executeUpdate();
[code]
Hope it solves your problem.
Regards,
Rakesh
|