Re: TEXT columns should indentify as java.sql.Types.CLOB
От | Toni Helenius |
---|---|
Тема | Re: TEXT columns should indentify as java.sql.Types.CLOB |
Дата | |
Msg-id | E6A9CAA76548CB4EB02D2E3B174DD3B155381F0EC3@ink.sad.syncrontech.com обсуждение исходный текст |
Ответ на | Re: TEXT columns should indentify as java.sql.Types.CLOB (Oliver Jowett <oliver@opencloud.com>) |
Ответы |
Re: TEXT columns should indentify as java.sql.Types.CLOB
|
Список | pgsql-jdbc |
Hi, Here is the best I can do, I'm sure you'll manage to fill in the holes: private static final String DRIVER = "org.postgresql.Driver"; private static final String URL = "jdbc:postgresql://localhost/testdb"; private static final String USERNAME = "root"; private static final String PASSWORD = ""; Class.forName("DRIVER"); Connection connection = DriverManager.getConnection(URL, USERNAME, PASSWORD); DatabaseMetaData metaFrom = connection.getMetaData(); // Get the columns ResultSet cols = metaFrom.getColumns(null, YOUR_SCHEMA_HERE, YOUR_TABLE_NAME_HERE, null); // Get column info while (cols.next()) { println("Column name: " + cols.getString("COLUMN_NAME")); short type = cols.getShort("DATA_TYPE")); if (java.sql.Types.BOOLEAN == type) { println("A boolean"); } else { println("Not a boolean! (" + type + ")"); } println("Postgre calls this: " + cols.getString("TYPE_NAME")); } -----Original Message----- From: Oliver Jowett [mailto:oliver@opencloud.com] Sent: 18. elokuuta 2010 10:32 To: Toni Helenius Cc: pgsql-jdbc@postgresql.org Subject: Re: [JDBC] TEXT columns should indentify as java.sql.Types.CLOB Toni Helenius wrote: > Hi, > > An definitely a bug: BOOLEAN columns get identified as java.sql.Types.VARCHAR. Not java.sql.Types.BOOLEAN as they should.I end up getting SQL create statements where boolean fields are translated back as VARCHAR(1). That does sound like a bug. Do you have a self-contained testcase showing the problem? -O
В списке pgsql-jdbc по дате отправления: