Trying to put a .mdb file on tomcat and access it. It worked locally, but after trying to deploy it to a local tomcat server it throws an exception. This is the line that is raising an error :
Connection dbConnection = DriverManager.getConnection("jdbc:ucanaccess://" + dbName);
Should I set up a DNS ? if so, how do I do it for a tomcat server?
Thanks !
EDIT : Exception :
SEVERE: Servlet.service() for servlet [spring-mvc] in context with path [/project] threw exception [Request processing failed; nested exception is net.ucanaccess.jdbc.UcanaccessSQLException: UCAExc:::3.0.5 given file does not exist: NZDB1.mdb] with root cause
java.io.FileNotFoundException: given file does not exist: NZDB1.mdb
at com.healthmarketscience.jackcess.impl.DatabaseImpl.open(DatabaseImpl.java:365)
at com.healthmarketscience.jackcess.DatabaseBuilder.open(DatabaseBuilder.java:252)
at net.ucanaccess.jdbc.DefaultJackcessOpener.open(DefaultJackcessOpener.java:35)
at net.ucanaccess.jdbc.DBReference.<init>(DBReference.java:160)
at net.ucanaccess.jdbc.DBReferenceSingleton.loadReference(DBReferenceSingleton.java:51)
at net.ucanaccess.jdbc.UcanaccessDriver.connect(UcanaccessDriver.java:99)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at DAL.DbHandler.<init>(DbHandler.java:22)
Tried to put the file in all kind of different locations, next to WEB-INF, inside it etc.
If the database file is in the WEB-INF folder for the project then you should be able to use
"jdbc:ucanaccess://" + application.getRealPath("WEB-INF/" + dbName)
as the connection URL that you pass to getConnection
.