473,748 Members | 3,585 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Oracle Access via cx_Oracle

>Shouldn't this be '/u01/app/oracle/product/9.2.0' ? Based on the following
values, that's what I'd expect.
I changed the ORCALE_HOME environment variable to the above suggested value
and got a new error!! That's progress, right? I'm now told:
cx_Oracle.Datab aseError: ORA-12154: TNS:could not resolve service name
/usr/bin/sh: cx_Oracle.Datab aseError:: not found
Is this any help?
Thanks!
Greg Lindstrom (501) 975-4859
NovaSys Health gr************@ novasyshealth.c om

"We are the music makers, and we are the dreamers of dreams" W.W.

Jul 18 '05 #1
1 8505
"Greg Lindstrom" <gr************ @novasyshealth. com> writes:
Shouldn't this be '/u01/app/oracle/product/9.2.0' ? Based on the following values, that's what I'd expect.
I changed the ORCALE_HOME environment variable to the above suggested value
and got a new error!! That's progress, right? I'm now told:
cx_Oracle.Datab aseError: ORA-12154: TNS:could not resolve service name
/usr/bin/sh: cx_Oracle.Datab aseError:: not found
Is this any help?


It is, insofar as this means that Oracle is doing the right thing, but
can't find the database. So let's check how we are telling Oracle
where the database is...

First, when you connect using SQL*Plus, you connect something like
this:

sqlplus user/password@databa se

Here, "database" is what Oracle refers to as a "connect string",
which translates to IP/port/SID using the Oracle TNSNAMES.ORA file.
myIP = "ww.xx.yy.z zz"
myPort = nnnn
myDsn = cx_Oracle.maked sn(myIP, myPort, 'test1')
This, on the other hand, constructs a connection descriptor (what a
connect string translates to) by hand. Something like

(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = ww.xx.yy.xxx)(P ORT = nnnn))
)
(CONNECT_DATA = (SID = test1))
)
oracle = cx_Oracle.conne ct(myUid, myPwd, myDsn)
Instead of this, could you try

oracle = cx_Oracle.conne ct(myUid, myPwd, 'database')

where 'database' here is the bit of the SQL*Plus command abover after
the '@' sign? That should make cx_Oracle connect using *exactly* the
same connection descriptor as SQL*Plus uses. If that works, we can
look at why your makedsn call isn't constructing the same descriptor.
(Or, more likely, you can just use the literal connect string that
works, and not bother about gory Oracle details :-))

[elsewhere] Yes, I can hit the Oracle database on the remote (posix) machine with
SQL*Plus running on my Windows box. Does that help me out? Please excuse my
ignorance...I'v e been using MS-SQL Server for the past 4 or 5 years.


Hang on. Is your Python script running on the Windows box? If so, the
os.putenv stuff is both irrelevant and wrong. On Windows, you don't
need any environment variables. Just skip all the putenv stuff.

Hope this helps,
Paul.

PS If you don't follow any of the above, could you just paste into
your reply the *exact* SQL*Plus command that you use which works for
you. I can then give you a more specific example to try.
--
The most likely way for the world to be destroyed, most experts agree,
is by accident. That's where we come in; we're computer professionals.
We cause accidents. -- Nathaniel Borenstein
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3493
by: duikboot | last post by:
Hi all, I'm trying to export a view tables from a Oracle database to a Mysql database. I create insert statements (they look alright), but it all goes wrong when I try to execute them in Mysql, because the dates must have quotes on each side. I just don't know how make the dates right. Well I'll just show you the code and some insert statements it generates. Could anyone please help me?
1
5236
by: Benson, John | last post by:
Hi, I'm a non-Oracle guy just starting to use Python to explore Oracle. I enclose the Python command prompt log for the usage example further down with only the user, password and host names changed to keep me out of trouble. But first, I'd like to point out that I'm able to logon to myhost, and get into the following via SQL*Plus using myuser/mypassword Oracle8i Enterprise Edition Release 8.1.7.3.0 - Production With the Partitioning...
1
831
by: Greg Lindstrom | last post by:
Hello - I am trying to connect to an Oracle database on an HP-9000 via Python 2.3 and cx_Oracle. I have set the following in my python routine: os.putenv('ORACLE_HOME', '/u01/app/oracle') os.putenv('ORA_NLS', '/u01/app/oracle/product/9.2.0/ocommon/nls/admin/data') os.putenv('ORACLE_TERM', 'xterm') os.putenv('ORACLE_SID', 'test1')
4
2856
by: hot.favorite | last post by:
Hi, I'm fairly new to Python so please pardon any dumbness on my part. I plan to write an app in Python that will run on Linux and would need to connect to Oracle and MySQL. I could use MySQLdb for MySQL and cx_oracle for Oracle, but 2 different APIs in the same app is kind of painful. So I have unixODBC that gives me ODBC on Linux. The best ODBC access
17
2727
by: dananrg | last post by:
I'm a little confused about what's out there for database modules at: http://python.org/topics/database/modules.html What I'd like to do is use Python to access an Oracle 9.X database for exporting a series of tables into one aggregated table as a text file, for import into a mainframe database. The catch is that I'd like to write code that wouldn't need to be changed (much) if we switched from Oracle to some other RDBMS (still need to...
5
1887
by: dananrg | last post by:
I was messing around with the native ODBC module (I am using Python in a Win32 environment), e.g: import dbi, odbc ....and it seems to meet my needs. I'd rather use a module that comes natively with Python if it works (don't care about performance in this particular use case; just that it works). The only issue I've had so far is retrieving data from Oracle when an
0
1582
by: cirudinezidane | last post by:
Hi!! I'd like to install Oracle 10 g express edition over Ubuntu to use with Python 2.4. I have installed Ubuntu, Python 2.4 and Oracle database. I think that I have installed correctly cx_Oracle because I have cx_Oracle.so in /usr/share/python2.4/site-packages/ directory. My environment variables are ORACLE_HOME=/usr/lib/oracle and LD_LIBRARY_PATH=$ORACLE_HOME/lib. I am trying to connect to Oracle database: >>>import cx_Oracle
0
3968
by: kishorys | last post by:
I have python version 2.5.1 and cx_Oracle version 4.3.1. Oracle is also in running state. I am getting an error while trying to connect to Oracle DB which is installed in my system from python. >>> import cx_Oracle >>> cx_Oracle.Connection('scott/tiger@orcl') Traceback (most recent call last): File "<pyshell#3>", line 1, in <module> cx_Oracle.Connection('scott/tiger@orcl')
0
1849
by: harshakusam | last post by:
Hi All, In my python script i use to run some oracle queries for this i require a library to connect to oracle which is cx_Oracle. When we were using 9i(oracle).. my script was running fine.. and now when we migrated to 10 G its giving problem... Few lines of my script import sys import cx_Oracle
0
8984
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8237
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4593
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.