cx-oracle

Call oracle stored procedure with cursor output parameter from python script

风流意气都作罢 提交于 2019-12-21 20:18:23
问题 I am trying to call a oracle stored procedure with 2 in and 1 out parameter from python script. The problem I am having is passing a cursor out-parameter. The Oracle stored procedure is essentially: PROCEDURE ci_lac_state (LAC_ID_IN IN VARCHAR2, CI_ID_IN IN VARCHAR2 DEFAULT NULL, CGI_ID OUT SYS_REFCURSOR) AS BEGIN OPEN cgi_id FOR ... END; The python code calling to the database is: #! /usr/bin/python import cx_Oracle lac='11508' ci='9312' try: my_connection=cx_Oracle.Connection('login/passwd

Authentication with public keys and cx_Oracle using Python

一笑奈何 提交于 2019-12-21 16:50:22
问题 I've Googled a bit but I haven't found any substantial results. Is it possible to use key-based authentication to connect to an Oracle server using Python? My objective is to be able to automate some reporting I'm doing with Python without having to store a username/password anywhere in the server. 回答1: One possible solution is to implement Oracle Wallet. Creating an Oracle Wallet entry involves having: a tnsname resolution name established for the said instance a username and password

Authentication with public keys and cx_Oracle using Python

自闭症网瘾萝莉.ら 提交于 2019-12-21 16:50:17
问题 I've Googled a bit but I haven't found any substantial results. Is it possible to use key-based authentication to connect to an Oracle server using Python? My objective is to be able to automate some reporting I'm doing with Python without having to store a username/password anywhere in the server. 回答1: One possible solution is to implement Oracle Wallet. Creating an Oracle Wallet entry involves having: a tnsname resolution name established for the said instance a username and password

cx_Oracle and output variables

吃可爱长大的小学妹 提交于 2019-12-21 10:46:27
问题 I'm trying to do this again an Oracle 10 database: cursor = connection.cursor() lOutput = cursor.var(cx_Oracle.STRING) cursor.execute(""" BEGIN %(out)s := 'N'; END;""", {'out' : lOutput}) print lOutput.value but I'm getting DatabaseError: ORA-01036: illegal variable name/number Is it possible to define PL/SQL blocks in cx_Oracle this way? 回答1: Yes, you can do anonymous PL/SQL blocks. Your bind variable for the output parameter is not in the correct format. It should be :out instead of %(out)s

cx_Oracle - DLL load failed

喜欢而已 提交于 2019-12-21 04:09:00
问题 I have a problem importing cx_Oracle with Python. I know a lot of issues with cx_Oracle have been discussed here, but it seems that I cannot find a solution to my problem after reading all the related topics. I have two machines, one is my computer and another one is a remote workstation, which have similar configs (Windows 7, 64-bits). I need to install cx_Oracle on the remote workstation but it does not work, whereas it works fine on my computer (I can import the module successfully and

memoryError when connect() with a engine created by create_engine from sqlalchemy in flask

天大地大妈咪最大 提交于 2019-12-20 05:25:05
问题 I want to access an oracle database through sqlalchemy in flask development. An engine is created by sqlalchemy create_engine() MemoryError is reported when engine.connect() is called. If setting a wrong password in the linkword, it would report: sqlalchemy.exc.DatabaseError: (cx_Oracle.DatabaseError) ORA-01017: invalid username/password; logon denied. With the correct password and user name, MemoryError would appear. It is very strange when i copy the codes into jupyter or a new project (not

Python-Oracle Passing in a Cursor Out Parameter

↘锁芯ラ 提交于 2019-12-19 07:49:39
问题 I am trying to call a stored procedure between python and an oracle db. The problem I am having is passing a cursor out-parameter. The Oracle stored procedure is essentially: create or replace procedure sp_procedure( cid int, rep_date date, ret out sys_refcursor ) is begin open ret for select ... end; The python code calling to the database is: import cx_Oracle from datetime import date connstr='user/pass@127.0.0.1:2521/XE' conn = cx_Oracle.connect(connstr) curs = conn.cursor() cid = 1 rep

cx_Oracle doesn't connect when using SID instead of service name on connection string

你离开我真会死。 提交于 2019-12-17 22:35:28
问题 I have a connection string that looks like this con_str = "myuser/mypass@oracle.sub.example.com:1521/ora1" Where ora1 is the SID of my database. Using this information in SQL Developer works fine, meaning that I can connect and query without problems. However, if I attempt to connect to Oracle using this string, it fails. cx_Oracle.connect(con_str) DatabaseError: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor This connection string format works if

Python module “cx_Oracle” module could not be found

こ雲淡風輕ζ 提交于 2019-12-17 12:19:08
问题 I recently installed cx_Oracle module on my machine, in order to connect to a remote Oracle database server. (I have no Oracle client at my side). Python: Version 2.7 x86 Oracle: Verision 11.1.X x64 Cx_Oracle:Verion-5.1.2-11g.win32-py2.7 Then everytime I run my script, it fails and print the following message: ImportError: DLL load failed: The specified module could not be found. I found a related post at Here, so I am wondering if I anyway have to have an Oracle client at my side where the

cx_Oracle & Connecting to Oracle DB Remotely

人盡茶涼 提交于 2019-12-17 06:29:39
问题 How do you connect to a remote server via IP address in the manner that TOAD, SqlDeveloper, are able to connect to databases with just the ip address, username, SID and password? Whenever I try to specify and IP address, it seems to be taking it locally. In other words, how should the string for cx_Oracle.connect() be formatted to a non local database? There was a previous post which listed as an answer connecting to Oracle via cx_Oracle module with the following code: #!/usr/bin/python