Tags: access, connection, connectivity, create, database, dateabse, java, jdbc, netbeans, tables

Netbeans and MS Access

On Java Studio » Java Database Connectivity (JDBC)

1,496 words with 1 Comments; publish: Wed, 16 Jul 2008 19:19:00 GMT; (15093.75, « »)

I could not find much help on how to create dateabse connection with netbeans.

I am trying to access tables in MS Access using the netbeans. Can anyone help?

I tried to add the driver from

Runtime-database-drivers-(JDBC-ODBC-DRIVER)-Connect Using

Name : JDBC-ODBC-BRIDGE

Database URL : jdbc dbc:<DB>

the DB part i put in d:/java/db4.mdb- the path where my database file is

But i could not make a connection

When i run the code below using a command prompt There is no problem

code:
 Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

System.out.println("Starting DB");

String filename = "d:/java/db4.mdb";

String database = "jdbc dbc river={Microsoft Access Driver (*.mdb)};DBQ=";

database+= filename.trim() + ";DriverID=22;READONLY=true}";

con = DriverManager.getConnection(database, "","");

Statement st = con.createStatement();


All Comments

Leave a comment...

  • 1 Comments
    • Java will connect as its loading a file via JDBC have you added a ODBC connection from the control panel in administrative tools?

      As once you have done that Netbeans will be able to find it.

      check here http://wiki.netbeans.org/AccessMssql google is your friend

      #1; Wed, 16 Jul 2008 19:20:00 GMT