domifa621 0 Newbie Poster

I have been fighting this but I am not winning. So far I have looked up a ODBC JDBC connection string to connect to my simple database to java without any success.
Firstly; I replaced 32bit MS Access 2010 with 64x one.

Secondly; I installed all available updates sp1 and runtime sp1. My netbeans is 7.0.1 and is 64x.
I imported these two items to enable connectivity
import java.sql.*;
import javax.swing.DefaultListModel;

finally;
I have been getting this error!
[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0xf48 Thread 0x11d4 DBC 0x7868008 Jet'.
I searched at Support for Microsoft Access but with no aveil. All I need to achieve is to populate the list box with data from the MS Access 2010 database.

I NEED HELP!!

private void btn_Enquire_theDatabase_MouseClicked(java.awt.event.MouseEvent evt) {                                                      
        // TODO add your handling code here:
        DefaultListModel lm = new DefaultListModel();
        
       final String fileName = "C:/testtable.accdb";
       Connection con = null;
        try {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ="+fileName;
            con = DriverManager.getConnection(url,"","");                    
            Statement s = con.createStatement();
            String thestatement;
            thestatement = "select numbers from testtable";
            s.execute(thestatement);
            ResultSet rs = s.getResultSet();
            int sum = 0;
            if(rs != null)
            while(rs.next())
            {
                lm.addElement(rs.getString(1));
            }
            thesum.setText(String.valueOf(sum));
            s.close();
            //con.close();
            thelist.setModel(lm);
        } 
        catch (Exception e)
        {
           System.out.println("error! error! error! ON LOAD " + e.getMessage());
           //tf_error.setText(e.getMessage());
        }
        finally {
            try { if(con!=null) {con.close();} } 
            catch (Exception e) 
            {
             tf_error.setText(e.getMessage());
            }
        }
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.