We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I wish query oracle test.A table to insert oracle MAEAS.A table , it use executemany and batch run.
` import sys import os import jaydebeapi
url = 'jdbc:oracle:thin:@8.142.180.78:1521:MAEASDB' driver = 'oracle.jdbc.driver.OracleDriver' userFrom = 'test' passwordFrom = 'test' jarFile = 'D:/Tools/JDBC/ojdbc8.jar' connFrom = jaydebeapi.connect(jclassname=driver, url=url, driver_args=[userFrom, passwordFrom], jars=jarFile) cursFrom = connFrom.cursor() userTo = 'MAEAS' passwordTo = 'MAEAS' jarFile = 'D:/Tools/JDBC/ojdbc8.jar' connTo = jaydebeapi.connect(jclassname=driver, url=url, driver_args=[userTo, passwordTo], jars=jarFile) cursTo = connTo.cursor() sqlStr = 'select FREGIONCODE, FCATEGORYNUMBER, FCATEGORYNAME, FCATEGORYSUBCODE, FCATEGORYSUBNAME, FPAYITEMNUMBER, FPAYITEMNAME, FPAYITETYPE, FCATEGORYID, FCATEGORYSUBID from CT_CUS_PAYITEMSCATE_INIT order by FCATEGORYNUMBER,FCATEGORYSUBCODE,FPAYITEMNUMBER' cursFrom.execute(sqlStr) resultFrom = cursFrom.fetchall() cursTo = connTo.cursor() #print (i) sqlInsert = "insert into CT_CUS_PAYITEMSCATE_INIT (FREGIONCODE, FCATEGORYNUMBER, FCATEGORYNAME, FCATEGORYSUBCODE, FCATEGORYSUBNAME, FPAYITEMNUMBER, FPAYITEMNAME, FPAYITETYPE, FCATEGORYID, FCATEGORYSUBID) values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')" cursTo.executemany(sqlInsert, resultFrom)
` Traceback (most recent call last): File "d:\C\import sys.py", line 29, in cursTo.executemany(sqlInsert, resultFrom) File "D:\Programs\Python\Python\lib\site-packages\jaydebeapi_init_.py", line 549, in executemany self._set_stmt_parms(self.prep, parameters) File "D:\Programs\Python\Python\lib\site-packages\jaydebeapi_init.py", line 523, in _set_stmt_parms prep_stmt.setObject(i + 1, parameters[i]) java.sql.java.sql.SQLException: java.sql.SQLException: Invalid column index
The text was updated successfully, but these errors were encountered:
you have to use ? as injector in your query instead of %s
?
%s
Sorry, something went wrong.
No branches or pull requests
I wish query oracle test.A table to insert oracle MAEAS.A table , it use executemany and batch run.
`
import sys
import os
import jaydebeapi
url = 'jdbc:oracle:thin:@8.142.180.78:1521:MAEASDB'
driver = 'oracle.jdbc.driver.OracleDriver'
userFrom = 'test'
passwordFrom = 'test'
jarFile = 'D:/Tools/JDBC/ojdbc8.jar'
connFrom = jaydebeapi.connect(jclassname=driver,
url=url,
driver_args=[userFrom, passwordFrom],
jars=jarFile)
cursFrom = connFrom.cursor()
userTo = 'MAEAS'
passwordTo = 'MAEAS'
jarFile = 'D:/Tools/JDBC/ojdbc8.jar'
connTo = jaydebeapi.connect(jclassname=driver,
url=url,
driver_args=[userTo, passwordTo],
jars=jarFile)
cursTo = connTo.cursor()
sqlStr = 'select FREGIONCODE, FCATEGORYNUMBER, FCATEGORYNAME, FCATEGORYSUBCODE, FCATEGORYSUBNAME, FPAYITEMNUMBER, FPAYITEMNAME, FPAYITETYPE, FCATEGORYID, FCATEGORYSUBID from CT_CUS_PAYITEMSCATE_INIT order by FCATEGORYNUMBER,FCATEGORYSUBCODE,FPAYITEMNUMBER'
cursFrom.execute(sqlStr)
resultFrom = cursFrom.fetchall()
cursTo = connTo.cursor()
#print (i)
sqlInsert = "insert into CT_CUS_PAYITEMSCATE_INIT (FREGIONCODE, FCATEGORYNUMBER, FCATEGORYNAME, FCATEGORYSUBCODE, FCATEGORYSUBNAME, FPAYITEMNUMBER, FPAYITEMNAME, FPAYITETYPE, FCATEGORYID, FCATEGORYSUBID) values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')"
cursTo.executemany(sqlInsert, resultFrom)
`
Traceback (most recent call last):
File "d:\C\import sys.py", line 29, in
cursTo.executemany(sqlInsert, resultFrom)
File "D:\Programs\Python\Python\lib\site-packages\jaydebeapi_init_.py", line 549, in executemany
self._set_stmt_parms(self.prep, parameters)
File "D:\Programs\Python\Python\lib\site-packages\jaydebeapi_init.py", line 523, in _set_stmt_parms
prep_stmt.setObject(i + 1, parameters[i])
java.sql.java.sql.SQLException: java.sql.SQLException: Invalid column index
The text was updated successfully, but these errors were encountered: