OS: Windows7, Jython2.7.0FR ("Final Release")
Trying to use Gord Thompson's solution with Jython: Manipulating an Access database from Java without ODBC
I can get the Ucanaccess module to work in Eclipse, but not when I try running from the CLI.
# -*- coding: utf-8 -*-
import java, sys
jars_dir = 'D:\\sysadmin\\Resources\\Java jar files\\'
sys.path.append( jars_dir + 'commons-lang-2.6.jar' )
sys.path.append( jars_dir + 'commons-logging-1.2.jar' )
sys.path.append( jars_dir + 'hsqldb.jar' )
sys.path.append( jars_dir + 'jackcess-2.1.2.jar' )
sys.path.append( jars_dir + 'ucanaccess-3.0.2.jar' )
import net.ucanaccess.jdbc.UcanaccessDriver
import net.ucanaccess
print( '# appear to have imported UcanaccessDriver' )
conn = java.sql.DriverManager.getConnection( 'jdbc:ucanaccess://D:/TESTING.mdb' )
print( '# conn OK...')
This prints out "# conn OK" when I run this in Eclipse. When I run it from the CLI it prints out "# appear to have imported..." but then an error is thrown:
(NB this output was copied to Eclipse: it is indeed a CLI run)
Anyone got any idea why I might be getting "No suitable driver..."? NB I tried various permutations with backward slashes instead of forward ones in getConnection... to no avail.
By the way, in case this is relevant, this is an extract from the .bat file I'm using to run the thing:
cd "%SOFTWARE_PROJECTS%\workspace\Jython scratchpad\src\jython_scratchpad_root"
REM this is probably irrelevant and doesn't seem to work with Jython2.7.0FR. The jars are being loaded by sys.path.append, obviously
set CLASSPATH=.;"%SYSADMIN%\resources\java jar files/*"
D:\apps\jython2.7.0\bin\jython loading_test.py