Skip to Content.
Sympa Menu

freetds - CallableStatement - setString method

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Sean" <sruff AT syneractive.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: CallableStatement - setString method
  • Date: Wed, 11 Jul 2001 16:41:10 -0400


1. Information:
(1)We are using the latest freetds_jdbc_snapshot.jar dated 03/08/2001.
(2)The version of the TDS protocol: not specified, therefore defaults to
TDS 4.2., also tried setting version to 7.0 in the URL
(3)The version of the JVM: 1.2.2
(4)DBMS: SQL Server 7.0, Platform: WinNT(4.0) Server.
(5)Client machine: Redhat 7.1. Web Server: tomcat 3.2.

2. Details of the problem:
I'm having problems while calling any stored procedure which takes a
varchar and I attempt to use the setString method. If I use the setInt
(although it takes a varchar) to test it, everything works fine but
setString fails. Using setString with a PreparedStatement works fine
however.


BELOW IS A SNIPPLET OF THE CODE CAUSING THE PROBLEM:


Class.forName("com.internetcds.jdbc.tds.Driver").newInstance();
Connection conn =
DriverManager.getConnection("jdbc:freetds:sqlserver://server:1433/S1;TDS=7.0","user","pass");

CallableStatement stmt = conn.prepareCall("{ sp_ValidateUser(?)");
stmt.setString(1,"username");
ResultSet rs = stmt.executeQuery();
rs.next();
System.out.println("ID: " + rs.getString("custID"));


FAILS WITH THE FOLLOWING ERROR:


java.lang.NullPointerException
at com.internetcds.jdbc.tds.Tds.executeProcedure(Tds.java:2595)
at
com.internetcds.jdbc.tds.PreparedStatement_base.executeCall(PreparedStatement_base.java:199)

at
com.internetcds.jdbc.tds.CallableStatement_base.execute(CallableStatement_base.java:394)

at
com.internetcds.jdbc.tds.PreparedStatement_base.executeQuery(PreparedStatement_base.java:320)

at testee.main(testee.java:21)
Error: java.lang.NullPointerException


Any Help would be much appreciated.




Archive powered by MHonArc 2.6.24.

Top of Page