Accessing database from java through JCreator compared to Ready to program
<p>I am opening the same code in "Jcreator" and in "Ready to Program". It runs fine in Ready but not JCreator. The Point of interest is the accessing of a database. I must hand in the project with the database and can thus not configure the ODBC driver through the administrator and would like all to happen in the code. It works through ready but not Jcreator.</p>

<p>Here is an extract of the code and an extract of the error in Jcreator.</p>

<pre><code>import java.sql.*;
import javax.swing.*;
import java.io.*;
import java.text.ParseException;
public class Leerder_In_Sno //kyk of die SAGA nommer reeds bestaan
{
    static Connection conn;
    private int sn;
    private int records;   //Verklaar veranderlikes
    private int gevind = 0;


    public Leerder_In_Sno (int s_o) //konstrakter. Ontavang SAGA nommer van die Leerder_In_Gui klas
    {
    sn = s_o;  
    }


    public int Soek_Sno () throws Exception 
    {
    try
    {
        Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver"); //Kry konneksie met JdbcOdbcDriver drywer

    }


    catch (ClassNotFoundException e)
    {
        System.out.println ("Unable to load database driver."); //Wanner daar nie konneksie verkry word nie

    }

    try
    {
        String fullConnectionString = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + "Gholf.mdb";
        conn = DriverManager.getConnection (fullConnectionString); //Kry konneksie met databasis
    System.out.println ("Hier1");
    }


    catch (SQLException s)
    {
        System.out.println ("Unable to connect to database."); //Kry konneksie met databasis
    }


    Statement stmt = conn.createStatement (); // nuwe stmt Statemen

    //Maak 'n sring om binne die stmt te hardloop
    String sql = "SELECT * FROM Leerder_inligting"; //Selekteer alles van die  Leerder_inligting 
    ResultSet rs = stmt.executeQuery (sql); //Hardloop die  sql string binne die stmt Statemen 


    while (rs.next ()) //Blaai deur al die rekords
    {
        //records = records++;
        System.out.println ("Hier2");
        int S_D = rs.getInt ("SAGA_no"); //Kry die SAGA nommer in die data basis vir elke lyn

        if (S_D == sn) //As die 2 SAGA nommers dieselfde is 

        {
            gevind = 1; 

        }
    }
    conn.close ();
    return gevind;//As die SAGA nommer daar was is dit 'n 1 anders 'n 0

    }
}
</code></pre>

<p>Unable to connect to database.</p>

<p>Hope some one can give me advice. </p>
