Jython & Mysql - what is the current practice for connection? -


Just trying for the first time, because something came on the job that was right for it. I think mythsql can make a jdbc connection using mythsql jdbc driver. Googling and after reading, though I'm having trouble and it seems Jyothan-specific and perhaps simple. So I do Jyothon:

  Geothan 2.5.1 (Release_2_5_1: 6813, September 26, 13:47:54) [Java Hotspot (TM) 64-bit server VM (Apple Inc.)] For more information on Java1.6.0_17, type "help", "copyright", "credit" or "license". & Gt; & Gt; & Gt; Import systems and gt; & Gt; & Gt; Print sys.path [ ',' /JYTHONPATH/mysql-connector-java-5.1.10-bin.jar ',' /WorkArea/Apps/jython/jython2.5.1/Lib ',' __classpath__ ',' __pyclasspath __ / ' , '/WorkArea/Apps/jython/jython2.5.1/Lib/site-packages'] & gt; & Gt; & Gt; Java.sql to java.lang import *,  

I'm running the code

  "JDBC: mysql: // local host / test user = jgreenaw & password =" import * drivername = "com.mysql.jdbc.Driver" Class.forName (drivername) url = thief = DriverManager.getConnection (URL) Stmt = thief .createStatement ()  

Output

  riux: Desktop $ jython pymysql Py traceback (most recent call final): file "pymysql.py", line 7, & lt; Module & gt; Class.forName (drivername) java.security.AccessController.doPrivileged (Native Method on java.net.URLClassLoader $ 1.run (URLClassLoader.java:200)) java.net.URLClassLoader.findClass (URLClassLoader.java:188) on Java.lang.ClassLoader.loadClass (ClassLoader.java:315) on sun.misc.Launcher $ AppClassLoader.loadClass (Launcher.java:330) on java.lang.ClassLoader.loadClass (ClassLoader.javaociety50) on java.lang Classloader on Java.lang.Class.forName0 (Native Method) Load Class Inarl (Clasloderkjawa 398) sun.ref.nl.eng.lang.Class.forName (class.java:169) on SunkreflectkNativeMethodAccessorImplkinvoke0 (Basic Law) SunkreflectkNativeMethodAccessorImplkinvoke ( NativeMethodAccessorImpl.java:39) .ClassNotFoundException on java.lang on sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) java.lang.reflect.Method.invoke (Method.java:597): java.lang.ClassNotFoundException : com. Mysql.jdbc.Driver  

Any advice?

Thank you

Do you have the right to read this? Try opening it in your code as a file Also check if this file is valid jar collection containing com / mysql / JDBC / Driver.class .

I can do this when I use PostgreSQL on Windows to check with:

  import zipfile def test_jar (jar_file, CLASS_NAME): zf = zipfile.zipfile (Jar_file, 'r') cn = class_name.replace ('.', '/') + '.class' zi = zf.getinfo (cn) Print ('% s:% s [b] - & gt;% c [B]% (Zikfilenme, Zikfail_saij, Zikkanpres_saij)) Test_jar ( 'a: /jars/postgreskl-8k3-603kjbk4kjar' Orgkpostgresklkdraivr ')  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -