HELPP!! JAVA Access Database Connection

Hi recently been working on a school project. But i reinstalled my OS and now my Database wont connect to JAVA using the ODBC connection
Here is the code:

String filename = "BandB.mdb";

String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
database += filename.trim () + ";DriverID=22;READONLY=true}";
conn = DriverManager.getConnection (database, "", "");

System.out.println ("Connection to BandB database successfully established");

catch (Exception e)
System.out.println ("Unable to connect to the database " + e);
} //end connect

It works on my home pc but it wont run on my laptop. Also no other similar program will run on it. I reinstalled to SP1 and that is when the problem started. It gives me this error:

Driver successfully loaded
Unable to connect to the database java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Is there something wrong with my OS or is this my Compiler problem. I am using Netbeans 2.7.1
1 answer Last reply
More about helpp java access database connection
  1. Sorry Netbeans 7.2.1
Ask a new question

Read More

Programming Connection Java Database Apps