473,765 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Oracle Connectivity

cpiyush
31 New Member
Hi. I am using Cx_Oracle inteface for conectivity to Oracle db server.

This is my code.
connection = cx_Oracle.conne ct("sys/demo@Sample.Nat as1 as sysdba")
cursor = connection.curs or()
cursor.arraysiz e = 50
cursor.execute( """select col1, col2 from tab1""")
for column_1, column_2 in cursor.fetchall ():
print "Values:", column_1, column_2


& When i am running this I am getting this error: -
cx_Oracle.Datab aseError: ORA-12154: TNS:could not resolve service name

Can you please tell me what to with this??

Thanks & Regards,
Piyush.
Apr 17 '07 #1
7 7647
ghostdog74
511 Recognized Expert Contributor
verify your database or server name is correct and that it can be resolved by DNS. Also take a look at here
Apr 17 '07 #2
cpiyush
31 New Member
verify your database or server name is correct and that it can be resolved by DNS. Also take a look at here
I read this & the db name is correct.
can you tell me wher to check the server name?
Apr 17 '07 #3
ghostdog74
511 Recognized Expert Contributor
I read this & the db name is correct.
can you tell me wher to check the server name?
sorry, I don't really use oracle. But here's what you can do.
just remove the other lines, and only left this line:
Expand|Select|Wrap|Line Numbers
  1. connection = cx_Oracle.connect("sys/demo@Sample.Natas1 as sysdba")
  2.  
if you still get the error, its got something to do with the connection string.
OR, you can use the makedsn() method to create a connection string for your use. check the docs on how to use it. make sure Sample.Natas1 is in your TNS entry (from the Oracle names server or tnsnames.ora file).
Apr 17 '07 #4
cpiyush
31 New Member
sorry, I don't really use oracle. But here's what you can do.
just remove the other lines, and only left this line:
Expand|Select|Wrap|Line Numbers
  1. connection = cx_Oracle.connect("sys/demo@Sample.Natas1 as sysdba")
  2.  
if you still get the error, its got something to do with the connection string.
OR, you can use the makedsn() method to create a connection string for your use. check the docs on how to use it. make sure Sample.Natas1 is in your TNS entry (from the Oracle names server or tnsnames.ora file).
Hey Thanks man.
I have got solution... After some brain storming. Now I am using makedsn() function & its creating the connection without any error. The code is as follows: -

host = 'localhost'
port = 1521
dbase = 'Sample'
login = 'demo'
passwrd = 'demo'
dsn = cx_Oracle.maked sn(host, port, dbase)
connection = cx_Oracle.conne ct(login, passwrd, dsn)


But Now I have some other problem.
I have created this user 'demo' & granted all the privileges to it. But when I am logging thru this & accessing that table, then its saying ORA-00942: table or view does not exist.

You said You dont use Oracle, but can you suggest me soething on this??
Apr 18 '07 #5
ghostdog74
511 Recognized Expert Contributor
Hey Thanks man.
I have got solution... After some brain storming. Now I am using makedsn() function & its creating the connection without any error. The code is as follows: -

host = 'localhost'
port = 1521
dbase = 'Sample'
login = 'demo'
passwrd = 'demo'
dsn = cx_Oracle.maked sn(host, port, dbase)
connection = cx_Oracle.conne ct(login, passwrd, dsn)


But Now I have some other problem.
I have created this user 'demo' & granted all the privileges to it. But when I am logging thru this & accessing that table, then its saying ORA-00942: table or view does not exist.

You said You dont use Oracle, but can you suggest me soething on this??
from your error , you can easily guess that its a table/view problem. Is your table or view called tab1 (from previous post) created in "Sample" database?
Apr 18 '07 #6
cpiyush
31 New Member
from your error , you can easily guess that its a table/view problem. Is your table or view called tab1 (from previous post) created in "Sample" database?
Yes. This table 'tab1' is created in db named 'Sample'.
& I have given all the privileges to user 'demo' on this table.
But all these privileges are not getting refelected when I am logging thru 'demo' & trying to execute 'select' stament.

My basic problem is coming here that I am create a user---> granting all the privileges---> Logging in thru that user ---> Trying to execute those privileges (But those privileges are not getting refelected )
Apr 18 '07 #7
ghostdog74
511 Recognized Expert Contributor
Yes. This table 'tab1' is created in db named 'Sample'.
& I have given all the privileges to user 'demo' on this table.
But all these privileges are not getting refelected when I am logging thru 'demo' & trying to execute 'select' stament.

My basic problem is coming here that I am create a user---> granting all the privileges---> Logging in thru that user ---> Trying to execute those privileges (But those privileges are not getting refelected )
well, its beyond my means now. The last thing i suggest is to log in to Oracle using its client interface (SQL plus or something) and see if you really cannot select from tab1.
Apr 18 '07 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

3
9121
by: Alex | last post by:
I have developed a VB application that uses Oracle 8i database for backend. The database server is on the local network. From my development machine, the application connects (via ODBC) to the database successfully. The problem is that I want to install this application on several Windows 2000 client machines that do not have Oracle client installed (hence missing all the ODBC connectivity support files/drivers). What is the minimum...
2
2649
by: Axel Dachtler | last post by:
I am looking for detailed information about the topic "connectivity" in Oracle 9i including JDBC and CGI. Thank you
1
4039
by: Ton | last post by:
I have a question about connectivity between different databases. Oracle, DB2400 and SQL_server. It is easy to integrate application products that are running on different DB platforms? What products can be used to achieve this? Our consultant is mentioning .NET but then we have to run everything on SQL server. Currently we are running on Oracle but our third party generic applications are first developed for SQL server and later...
2
4133
by: New Devil | last post by:
can anyone send a code for the oracle connectivity wid C#.. would be really tahnkful .. Desert Desperado 8) Posted Via Usenet.com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY ** ---------------------------------------------------------- http://www.usenet.com
1
6273
by: lovkeshanand | last post by:
Dear All, I am using the oracle transparent gateway connectivity with sql server using tg4msql,as far as settings are concerned those were set and Connectivity is working Fine, and getting the response from that server. here is description what I done as:-There is a View on Sqlserver which is Join of 6 tables and have
7
4362
by: D. Patrick | last post by:
I need to connect to an Oracle database. I've never done it before. I see that with framework 1.1 you had to download ODP.NET from Oracle's site in order for the framework classes to even work. I tried that quickly, but the file is 400 MB, and the the installation asks for all kinds of things in order to install. Now I'm very confused. a) Do you still need ODP.NET with framework 2.0? b) Do you need to download and install other...
9
1770
by: rahul | last post by:
Hello every1 Can any1 tell me that What are teh various methods by which we can connect our database in sql to our project's front end which is in VB ?? I wanna know the pros and cons of various types of Connectivities?
2
7248
by: ahogan | last post by:
Previously posted on comp.databases.oracle.misc. Apologies to those who read both groups. I have created a link using generic connectivity from an Oracle 10.2.0.1 instance running on windows 2003 32 bit server to an AS400/DB2 database (V5R2 AFAIK). I can execute Select, Insert and Delete statements via the link without error. When I launch an update from sqlplus I get the following error:
5
7775
by: Scav | last post by:
Helpful folks, I am having a problem getting Oracle's Transparent Gateway for DRDA product to interface with DB2 UDB for LUW 8.1.14. The Gateway product is running on Linux and using DRDA protocol to connect to my DB2 test server, which is running on Win2003. This test server has recently been migrated to V8. It was previously on V7.2 FP5, and here is where the mystery lies.
4
2158
by: reachravi | last post by:
Hi, In our ASP application, we are using a visual basic Dll file to perform database operations. We have a function in our Dll file for executing stored procedures. This function takes 3 input parameters from ASP
0
9568
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
9398
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
10160
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...
1
9951
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
6649
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
5275
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...
0
5421
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2805
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.