Skip to Content.
Sympa Menu

freetds - Bug in freeTDS?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Greg Matthews" <gmatthews AT flex.com.au>
  • To: freetds
  • Subject: Bug in freeTDS?
  • Date: Wed, 17 Mar 1999 1:48:51


Dear all,

I get different behaviour when retrieving dates
between the jdbc-odbc bridge and the freeTDS driver
and would like to know if this is a bug or not.

In a nutshell, when using freeTDS as opposed to the
jdbc-odbc bridge, I get a NullPointerException when
a *null* date field is retrieved.

IMO, this is not an exception condition --
it just means that the field does not have a
value which is completed allowable. i.e. an exception
should not be thrown.

The 'deleted' database field used in the example below
is defined as a 'datetime'


environment: JBuilder 2 (Java116), WinNT4, SQL Server 7.0


Here's the test program I run.
----------------------------------------------
package meridian.test;

import java.sql.*;

public class DriverTest {

public static void main( String args[] ) {

try {

Class.forName( args[0] );
Connection cnx = DriverManager.getConnection(
args[1],
args[2],
args[3]
);
Statement stmt = cnx.createStatement();
ResultSet rs = stmt.executeQuery( "select deleted from work_group"
);
rs.next();
System.out.println( "Date = " + rs.getDate( "deleted" ));

} catch( Exception e ) {

e.printStackTrace();

}
}
-----------------------------------

and here's the first run with the jdbc-odbc bridge.

arg 0: sun.jdbc.odbc.JdbcOdbcDriver
arg 1: jdbc:odbc:db_1
arg 2: testuser
arg 3: password

program output (which is what i expected)
-----------------------------------------
AppAccelerator(tm) 1.1.036 for Java (JDK 1.1), x86 version.
Copyright (c) 1998 Inprise Corp. All Rights Reserved.
Date = null



and here's what happens with the freeTDS driver

arg 0: com.internetcds.jdbc.tds.Driver
arg 1: jdbc:freetds:sqlserver://greg:1433/db_1
arg 2: testuser
arg 3: password

and the output...


AppAccelerator(tm) 1.1.036 for Java (JDK 1.1), x86 version.
Copyright (c) 1998 Inprise Corp. All Rights Reserved.
java.lang.NullPointerException
at com.internetcds.jdbc.tds.ResultSet.getDate(ResultSet.java:583)
at com.internetcds.jdbc.tds.ResultSet.getDate(ResultSet.java:596)
at meridian.test.DriverTest.main(DriverTest.java:17)


I can't work out if i'm doing something completely stupid
or its a bug, or in fact, the jdbc-odbc bridge does not
behave to the java spec.

Any help much appreciated
Greg.




Archive powered by MHonArc 2.6.24.

Top of Page