I have to define a new Driver in the Netbeans "Services" Tab
Services->Databases->Drivers->new Driver...
because I want use the "Entity Classes from Database"-Wizard in context with UCanAccess.
1st step: "new Driver" does work (only declaration ;-) )
2nd step: "Connect using..."
The "Test Connection"-Button results in Error Message:
Cannot establish a connection to jdbc:ucanaccess://F:\WorkspaceNetbeans\MSAccessDB\data\Datenbank2.accdb using
net.ucanaccess.jdbc.UcanaccessDriver (Could not initialize class
net.ucanaccess.jdbc.UcanaccessDriver)
I've got the newest ucanaccess from http://ucanaccess.sourceforge.net/site.html ucanaccess-2.0.4.jar, commons-lang-2.6.jar, commons-logging-1.0.4.jar, hsqldb.jar, jackcess-2.0.3.jar in the Netbeans Classpath.
The old fashion way to connect via jdbc to ucanaccess works fine.
public static void main(String[] args) throws ClassNotFoundException, SQLException {
String connectString = "jdbc:ucanaccess://" + "f:/WorkspaceNetbeans/MSAccessDB/data/Datenbank2.accdb";
Class.forName("net.ucanaccess.jdbc.UcanaccessDriver");
Connection conn = DriverManager.getConnection(connectString, "", "");
conn.createStatement().execute("CREATE TABLE example1 (id COUNTER PRIMARY KEY,descr text(400), number numeric(12,3), date0 datetime) ");
}
The same connection string also works fine make DBeaver able to connect to the MSAccess db.
My set up:
Windows 7 Professional 64 bit
Microsoft Office 2013
NetBeans IDE 8.0
Java 1.8
The problem is similar to: "Conflict between JT400 and UCanAccess?" Conflict between JT400 and UCanAccess?
but the answers there don't help with my problem.
Any ideas to solve my problem?
UCanAccess 2.0.4.1 has been released, now you can configure UCanAccess as NetBeans service. As explained in the UCanAccess web site (tab 'jdbc client tools') you have to:
-in the field Driver File(s), add ucanaccess.jar and all dependencies. I've upgraded the commons-logging in the UCanAccess distribution to the 1.1.1, so you can use that jar with NetBeans8.
-use the following pattern for the jdbc url: jdbc:ucanaccess://;showschema=true Showschema connection property must be setted to true.