Oracle to Mysql, I'm (still) lost...

Discussion in 'Python' started by duikboot, Jan 19, 2004.

  1. duikboot

    duikboot Guest

    Hello all,

    I still can't convert Oracle tables to a Mysql database. See thread:
    http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=utf-8&threadm=mailman.
    282.1073834719.12720.python-list%40python.org&rnum=1&prev=/groups%3Fsourceid
    %3Dmozclient%26ie%3Dutf-8%26oe%3Dutf-8%26q%3Dpython%2Boracle%2Bmysql

    The tables in Oracle and Mysql are the same. Is there anyone who can help me
    with this?

    Thanks in advance,

    Arjen

    #######code######
    import cx_Oracle, MySQLdb
    from time import time

    tabellen=["machine", "machinegroup", "machines", "operation", "orders",
    "run", "step"]

    tijd=time()
    conO=cx_Oracle.connect("some/some")
    cursO=conO.cursor()
    conMy=MySQLdb.Connect("localhost", db="some")
    cursMy=conMy.cursor()

    for tabel in tabellen:
    cursO.execute("select * from " + tabel)
    cursMy.execute("truncate " + tabel)
    #print cursO.description
    a_oracle=cursO.fetchone()
    cursMy.execute("insert into %s values %s", (tabel, a_oracle))

    conO.close()
    conMy.close()
    print "\n\nklaar in :\n"
    print time()-tijd, " seconden\n\n"

    #####error####
    Traceback (most recent call last):
    File "A:/tabellen2.py", line 20, in ?
    cursMy.execute("insert into %s values %s", (tabel, a_oracle))
    File "E:\Python23\Lib\site-packages\MySQLdb\cursors.py", line 95, in
    execute
    return self._execute(query, args)
    File "E:\Python23\Lib\site-packages\MySQLdb\cursors.py", line 114, in
    _execute
    self.errorhandler(self, exc, value)
    File "E:\Python23\Lib\site-packages\MySQLdb\connections.py", line 33, in
    defaulterrorhandler
    raise errorclass, errorvalue
    ProgrammingError: (1064, 'You have an error in your SQL syntax. Check the
    manual that corresponds to your MySQL server version for the right syntax to
    use near \'\'machine\' values ("\'230KM\'", "\' \'", "\'230KM\'",
    "\'1980-01-01 00:')
    >>>
     
    duikboot, Jan 19, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vaidas gudas
    Replies:
    1
    Views:
    471
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Oct 11, 2004
  2. UJ
    Replies:
    4
    Views:
    501
  3. Replies:
    24
    Views:
    474
  4. MartyN
    Replies:
    0
    Views:
    130
    MartyN
    Nov 14, 2006
  5. Feyruz
    Replies:
    4
    Views:
    2,353
    Sherm Pendley
    Oct 14, 2005
Loading...

Share This Page