We've found a bug in the JDBC-Driver: it was found both in
the new jdbc-driver version sapdbc-7_5_01_00.jar as well as in the former version 7.4.4 Build 001-000-156-985 (file sapdb-jdbc-bin-7.4.04.01a.jar).
The following codefragment in java/JDBC shows this bug in the
jdbc-driver: If a DEFAULT-value is specified for a column, the
"IS_NULLABLE" and "NULLABLE"-attributes in the DataBaseMetaData column info is not correct (see result cols 'A' and 'F'):
Connection con = target.getConnection();
con.createStatement().executeUpdate("CREATE TABLE"
+ " TEST_A (K CHAR(5) KEY,"
+" A BOOLEAN DEFAULT TRUE NOT NULL,"
+" B BOOLEAN DEFAULT TRUE,"
+" C BOOLEAN NOT NULL,"
+" D BOOLEAN,"
+" E FIXED(5) NOT NULL,"
+" F FIXED(5) DEFAULT 1 NOT NULL)");
ResultSet rs = con.getMetaData().getColumns(null, null, "TEST_A",
null);
while(rs.next()) {
System.out.println("COLUMN_NAME: "
+ rs.getString("COLUMN_NAME"));
System.out.println("IS_NULLABLE: "
+ rs.getString("IS_NULLABLE"));
System.out.println("NULLABLE: " + rs.getString("NULLABLE"));
System.out.println();
}
con.createStatement().executeUpdate("DROP TABLE TEST_A");The result:
COLUMN_NAME: K IS_NULLABLE: NO => correct, Key-col NULLABLE: 0
COLUMN_NAME: A IS_NULLABLE: YES => NOT correct NULLABLE: 1
COLUMN_NAME: B IS_NULLABLE: YES => correct NULLABLE: 1
COLUMN_NAME: C IS_NULLABLE: NO => correct NULLABLE: 0
COLUMN_NAME: D IS_NULLABLE: YES => correct NULLABLE: 1
COLUMN_NAME: E IS_NULLABLE: NO => correct NULLABLE: 0
COLUMN_NAME: F IS_NULLABLE: YES => NOT correct NULLABLE: 1
Thanks for any comment/correction. Since we use this feature in our cross-database migration toolkit as well as in our persistence framework, it was great if a fix for that bug was available soon.
PS: the query SELECT * FROM COLUMNS WHERE TABLENAME='TEST_A' shows the correct result, so I expect that the bug is in the the JDBC-driver.
G. Matter ________________________________________
Invoca Systems Tel 0041 61 813 94 61 Saegeweg 15 4304 Giebenach http://www.invoca.ch ________________________________________
-- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
