Mac Forums

Mac Forums (http://www.mac-forums.com/forums/)
-   OS X - Development and Darwin (http://www.mac-forums.com/forums/os-x-development-darwin/)
-   -   Java project not connecting to Access database on my W7 bootcamp. (http://www.mac-forums.com/forums/os-x-development-darwin/269967-java-project-not-connecting-access-database-my-w7-bootcamp.html)

insinkerator 03-18-2012 04:06 PM

Java project not connecting to Access database on my W7 bootcamp.
 
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?


All times are GMT -4. The time now is 07:01 PM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.