473,748 Members | 2,219 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Oracle beginner problem: can't connect to Oracle using cx_Oracle

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 option
JServer Release 8.1.7.3.0 - Production

(end quote of Unix box SQL*Plus stuff)

so I know that myuser/mypassword works for SQL*Plus on the myhost Unix
box.

I downloaded the cx_Oracle Python interface to Oracle(r) Version: 4.0
Date: December 17, 2003 Win32 binary for Oracle 8i, Python 2.) and
proceeded to exercise the usage example:

PythonWin 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)]
on win32.
Portions Copyright 1994-2001 Mark Hammond (mh******@skipp inet.com.au) -
see 'Help/About PythonWin' for further copyright information.
import cx_Oracle
connection = cx_Oracle.conne ct("myuser/mypassword@myho st") Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
DatabaseError: ORA-12514: TNS:listener could not resolve SERVICE_NAME
given in connect descriptor


(end usage example quote)

Any ideas as to what the problem is?

Thanks in advance for the usual valuable and pertinent advice I have
come to expect from this forum.

John Benson
js******@benson systems.com
Jul 18 '05 #1
1 5236


Benson, John wrote:
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 option
JServer Release 8.1.7.3.0 - Production

(end quote of Unix box SQL*Plus stuff)

so I know that myuser/mypassword works for SQL*Plus on the myhost Unix
box.

I downloaded the cx_Oracle Python interface to Oracle(r) Version: 4.0
Date: December 17, 2003 Win32 binary for Oracle 8i, Python 2.) and
proceeded to exercise the usage example:

PythonWin 2.3.2 (#49, Oct 2 2003, 20:02:00) [MSC v.1200 32 bit (Intel)]
on win32.
Portions Copyright 1994-2001 Mark Hammond (mh******@skipp inet.com.au) -
see 'Help/About PythonWin' for further copyright information.
import cx_Oracle
connectio n = cx_Oracle.conne ct("myuser/mypassword@myho st")


Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
DatabaseError: ORA-12514: TNS:listener could not resolve SERVICE_NAME
given in connect descriptor


I think it's a problem with the connection data in your Windows PC.
You have tested a local connection ( user/password ) on the Unix host
with SQL*Plus.
Have you tried a remote connection ( user/password@host ) from your
Windows PC with SQL*Plus ?
I think you will find the same problem if you try it with SQL*Plus.

Probably the connection data in your TNSNAMES.ORA file is not correct.

Hope this helps

Aurelio

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?
0
1181
by: duikboot | last post by:
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?
1
8508
by: Greg Lindstrom | last post by:
>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.DatabaseError: ORA-12154: TNS:could not resolve service name /usr/bin/sh: cx_Oracle.DatabaseError:: not found Is this any help? Thanks!
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
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
7
7646
cpiyush
by: cpiyush | last post by:
Hi. I am using Cx_Oracle inteface for conectivity to Oracle db server. This is my code. connection = cx_Oracle.connect("sys/demo@Sample.Natas1 as sysdba") cursor = connection.cursor() cursor.arraysize = 50 cursor.execute("""select col1, col2 from tab1""") for column_1, column_2 in cursor.fetchall(): print "Values:", column_1, column_2
6
11801
by: t_rectenwald | last post by:
Hello, I attempting to execute an Oracle query, and write the results to a file in CSV format. To do so, I've done the following: import cx_Oracle db = cx_Oracle.connect('user/pass@DBSID') cursor = db.cursor() cursor.arraysize = 500 cursor.execute(sql)
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
8991
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
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9552
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9376
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
9326
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,...
1
6796
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
4877
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
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
2215
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.