Using UCanAccess with Lucee 5


I have an unfortunate need to use an Access DB with Lucee as a once off. I have followed through others posts in the forums to get the UCanAccess driver installed on Lucee 5. I am able to get the Lucee administrator to add a datasource, having set the appropriate UCANACCESS_HOME environment variable, however once added, any atttempt to use the datasource results in a NPE within Lucee’s

I am wondering if this has anything to do with just adding the UCanAccess JARs to the lucee/lib folder rather than using an OSGI packaged bundle. Can anyone advise if JARS for JDBC drivers can just be added to the lucee/lib folder or if something special needs to be done for this.

Has anyone successfully got UCanAccess running with Lucee 5, and do you have any war stories to share?


Exception after adding the datasource or attempting to use the datasource in a query

Stacktrace	The Error Occurred in
/admin/services.datasource.list.cfm: line 142 
called from /admin/services.datasource.cfm: line 82 
called from /admin/web.cfm: line 399
Java Stacktrace	lucee.runtime.exp.NativeException: java.lang.NullPointerException
 	at lucee.runtime.db.DCStack.openConnectionsIn(
 	at lucee.runtime.db.DCStack.openConnections(
 	at lucee.runtime.db.DatasourceConnectionPool.openConnections(
 	at lucee.runtime.db.DatasourceConnectionPool.openConnections(
 	at lucee.runtime.tag.Admin.doGetDatasources(
 	at lucee.runtime.tag.Admin._doStartTag(
 	at lucee.runtime.tag.Admin.doStartTag(
 	at services_datasource_list_cfm1334$

The datasource is created successfully in lucee-web.xml.cfm, but once added I have to manually remove the entry and restart to be able to use the Lucee administrator datasource page due to the above stack trace.

<data-source allow="511" blob="false" class="net.ucanaccess.jdbc.UcanaccessDriver" clob="false" connectionLimit="1" connectionTimeout="1" custom="" database="mydb" dbdriver="Other" dsn="jdbc:ucanaccess:/Users/phil/dev/ucanaccess/database/mydb.mdb" host="" metaCacheTimeout="60000" name="mydb" param-delimiter="&amp;" param-leading-delimiter="?" param-separator="=" password="" port="-1" storage="false" username="" validate="false"/>


It should work, but not in lucee/lib. Just drop it anywhere in your classpath, for example, if you use Tomcat then {tomcat}/lib should work.

IIRC then @joe.gooch mentioned something about it in the past.


Slight face palm moment, having found that I had incorrect specified the JDBC Connection String which results in the UCanAccess driver not instantiating properly. Lucee does not handle this case and results in the flow on error that i received.

Have raised to guard against this