Database column size using JDBC getMetdata


Database column size using JDBC getMetdata


  Our application lets admins access Teradata tables through frontend views. Certains columns are editable. We are trying to limits users to enter only a certain length of value given what the database column size has been defined as. 

We were hoping the following Java JDBC call will help us out in figuring the max size per column, but its not helping.

This is the code snippet that we were hoping that some one can help us out with:

dbColumnName = rs.getMetaData().getColumnName(colIndx);

                                        columnInfo = new DataTableColumnMetaData(colIndx-1,








                                                                                                                false,/* NOT VISIBLE */


The JDBC driver version are: Implementation-Version:

Teradata Employee

Re: Database column size using JDBC getMetdata

The ResultSetMetaData.getColumnDisplaySize method returns the maximum number of characters needed to display the designated column's values in character form. It should provide a fairly good approximation for your need.