Can anyone solve this......
I am working with a SQL Server database. I insert data into a column of datatype VARCHAR and size 50. But the data i insert is of say length 10. When it is inserted , it is done so with trailing blank spaces padded till the length is 50. The driver i use is jdbc:odbc. Is it a problem with SQL Server or the driver? No such problem comes for MS-ACCESS.
B'coz of this when that data is retreived, it has trailing blank spaces, which gives me problem afterwards.
Originally posted by Decastod Just trim (ltrim | rtrim ) the value before inserting it into the database from the application. There is no problem with the database nor with the drivers. I think that should do.
Ok, i found a solution i guess. Well, after trimming also this problem does not seem solved. The problem is with the jdbc:odbc driver , b'cos odbc takes varchar as char only(since it is common for many dbs and so some dbs may not have varchar type) and so it must be appending the spaces. However here was a workaround ...
instead of using
When Types.VARCHAR is specified, this problem does not seem to arise.