Hello Gabriel, yes, the JDBC driver is sometimes not correct here. That is, because of once upon a time, the DOMAIN.COLUMNS system view contained only a column MODE, which was either KEY, OPT, MAN (and the 'nullable' feature was guessed from that, which is not always correct). But, as I said, some time hass passed since then, and the NULLABLE column of DOMAIN.COLUMNS provides the needed information correctly, and should be used by the driver for this purpose.
Thank you for reporting this issue. Anyway, the issue will of course persist for those old databases that do not know of the NULLABLE column in DOMAIN.COLUMNS. Sorry for any inconvenience caused Alexander Schr�der SAP DB, SAP Labs Berlin > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Sunday, May 02, 2004 10:50 PM > To: [EMAIL PROTECTED] > Subject: Bug in JDBC Driver: Wrong result for IS_NULLABLE in MetaData > when a DEFAULT value was specified > > > Hello, > > 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] -- MaxDB Discussion Mailing List For list archives: http://lists.mysql.com/maxdb To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
