Hi all, This is my problem: I have a database. I use JDBC with MS SQL on Windows 2000 to access the database. In my database, I create a table and the table has a field which is VARCHAR(50). When I insert data into the table, even if the length of the data is less than 50 but the value of the field is always 50 characters. Please help me! Thanks in advance. Luong.
which jdbc driver are you using? Are there any known bugs? Are you sure it is a VARCHAR field in the DB and not a CHAR?? What is the length of the String before the insert to the DB? very puzzling! Jamie
Hi One thing you could try is trimming the String variable before sending it to the DB via JDBC (use the <code>trim()</code> of the String class). May not make any difference, but just a thought... The first thing, as always, is to figure our WHERE this behaviour is taking place (i.e. is it in the Java code, the JDBC call, the stored proc/SQL, or the database itself?)
------------------ "One good thing about music - when it hits, you feel no pain" Bob Marley
"One good thing about music - when it hits, you feel no pain" <P>Bob Marley