Skip to Content.
Sympa Menu

freetds - Need help!!!

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Ted Munnich" <tmunnich AT idexsoft.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Need help!!!
  • Date: Thu, 16 Aug 2001 16:25:15 -0400


I am a newbie and have trouble to make Freetds work on my system. I can
run regular JSP and java code on my system.

I have installed freetds 0.51 on my FreeBSD system with Resin 1.2.8 as a
appserver and Apache 1.3.20 as the webserver. My MS SQL 7.0 is on a
Windows 2000 server system. I also installed the jar file is in the
CLASSPATH.

Internal network setup:
FreeBSD 192.168.1.1
SQL server 192.168.1.2:1433 (can be pinged from the Unix system)


Can anyone help me by telling me what I am doing wrong. Thank you in
advance.

I am getting the following error message:

500 Servlet Exception
java.lang.ClassCastException: test.jdbctds
at
com.caucho.server.http.Application.createServlet(Application.java:1739)
at
com.caucho.server.http.Application.loadServlet(Application.java:1705)
at com.caucho.server.http.Invocation.service(Invocation.java:263)
at
com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:121)
at
com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:333)
at
com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:266)

at com.caucho.server.TcpConnection.run(TcpConnection.java:140)
at java.lang.Thread.run(Thread.java)

I have been trying to make the example that is on the website to work but
sofar without luck. I did have to modify it a little. Here is the code I
am trying to run:

// filename: jdbctds.java
package test;
import java.sql.*;

public class jdbctds
{
static void ftdsjdbc () {
try {
String url
= "jdbc:freetds:sqlserver://192.168.1.2:1433/master;TDS=7.0";
String login = "sa";
String password = "";

Class.forName("com.internetcds.jdbc.tds.Driver");

//open a connection to the database
Connection connection
= DriverManager.getConnection(url, login, password);
//to get the driver version
DatabaseMetaData conMD = connection.getMetaData();
System.out.println("Driver Name:\t" + conMD.getDriverName());
System.out.println("Driver Version:\t" + conMD.getDriverVersion());
//create a statement
Statement st = connection.createStatement();

//execute a query
ResultSet rs
= st.executeQuery("SELECT * FROM master.dbo.sysprocesses");

// read the data and put it to the console
while (rs.next()) {
for (int j = 1; j <= rs.getMetaData().getColumnCount(); j++) {
System.out.print(rs.getObject(j) + "\t");
}

System.out.println();
}

//close the objects
st.close();
connection.close();
}
catch (Exception e) {
e.printStackTrace();
}
}
}




Archive powered by MHonArc 2.6.24.

Top of Page