JDBC describe returns INTEGER type for a CHAR field
-
Friday, November 16, 2012 9:41 PM
Hello,
I'm seeing what seems like a bug in JDBC, which I'm able to reproduce with JDBC Driver 4.0 and SQL Server 2012. I wanted to check if this was already noted or addressed somewhere before opening a support case.
I'm running a query with two parameters. The second parameter of the query should be described as type 1 (CHAR), but instead is returned as type 4 (INTEGER). The method which returns the incorrect value is ParameterMetaData.getParameterType()
I have a standalone reproduction ready, here is the log for it that shows the query and the returns:
Excuting statement: CREATE TABLE TESTMSS (FA01SMALLINT SMALLINT, FA02INTEGER INTEGER, FA07CHAR_10 CHAR(10) )
Issue commit
Prepare statement: SELECT FA01SMALLINT, FA02INTEGER, FA07CHAR_10 FROM TESTMSS WHERE FA01SMALLINT < ? AND FA02INTEGER > 12345 AND FA07CHAR_10 > ? ORDER BY FA01SMALLINT
Parameter count is 2
Parameter 1 type is 5
Parameter 1 typename is smallint
Parameter 2 type is 4
Parameter 2 typename is int
close connection
All Replies
-
Sunday, November 18, 2012 12:27 PMModerator
Hello,
Please, could tell us the exact version of your jdbc driver 4.0 and from where you have download it ?
http://www.microsoft.com/en-us/download/details.aspx?id=11774
http://msdn.microsoft.com/en-us/library/ms378749.aspx
http://www.microsoft.com/en-us/download/details.aspx?id=29065
Anyway, you should post the code inside the error occured, it would be easier to understand your problem
We are waiting for your feedback to try to help you more efficiently
Have a nice day
Mark Post as helpful if it provides any help.Otherwise,leave it as it is.

