Skip to Content.
Sympa Menu

freetds - Re: Trying to get started

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Bob Kline <bkline AT rksystems.com>
  • To: TDS Development Group <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Trying to get started
  • Date: Fri, 16 Jun 2000 20:14:11 -0400 (EDT)


On Fri, 16 Jun 2000, Mark MacRae wrote:

> Please excuse the simple question, but can't even get connected to my
> SQLServer. Included below is a snippit of the exception(s) I get:
>
> Exception- java.lang.NullPointerException
> Exception- java.lang.NullPointerException
> java.sql.SQLException at
> com.internetcds.jdbc.tds.Constructors.newConnection(Constructors.java:305)
> at com.internetcds.jdbc.tds.Driver.connect(Driver.java:257)
> at
> java.sql.DriverManager.getConnection(DriverManager.java:517)
> at
> java.sql.DriverManager.getConnection(DriverManager.java:177)
>
> I compiled the 2.0 version under JDK 1.3. I'm using the following type line
> to get connected:
>
> Connection conn =
> DriverManager.getConnection("jdbc:freetds:sqlserver://server/database",
> "user", "password");
>

Try making a change to Constructors.java. Find the line which compares
the return from java.lang.System.getProperty("java.version") with
"1.2" and sets jdbcVersion to JDBC2_0 if it matches. Change that line
to also look for "1.3" at the beginning of the Java version string.

Here's another (more robust) approach (credit to Stefan Bodewig):

try
{
Class statement =
java.lang.Class.forName("java.sql.Statement");
java.lang.reflect.Method execBatch =
statement.getDeclaredMethod("executeBatch",
new Class[0]);

jdbcVersion = JDBC2_0;
jdbcVersionName = "2_0";
}
catch (NoSuchMethodException nsme)
{
jdbcVersion = JDBC1_0;
jdbcVersionName = "1_0";
}

--
Bob Kline
mailto:bkline AT rksystems.com
http://www.rksystems.com





Archive powered by MHonArc 2.6.24.

Top of Page