← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #266642]: Connect to MySQL DB using zxJDBC in a Sikuli script

 

Question #266642 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/266642

    Status: Open => Answered

RaiMan proposed the following answer:
With the latest version of SikuliX 1.1.0 this is all you have to do:

load("mysql.jar") # see comment
from com.ziclix.python.sql import zxJDBC 
db = zxJDBC.connect("jdbc:mysql://localhost/usuarios", "root", "", 
    "com.mysql.jdbc.Driver", CHARSET='utf-8')

comment: "mysql.jar" is either an absolute path to the driver jar or
just this, if the driver named "mysql.jar" is located in the SikuliX
Extensions folder (http://www.sikulix.com/quickstart.html#qs3)

This runs when either using this as script inside the SikuliX IDE or
using sikulix.jar/runsikulix(.cmd) to run a .sikuli from command line.

If you want to use this with your own Jython, then you have to use sikulixapi.jar according to
https://github.com/RaiMan/SikuliX-2014/wiki/Usage-in-Java-programming.

To avoid any utf-8 conversion problems, you should use Jython 2.7.0
(which is bundled with SikuliX 1.1.0)

BTW:
#! / Usr / bin / env python       <---- not sure what this should help !?
# - * - codificação: utf-8 - * -    <---- not needed when using SikuliX to run your scripts

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.