Yes you are very correct Jamie,
Thank you.
But this works only when there is a record in the table. My intention is to get the actual size of a field of a table in a database without considering, wheter there is a record or not.
I have written here the code which I have used.
Please go thru it and guide me where to change to succeed.
Thanking you in advance
GMohanraj
ResultSet rslt=stmt.executeQuery("SELECT * FROM user");
ResultSetMetaData rsmd=rslt.getMetaData();
int noCol=rsmd.getColumnCount();
String colName="";
int colSize=0;
System.out.println("Column Name | Column Size");
while (rslt.next())
{
for(int i=1; i<=noCol;++i)
{
colName=rsmd.getColumnName(i);
colSize=rsmd.getColumnDisplaySize(i);
System.out.println(colName+" | "+colSize);
}
System.out.println("----------------------------");
}