Do you need to do a Class.forName("org.h2.Driver") first to actually load the class? I dunno how that translates to Jython.


On 18/09/2012 4:16 PM, Pranav Prakash wrote:
I am trying to get h2 working with Jython, here is what I am trying

    import sys
    import os

    curr_dir = os.getcwd()
    jar_dir_path = os.path.join(curr_dir, 'jars')

    # Add jars to classpath
    jars = [f for f in os.listdir(jar_dir_path) if
        os.path.isfile(os.path.join(jar_dir_path, f)) and
    f.endswith('jar')]
    for jar in jars:
      sys.path.append(os.path.join(jar_dir_path,jar))

    from com.ziclix.python.sql import zxJDBC
    from java.lang import Class
    import org.h2.Driver

    jdbc_url = "jdbc:h2:~/test"
    username = "sa"
    password = ""
    driver = "org.h2.Driver"

    conn = zxJDBC.connect(jdbc_url, username, password, driver)
    conn.close()


However, upon executing I keep seeing the error

    *zxJDBC.DatabaseError: driver [**org.h2.Driver**] not found*


I am sure that the import is not going wrong, because else the import statement fails. The jar I am using is h2-1.3.168.jar
--
You received this message because you are subscribed to the Google Groups "H2 Database" group. To view this discussion on the web visit https://groups.google.com/d/msg/h2-database/-/bsM4gfUSDjMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.

--
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to