← Back to team overview

sikuli-driver team mailing list archive

[Question #266640]: (Brazilian Portuguese) zxJDBC Insert Sikuli [Nothing Happens]

 

A question was asked in a language (Brazilian Portuguese) spoken by
none of the registered Sikuli answer contacts.

https://answers.launchpad.net/sikuli/+question/266640

#! / Usr / bin / env python 
# - * - codificação: utf-8 - * -
import jarray
from guide import *
from sikuli import *
import codecs

class classPathHacker(object):
    """Original Author: SG Langer Jan 2007, conversion from Java to Jython
    Updated version (supports Jython 2.5.2) From http://glasblog.1durch0.de/?p=846

    Purpose: Allow runtime additions of new Class/jars either from
    local files or URL
    """    
    
    import java.lang.reflect.Method
    import java.io.File
    import java.net.URL
    import java.net.URLClassLoader
    
    def addFile(self, s):
        """Purpose: If adding a file/jar call this first
        with s = path_to_jar"""
        # make a URL out of 's'
        f = self.java.io.File(s)
        u = f.toURL()
        a = self.addURL(u)
        return a
        
    def addURL(self, u):
        """Purpose: Call this with u= URL for
        the new Class/jar to be loaded"""
        sysloader = self.java.lang.ClassLoader.getSystemClassLoader()
        sysclass = self.java.net.URLClassLoader
        method = sysclass.getDeclaredMethod("addURL", [self.java.net.URL])
        a = method.setAccessible(1)
        jar_a = jarray.array([u], self.java.lang.Object)
        b = method.invoke(sysloader, [u])
        return u


tmp = classPathHacker()
tmp.addFile("C:\Arquivos de Programas\MySQL\MySQL Connector J\mysql-connector-java-5.1.35-bin.jar")
    
from com.ziclix.python.sql import zxJDBC 

db = zxJDBC.connect("jdbc:mysql://localhost/usuarios", "root", "", "com.mysql.jdbc.Driver", CHARSET='utf-8')
C = db.cursor()
#C.execute("insert into status values(?),['passou']")
  
#C.execute ("select * from usuario")
#C.execute("insert into status values (?)", ['Passou'])
C.execute ("select * from status")
#C.execute(sql)
for a in C.fetchall():
    
    uni = unicode(a,'utf-8')
   
    print repr(uni)
 
soon after,nothing happens.
I'am listed the bank and there were results


sorry my english
   

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