2

I'm using NetBeans IDE 8.2 and would like to make a connection with UCanAccess to access my database files. Initially I was using jdbc:odbc but I found that Java 8 onward no longer supports this method

Here is my initial coding :

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection("jdbc:odbc:vABCD");

Here is the code after the changes :

 Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
con = DriverManager.getConnection ("jdbc:ucanaccess://C:\\Users\\questionasker\\Desktop\\database");

but I get the error :

net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::4.0.2 C:\Users\questionasker\Desktop\database (Access is denied)
at net.ucanaccess.jdbc.UcanaccessDriver.connect(UcanaccessDriver.java:264)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at vhrmsrptgen.AnnualAppraisal.connect(AnnualAppraisal.java:41)
at vhrmsrptgen.AnnualAppraisal.generate(AnnualAppraisal.java:90)
at vhrmsrptgen.MainFrame.btnGenerate_actionPerformed(MainFrame.java:368)
at vhrmsrptgen.MainFrame_btnGenerate_actionAdapter.actionPerformed(MainFrame.java:583)

My database files are all in .DBF format (which are very old files) and all files are under this directory :

C:\\Users\\questionasker\\Desktop\\database

What can I do in order to make the coding correct to connect the database?

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418

1 Answers1

3

My database file all is in .DBF format

UCanAccess is not a general-purpose replacement for the JDBC-ODBC Bridge. It is a JDBC driver specifically for working with Microsoft Access database files (.mdb, .accdb, and related variants). It is not designed to work with .dbf (dBASE) files.

Gord Thompson
  • 116,920
  • 32
  • 215
  • 418