freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Problems with servlets and FreeTDS-JDBC since using JDK1.1.8
- From: Andreas Tille <tillea AT rki.de>
- To: FreeTDS mailing liste <freetds AT franklin.oit.unc.edu>
- Subject: Problems with servlets and FreeTDS-JDBC since using JDK1.1.8
- Date: Mon, 20 Mar 2000 16:32:22 +0100 (CET)
Hello,
since I upgrade to JDK 1.1.8 (from Debian GNU/Linux potato) I
have problems with my servlets which use FreeTDS JDBC to access
a MS SQL 7.0 server.
I appended an example.
The result is a page just containing item "1". There are no
explizite errors. It just dies.
I'm really clueless and hope that anybody could help.
It's the same with the latest JDBC-Snapshot and the one before (which
I used a long time successfully).
Kind regards
Andreas.
import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; /** * This is a simple example of an HTTP Servlet. It responds to the GET * and HEAD methods of the HTTP protocol. */ public class Hallo extends HttpServlet implements SingleThreadModel { Connection con; ResultSet rs; Statement stmt; ServletOutputStream out; public void init(ServletConfig conf) throws ServletException { super.init(conf); try { Class.forName("com.internetcds.jdbc.tds.Driver"); // Class.forName("com.internetcds.jdbc.tds.SybaseDriver"); } catch (ClassNotFoundException e) { System.err.println("CNF: " + e.getMessage()); return; } String url = "jdbc:freetds:sqlserver://sql03/Test"; String user = "TestUser" ; String password = "test"; try { con = DriverManager.getConnection(url, user, password); } catch (SQLException se) { System.err.println("SQL: " + se.getMessage()); return; } } /** * Handle the GET and HEAD methods by building a simple web page. * HEAD is just like GET, except that the server returns only the * headers (including content length) not the body we write. */ public void service (HttpServletRequest request, HttpServletResponse res) throws ServletException, IOException { // PrintWriter out; String title = "Example Apache JServ Servlet", query; res.setContentType("text/html"); out = res.getOutputStream(); out.println("<HTML><HEAD><TITLE>"); out.println(title); out.println("</TITLE></HEAD><BODY bgcolor=\"#FFFFFF\">"); out.println("<H1>" + title + "</H1>"); try { out.println("1<br>"); rs = stmt.executeQuery("SELECT * FROM Mitarbeiter"); out.println("2<br>"); if ( !rs.next() ) { out.println("3<br>"); System.err.println("Fehler 4"); return ; } out.println("4<br>"); query = rs.getString("FName"); out.println("5<br>"); out.println(query); out.println("6<br>"); } catch (SQLException se) { out.println("SQL: " + se.getMessage()); return; } out.println("<H2>Gratulation<br>"); out.println("</BODY></HTML>"); out.close(); } }
- Problems with servlets and FreeTDS-JDBC since using JDK1.1.8, Andreas Tille, 03/20/2000
Archive powered by MHonArc 2.6.24.