Skip to Content.
Sympa Menu

freetds - Re: Need help!!!

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Jim Urban" <jim.urban AT netsteps.net>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Need help!!!
  • Date: Thu, 16 Aug 2001 17:27:34 -0500


Ted,

Where do you have the FreeTDS jar file? It should be in your servlet
context /WEB-INF/lib directory. If that is where it is and your serlvet
can't load it, try moving it to your TOMCAT_HOME/lib directory, then restart
Tomcat.

Jim

-----Original Message-----
From: bounce-freetds-134788 AT franklin.oit.unc.edu
[mailto:bounce-freetds-134788 AT franklin.oit.unc.edu]On Behalf Of Ted
Munnich
Sent: Thursday, August 16, 2001 4:49 PM
To: TDS Development Group
Subject: [freetds] Re: Need help!!!


Curt, thank you for your quick response. I also tried the following code,
which gives me the same error message.

// filename sqltest.java
package test;
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class sqltest extends HttpServlet
{
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
Connection con = null;
Statement st = null;
ResultSet rs = null;

res.setContentType("text/html");
PrintWriter out = res.getWriter();

try
{
String sUrl =
"jdbc:freetds:sqlserver://192.168.1.2:1433/Northwind";
String sLogin = "sa";
String sPassword = "";
String sQuery = "select * from employees";

Class.forName("com.internetcds.jdbc.tds.Driver");
Connection con =
DriverManager.getConnection(sUrl, sLogin, sPassword);

st = con.createStatement();
rs = st.executeQuery(sQuery);

out.println("<html><head><title>SQL Test</title></head>");
out.println("<body>");
out.println("<ul>");

while(rs.next())
{
out.println("<li>" + rs.getString("lastname"));
}

out.println("/ul>");
out.println("
---<BR>
You are currently subscribed to freetds as: [jim.urban AT netsteps.net]<BR>
To unsubscribe, forward this message to
$subst('Email.Unsub')
</BODY></html>");
}
catch (ClassNotFoundException e)
{
out.println("Could not load database driver: " + e.getMessage());
}
catch (SQLException e)
{
out.println("SQLException caught: " + e.getMessage());
}
finally
{
try
{
if (con != null) con.close();
}
catch (SQLException ignored)
{
}
}
}
}






Archive powered by MHonArc 2.6.24.

Top of Page