What is wrong??????

Can someone tell me why this code does not write my MS Access located on a webserver??  What is supposed to happen is.....when the user visits a web site he/she is to fill out this form, the info is then suppose to go to a MS Access database located on my web server.

Thanks in advance

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.sql.*;

public class FormRequest extends Applet {

      Button open;
      DisplayFrame f;

     * Initializes the applet.  You never need to call this directly; it is
     * called automatically by the system once the applet is created.
    public void init() {
      open = new Button("Open the Frame");
    public boolean action(Event e, Object o){
      if(e.target == open) {
          String s = "Reprint Request Form";
          f = new DisplayFrame(s);
          f.resize(300, 450);
      return true;
class DisplayFrame extends Frame{

      TextField reqName;
      TextField reqEmail;
      TextField reqICD;
      TextField reqMailAdd;
      TextField reqCountry;
      TextField reqCity;
      TextField reqState;
      TextField reqZip;
      TextField reqArticle;
      TextField reqJournal;
      Label lb1, lb2, lb3, lb4, lb5, lb6, lb7, lb8, lb9, lb10;
      Button submit, clear;
    public DisplayFrame(String s){
      submit = new Button("Submit Request");
      clear = new Button("Clear Form");
      setLayout(new FlowLayout(FlowLayout.LEFT));
          lb1 = new Label("Name:");
          reqName = new TextField(20);
          lb2 = new Label("Email Address:");
          reqEmail = new TextField(20);
          lb3 = new Label("Organization or Institution:");
          reqICD = new TextField(20);
          lb4 = new Label("Mailing Address:");
          reqMailAdd = new TextField(20);
          lb5 = new Label("Country:");
          reqCountry = new TextField(10);
          lb6 = new Label("City:");
          reqCity = new TextField(15);
          lb7 = new Label("State:");
          reqState = new TextField(5);
          lb8 = new Label("Zip Code:");
          reqZip = new TextField(9);
          lb9 = new Label("Title of Article you are requesting:");
          reqArticle = new TextField(30);
          lb10 = new Label("Journal Published in:");
          reqJournal= new TextField(30);
    public boolean action(Event evt, Object obj){
      if(evt.target == submit) {
      return true;
    return super.handleEvent(evt);

    public boolean handleEvent(Event e){
      if(e.id == Event.WINDOW_DESTROY){
      return true;
      return super.handleEvent(e);
     private synchronized void processRequest() {
      String stringName, stringEmail, stringICD, stringMailAdd, stringCountry, stringCity,
            stringState, stringZip, stringArticle, stringJournal;
      try {
          String url = "jdbc:odbc:RequestData";
          Connection con = DriverManager.getConnection(url, "", "");
          Statement stmt = con.createStatement();
          stringName = reqName.getText();
          stringEmail = reqEmail.getText();
          stringICD = reqICD.getText();
          stringMailAdd = reqMailAdd.getText();
          stringCountry = reqCountry.getText();
          stringCity = reqCity.getText();
          stringState = reqState.getText();
          stringZip = reqZip.getText();
          stringArticle = reqArticle.getText();
          stringJournal = reqJournal.getText();
          String updatestring = "INSERT INTO req_info(reqName, reqEmail, reqICD," +
                      "reqMailAdd, reqCountry, reqCity, reqState, reqZip, reqArticle, reqJournal)"
                          + "VALUES(" + stringName + ", '" + stringEmail + "', '" + stringICD +
                    "', '" + stringMailAdd + "', '" + stringCountry + "', '" + stringCity +
                    "', '" + stringState + "', '" + stringZip + "', '" + stringArticle +
                    "', '" + stringJournal + "')";
                          int ct = stmt.executeUpdate(updatestring);
                          catch(Exception e){}

     * Called to start the applet.  You never need to call this directly; it
     * is called when the applet's document is visited.
    public void start() {

     * Called to stop the applet.  This is called when the applet's document is
     * no longer on the screen.  It is guaranteed to be called before destroy()
     * is called.  You never need to call this method directly
    public void stop() {

     * Cleans up whatever resources are being held.  If the applet is active
     * it is stopped.
    public void destroy() {

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Where are you calling processRequest()?
For something as simple as that, you are taking too many pains. You are the best judge, by why 1.0? Here is a sample from 1.1. Work on these lines, you will benefit. (If you think I have given an unasked advice, you may give me a '0', but I'd not mind. I replied because I knew the solution. I am not in the rat race for points!)
 * This sample applet just selects 'Hello World' and the date from the database

// Import the JDBC classes
import java.sql.*;

// Import the java classes used in applets
import java.awt.*;
import java.io.*;
import java.util.*;

public class JdbcApplet extends java.applet.Applet
  // The driver to load
  static final String driver_class = "oracle.jdbc.driver.OracleDriver";

  // The connect string
  static final String connect_string =

  // This is the kind of string you woudl use if going through the
  // Oracle 8 connection manager which lets you run the database on a
  // different host than the Web Server.  See the on-line documentation
  // for more information.
  // static final String connect_string = "jdbc:oracle:thin:scott/tiger@(description=(address_list=(address=(protocol=tcp)(host=dlsun511)(port=1610))(address=(protocol=tcp)(host=pkrishna-pc2)(port=1521)))(source_route=yes)(connect_data=(sid=orcl)))";

  // The query we will execute
  static final String query = "select 'Hello JDBC: ' || sysdate from dual";

  // The button to push for executing the query
  Button execute_button;

  // The place where to dump the query result
  TextArea output;

  // The connection to the database
  Connection conn;

  // Create the User Interface
  public void init ()
    this.setLayout (new BorderLayout ());
    Panel p = new Panel ();
    p.setLayout (new FlowLayout (FlowLayout.LEFT));
    execute_button = new Button ("Hello JDBC");
    p.add (execute_button);
    this.add ("North", p);
    output = new TextArea (10, 60);
    this.add ("Center", output);

  // Do the work
  public boolean action (Event ev, Object arg)
    if (ev.target == execute_button)
      // Clear the output area
      output.setText (null);

      // See if we need to open the connection to the database
      if (conn == null)
        // Load the JDBC driver
        output.appendText ("Loading JDBC driver " + driver_class + "\n");
        Class.forName (driver_class);

        // Connect to the databse
        output.appendText ("Connecting to " + connect_string + "\n");
        conn = DriverManager.getConnection (connect_string);
        output.appendText ("Connected\n");

      // Create a statement
      Statement stmt = conn.createStatement ();

      // Execute the query
      output.appendText ("Executing query " + query + "\n");
      ResultSet rset = stmt.executeQuery (query);

      // Dump the result
      while (rset.next ())
        output.appendText (rset.getString (1) + "\n");

      // We're done
      output.appendText ("done.\n");
      catch (Exception e)
      // Oops
      output.appendText (e.getMessage () + "\n");
      return true;
      return false;

Maurice072297Author Commented:
I am not gathering any info from the database....What I am trying to accomplish is sending data to a MS Access database.  What you have give me is a very acceptable answer....however right now I am just trying to figure out why the code I have is not working properly.  Also I am new to JDBC, that is why I am use 1.0 instead of 1.1 (I am learning from the bottom up.)
You have your answer in my earlier reply. Read again closely. The rest of the code is an attempt to show you better methods.
"Where are you calling processRequest()?" means that you should be calling processRequest() somewhere for that action to occur.
So, in your code ...
if(evt.target == submit) {
                          return true;
you should make a call to processRequest().
if(evt.target == submit) {
                             processRequest(); // like this.
                          return true;
How else would you expect your insertion to take place?
From your coding I very well know that you are a learner.
Also, you will have to setup your database in (32-bit) ODBC driver in your Control Panel. Have you done that, or should I send you those details as well?
                                               Kaleem Aziz.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Become a CompTIA Certified Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Maurice072297Author Commented:
I forgot to resubmit my code....I did realize that I had forgotten the processRequest() statement, that I fixed.  But it still did not work.  Maybe the person who set up the ODBC info on the webserver did not set it up correctly.  If you don't mind could you send me the details

Maurice072297Author Commented:
By looking at the code though, it should work fine right??
From the code, everything appears to be right.
Though I know you are learning, I could see that you have posted the older code.
The details to setup your ODBC configuration are as simple as:
1. Go to Control Panel and execute ODBC icon.
2. In Windows NT, you'll see a card stack wit 'User DSN', 'System DSN', etc.
3. Select the 'System DSN' (since you'd want your applet to work even if you logged in as another user).
4. You must be having your database 'RequestData' with the necessary fields ready?
5. Click on 'Add...' button.
6. On the 'Create New Data Source', select Microsoft Access Driver (*.mdb) and click on 'Finish'.
7. On the 'ODBC Microsoft Access 97 Setup' dialog, click on 'Select' button. This opens a file dialog with title 'Select Database'.
8. Give the path of your database file (which by default will be in your personal folders).
9. Give the Data Source Name very carefully. This is the name that you should be using in your Java program. Since I see that you call your database 'RequestData', you should give it exactly like that here. Give the same as description, for the time being, though this is not necessary. Your database file may be any name, but the data source name must match one to one with your Java database name (i.e., RequestData).
10. Try similar things on Win95, since I don't have one right now.
11. Execute your program and it should work.


Maurice072297Author Commented:
Your help was greatly appreciated.  
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.