W3C home > Mailing lists > Public > www-jigsaw@w3.org > May to June 1997

JIgsaw, WinNT, JDBC, Access Problems

From: John Liddle <johnl@icbl.hw.ac.uk>
Date: Thu, 5 Jun 1997 08:54:21 +0100 (BST)
To: www-jigsaw@w3.org
Message-Id: <Pine.SUN.3.95.970605082659.6734B-100000@ithaca>

I had written a small piece of code which let me query a MS Access
database from a form written in html. Jigsaw was running on a Win95 and
everything worked fine. I then set up Jigsaw on WinNT4.0 and got some very
strange results.The server runs for anything up to 10 hits before it exits
cleanly (no error message generated). The 'bones' of the code are
shown below. In both cases I used jdk1.1.1. Has anyone else experienced
problems with WinNT. 

package w3c.jigsaw.dbase.require;

import w3c.www.http.*;
import w3c.jigsaw.http.*;
import w3c.jigsaw.resources.*;
import w3c.jigsaw.html.*;
import w3c.jigsaw.forms.*;
import w3c.tools.store.*;
import java.net.URL;
import java.sql.*;

public class Req extends PostableResource {
  
  public static final String URL = "jdbc:odbc:requirement";
  public static final String DRIVER_NAME = "sun.jdbc.odbc.JdbcOdbcDriver";
  public static final String USER = "my-user";
  public static final String PASSWD = "my-passwd";
 
  static {
    Class c = null;
    try {
      c = Class.forName("w3c.jigsaw.dbase.require.Req");
     } 
    catch (Exception ex) {
      ex.printStackTrace();
      System.exit(1);
    }
  }

   /**
     * Handle a post request.
     * @return An HTTP Reply instance.
     */

    public Reply handle(Request request, URLDecoder data) {
      
     // Code for getting form input removed
     // String query select_query formed from this i/p
     try {
	// Load the jdbc-odbc bridge driver
	Class.forName (DRIVER_NAME);
	Connection con = DriverManager.getConnection (URL, USER, PASSWD);
	Statement stmt = con.createStatement ();
	ResultSet rs = stmt.executeQuery (select_query);
	dispResultSet (rs); // parses result set
	rs.close();
	stmt.close();
	con.close();
      }
      catch (SQLException ex) {
	System.out.println ("\n*** SQLException caught ***\n");
	while (ex != null) {
         // print out details
	}
      }
      catch (java.lang.Exception ex) {ex.printStackTrace ();}
    }
     Reply reply = request.makeReply(HTTP.OK);
     reply.setStream(g); // g is HtmlGenerator
     return reply;
    }
}





 
                                ~ ~
                                o o 
 ___________________________ooO_(_)_Ooo___________________________________
 |__ John Liddle ____|____|____|____|__ email:johnl@icbl.hw.ac.uk |____|__|
 |__ Learning Technology Centre |___|_  http://www.icbl.hw.ac.uk/~johnl __|  
 |__ Heriot-Watt University  |____|___  phone 0131 451 3281      _|____|__| 
 |____|____|____|____|____|____|____|____|____|____|____|____|____|____|__| 
 
Received on Thursday, 5 June 1997 03:53:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 9 April 2012 12:13:26 GMT