Hello all,

I have to confirm that the information provided by the driver is not 
always correct. Some time ago, 'DOMAIN.COLUMNS' did not contain a 
'NULLABLE' column, thus a workaround using the 'MODE' column was used.
This, however has the drawback you have observed.

Thanks for reporting this issue

Alexander Schr�der
SAP DB, SAP Labs Berlin


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 24, 2003 12:45 PM
> To: [EMAIL PROTECTED]
> Cc: Schroeder, Alexander
> Subject: Bug in JDBC driver
> 
> 
> Hello,
> 
> We use the new JDBC-Driver 7.4.4 Build 001-000-156-985
> (sapdb-jdbc-bin-7.4.04.01a.jar).
> 
> The following codefragment in java/JDBC shows a bug (I think) in the
> jdbc-driver: If a DEFAULT-value is specified for a column, the
> "IS_NULLABLE" and "NULLABLE"-attributes in the
> DataBaseMetadate-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.
> 
> PS: the query SELECT * FROM COLUMNS WHERE TABLENAME='TEST_A' shows the
> correct result, so I expect that the bug is in the JDBC-driver.
> 
> G. Matter
> ________________________________________
> 
> Invoca Systems     Tel 0041 61 813 94 61
> Hauptstr 92a       Fax 0041 61 813 94 60
> 4422 Arisdorf              www.invoca.ch
> ________________________________________
> 
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to