Skip to Content.
Sympa Menu

freetds - Not able to connect to SQL Server

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Yasser Dabhoiwala" <yasser_dabhoiwala AT yahoo.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Not able to connect to SQL Server
  • Date: Tue, 31 Jul 2001 02:40:02 -0400


Hello

I am trying to connect to SQL Server with the freetds_jdbc driver. But I
am getting the error :

Exception- java.lang.NullPointerException
Exception in thread "main" 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(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at SQLCon.main(SQLCon.java:9)

The following is the source code :

/***********************************************************************/
import java.sql.*;

public class SQLCon
{
public static void main(String[] args) throws Exception
{
Class.forName("com.internetcds.jdbc.tds.Driver"); //freetds_jdbc driver
Connection con =
DriverManager.getConnection("jdbc:freetds:sqlserver://dbsvr:1433/ALGO","yasser","yasser");
/ * where dbsvr is the server name, ALGO is the database name and yasser,
yasser is username and password. */
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("select * from d_sales"); //d_sales is
table name
while(rs.next()){
System.out.println(rs.getString(1));
}
rs.close();
st.close();
con.close();
}
}

/***********************************************************************/

I have set the freetds_jdbc.jar in the classpath.

Please review the code and suggest where I am making the request.

Waiting for reply.

Best Regards
Yasser



  • Not able to connect to SQL Server, Yasser Dabhoiwala, 07/31/2001

Archive powered by MHonArc 2.6.24.

Top of Page