| Bug #76187 | getTypeInfo report maximum precision of 255 for varchar | ||
|---|---|---|---|
| Submitted: | 6 Mar 2015 12:40 | Modified: | 12 Aug 2015 0:52 | 
| Reporter: | Dan O'Brien | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S3 (Non-critical) | 
| Version: | 5.7 | OS: | Any | 
| Assigned to: | Alexander Soklakov | CPU Architecture: | Any | 
| Tags: | DatabaseMetaData, getTypeInfo, jdbc, precision | ||
   [10 Mar 2015 6:58]
   Alexander Soklakov        
  Hi Dan, Thank you for the report, you are correct, 255 precision is a 4.1 server legacy and needs to be updated for newer versions.
   [12 Aug 2015 0:52]
   Daniel So        
  Added the following entry to the Connector/J 5.1.37 changelog: "getTypeInfo() returned an incorrect PRECISION value of '255' for the data type of VARCHAR. The return value has been corrected to '65535.'"


Description: The getTypeInfo method returns a PRECISION value of 255 for TYPE_NAME=VARCHAR. It should be 65535. How to repeat: DatabaseMetaData dm = conn.getMetaData(); ResultSet rs = dm.getTypeInfo() while(rs.next()){ if(rs.getString("TYPE_NAME").equals("VARCHAR"))){ System.out.println(rs.getInt("PRECISION")); } Suggested fix: change value to 65535