JDBC driver not found error in monkeyrunner/jython
Question: I need to Insert something in the `DB`. im using `JDBC` as a `connector,
jython the script`, `mysql` the DB and the script is running in `CentOS`.

my code looks something like this:

> from `com.android.monkeyrunner import MonkeyRunner, MonkeyDevice,
> MonkeyImage`
>
> from `com.ziclix.python.sql import zxJDBC`
>  
>  
>
> db=zxJDBC.connect("jdbc:mysql://XXX.XXX.XXX.XXX:3306/dbname","USER","PASSWORD","org.gjt.mm.mysql.Driver")
>  

`c=db.cursor() c.execute("INSERT INTO tablename values ('X','X','X')")`

before that, I downloaded and decompressed the file from
[here](http://dev.mysql.com/downloads/connector/j/) (in the desktop)

I added the path to classpath by doing this

    
    
     export PATH=/home/XX/Desktop/mysql-connector-java-5.1.22
    

and when I ran the script, it gave me this error

> `zxJDBC.DatabaseError.driver [org.gjt.mm.mysql.Driver]` not found

what have I done wrong? is the name of the driver name correct? because I just
copied it in one of the tutorials that I've seen. or probably did I install
the driver correctly?

Thanks.


Answer: this is how I managed to solve the error:

  1. Download the JDBC driver [here](http://dev.mysql.com/downloads/connector/j/)

  2. Extract the tar.gz file anywhere you want.

  3. You will find mysql-connector-java-5.1.22-bin.jar inside that folder. Copy that and paste to (in my case) /%android-sdk%/tools/lib

  4. Add the new location of mysql-connector-java-5.1.22-bin.jar to classpath

  5. do the script like this

> from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
>
> from com.ziclix.python.sql import zxJDBC
>
>
> db=zxJDBC.connect("jdbc:mysql://XXX.XXX.XXX.XXX:3306/dbname","USER","PASSWORD","com.mysql.jdbc.Driver")
>
> c=db.cursor()
>
> c.execute("INSERT INTO tablename values ('X','X','X')")
>
> db.commit()

Hope this helps to those who will need it in the future. :)

