From: Brandon P. <bp...@gm...> - 2010-11-03 21:11:58
|
On Wed, Nov 3, 2010 at 3:01 PM, Roland Walter <r_w...@us...> wrote: > Hello, > > usually you must set the classpath before calling the jython > interpreter. AFAIK you cannot use the mechanism of python to set access > to JARs or java classes at runtime. > Actually, adding files to sys.path at runtime does work. I do it all the time for a few things. I am not sure if I was seeing things but when I was first doing this it seemed like jython was not properly adding the jars to the classpath if it had cached the jar during a previous run, so I added in a os.utime(jar_file, None) to update the timestamp to force the jython package manager to reload the changed jar....you may want to try this, though I cant seem to reproduce this situation at the moment... -Brandon > Regards, > Roland. > > Am 03.11.2010 21:52, schrieb Michael March: >> Using Jython 2.5.0 or 2.5.2RC2 and JDK 1.6.0_16 (WINDOWS 2008) >> >> import sys >> sys.path.append("mysql-connector-java-5.0.8-bin.jar") >> print sys.path >> from com.ziclix.python.sql import zxJDBC >> >> connection2 = >> zxJDBC.connect('jdbc:mysql://127.0.0.1/auditrepository?stringtype=unspecified >> <http://127.0.0.1/auditrepository?stringtype=unspecified>', 'root', >> 'FOO', 'com.mysql.jdbc.Driver') >> >> Yields this output: >> >> C:\jythonjunk>jython dbtest.py >> ['C:\\jythonjunk', 'C:\\jython2.5.2rc2\\Lib', '__classpath__', >> '__pyclasspath__/ >> ', 'C:\\jython2.5.2rc2\\Lib\\site-packages', >> 'mysql-connector-java-5.0.8-bin.jar >> '] >> Traceback (most recent call last): >> File "dbtest.py", line 6, in <module> >> connection2 = >> zxJDBC.connect('jdbc:mysql://127.0.0.1/auditrepository?stringt >> <http://127.0.0.1/auditrepository?stringt> >> ype=unspecified', 'root', 'FOO', 'com.mysql.jdbc.Driver') >> zxJDBC.DatabaseError: driver [com.mysql.jdbc.Driver] not found >> >> I've read use the '--verify' option but that doesn't seem to work. >> >> thanks! >> >> >> >> ------------------------------------------------------------------------------ >> Achieve Improved Network Security with IP and DNS Reputation. >> Defend against bad network traffic, including botnets, malware, >> phishing sites, and compromised hosts - saving your company time, >> money, and embarrassment. Learn More! >> http://p.sf.net/sfu/hpdev2dev-nov >> >> >> >> _______________________________________________ >> Jython-users mailing list >> Jyt...@li... >> https://lists.sourceforge.net/lists/listinfo/jython-users > > > ------------------------------------------------------------------------------ > Achieve Improved Network Security with IP and DNS Reputation. > Defend against bad network traffic, including botnets, malware, > phishing sites, and compromised hosts - saving your company time, > money, and embarrassment. Learn More! > http://p.sf.net/sfu/hpdev2dev-nov > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |