Java project not connecting to Access database on my W7 bootcamp.

Joined
Jul 22, 2008
Messages
59
Reaction score
0
Points
6
I have a Java project that reads and writes to a database for college, it's programmed in jGrasp, and it connects to a MS access database. It works on our W7 computers in college, but when I try to execute the same code on my Windows partition I get this error:

SQL Exception: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key Temporary (volatile) Ace DSN for process 0xc94 Thread 0xbac DBC 0x71b800

For what it's worth, this is the connection code:


Code:
try {		 //try catch block for accessing database
                     
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               String url = "jdbc:odbc:Driver={Microsoft Access Driver " +
                  					  "(*.mdb, *.accdb)};DBQ=C:\\Users\\Killian\\Desktop\\Java Project 2";
               Connection con = DriverManager.getConnection(url);         
               Statement stmt = null;
               ResultSet rs = null;       
            	// SQL query command
               String SQL = "SELECT * FROM tblEmployee";
               stmt = con.createStatement();
               rs = stmt.executeQuery(SQL);
               while (rs.next()) {
                  username = (rs.getString("Username")); //assigns username value from table
                  password = (rs.getString("Password")); //assigns password value from table
               }
               con.close();  		
           		} 
               catch (SQLException e) 
               {
                  System.out.println("SQL Exception: "+ e.toString());
               } 
               catch (ClassNotFoundException cE) {
                  System.out.println("Class Not Found Exception: "+
                     cE.toString());
               }

Any ideas?
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top