lundi 15 février 2016

Trying to get the column size of a column using jdbc metadata

I am trying to recreate a schema for a table using only the metadata from jdbc.

I have it all working except for the column size eg. location VARCHAR(10)

Currently for every column it is printing VARCHAR(2000000000)

The code:

ResultSet rs = databaseMetaData.getColumns(null, null, tableName, null);
while(rs.next()) {
  int columnSize = rs.getInt("COLUMN_SIZE");
}

The expected output is the number used when creating the table that is in the schema but it always returns 2000000000. Is there something simple I am missing?

Aucun commentaire:

Enregistrer un commentaire