473,782 Members | 2,542 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Oracle connection string problem

Hello,
I am using Oracle 9i in my application and facing a problem with the
connection string. In the datasource attribute of the connection string i
had to specify an entry in "tnsnames.o ra" file for it to work correctly. If
i copy and paste the entry in the "tnsname.or a" file it complains the
connection string is too long. I want to avoid using the "tnsnames.o ra" file
since it exposes the server (and needles to say the configuaration! ) name
but at the same time specify a datasource in the connections string. How to
avoid "tnsnames.o ra" file and specify a connection string?

Thanks

Bala
Nov 22 '05 #1
6 17724
Hi Bala,

From the description, I think you need to connect to an Oracle 9i database
without using a tnsnames.ora file. Is there any misunderstandin g here?

Using the tnsnames.ora file is the simplest way to access the Oracle
database. However, if you have concerns about disposing the data source,
you can try to hard code the connection string to your app.

If you're changing the connection string at runtime, you can also put the
connection string in the app.config file. Before put into the app.config
file, we can use some encryption mechanism to encrypt the whole connection
string. When getting the string, we decrypt it.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 22 '05 #2
Kevin,
I want to be able to connect to Oracle 9i database without having to
worry about "tnsnames.o ra" file.My connection string looked something like
this

string connString = "DataSource =db.entry;UserI D = usid;Password = pwd",

where "db.entry" is an entry from the tnsnames.ora fille which looks like
the following:

db.entry =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS =
(COMMUNITY = my.community)
(PROTOCOL = TCP)
(Host = myserver)
(Port = 9875)
)
)
(CONNECT_DATA = (SID = mydatasource)
)
)
Now the problem is the "tnsnames.o ra" exposes the server name, database name
name and its port , which is a security risk according to me. So my
questions is how to get rid of "tnsmanes.o ra" file and create a connection
string.

Kevin, i cannot place the entry in the app.config file and use it during
runtime because when i tried to copy the entry above to the "DataSource "
attribute of the connection string but .NET complains that the connection
string is too long. So how should i construct my connection string i for the
situation i discussed without using the "tnsnames.o ra" file?

Thanks

Bala

"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
news:p6******** ******@TK2MSFTN GXA02.phx.gbl.. .
Hi Bala,

From the description, I think you need to connect to an Oracle 9i database
without using a tnsnames.ora file. Is there any misunderstandin g here?

Using the tnsnames.ora file is the simplest way to access the Oracle
database. However, if you have concerns about disposing the data source,
you can try to hard code the connection string to your app.

If you're changing the connection string at runtime, you can also put the
connection string in the app.config file. Before put into the app.config
file, we can use some encryption mechanism to encrypt the whole connection
string. When getting the string, we decrypt it.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 23 '05 #3
Hi,

DataSource is server name or alias for the database you're connecting to.
According to the ora file, you can try to use mydatasource as the
DataSource.

DataSource=myda tasource

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Nov 23 '05 #4
When i try to set the DataSource=myda tasource as you suggested i get the
following error.

An unhandled exception of type 'System.Data.Or acleClient.Orac leException'
occurred in system.data.ora cleclient.dll

Additional information: ORA-12154: TNS:could not resolve service name

It seems to like the OracleClient always looks for "tnsnames.o ra" file. Is
that right?
Does this mean that any .NET windows application using Oracle (running on
different server machine) should have oracle client installed?

Please explain.

Thanks

"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
news:gh******** ******@TK2MSFTN GXA02.phx.gbl.. .
Hi,

DataSource is server name or alias for the database you're connecting to.
According to the ora file, you can try to use mydatasource as the
DataSource.

DataSource=myda tasource

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 12 '05 #5

"Bala Nagarajan" <ba********@new sgroups.nospam> wrote in message
news:el******** ******@TK2MSFTN GP12.phx.gbl...
When i try to set the DataSource=myda tasource as you suggested i get the
following error.

An unhandled exception of type 'System.Data.Or acleClient.Orac leException'
occurred in system.data.ora cleclient.dll

Additional information: ORA-12154: TNS:could not resolve service name

It seems to like the OracleClient always looks for "tnsnames.o ra" file. Is
that right?
Does this mean that any .NET windows application using Oracle (running on
different server machine) should have oracle client installed?

Please explain.

Thanks

"Kevin Yu [MSFT]" <v-****@online.mic rosoft.com> wrote in message
news:gh******** ******@TK2MSFTN GXA02.phx.gbl.. .
Hi,

DataSource is server name or alias for the database you're connecting to. According to the ora file, you can try to use mydatasource as the
DataSource.

DataSource=myda tasource

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


Yes.
Dec 13 '05 #6
Hi Bala,

Yes, using OracleClient namespace must have Oracle client installed on that
machine. Since the provider is talking to Oracle client and Oracle client
then talks to the server.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."

Dec 13 '05 #7

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

Similar topics

4
5213
by: Ellen K. | last post by:
Hi all, Being that so far I didn't get an answer to my below problem on the Oracle newsgroup, I figured it couldn't hurt to try here. While at my current job I've been working with mostly SQL Server, now I need to connect to our Oracle Financials running on HP-UX. The Oracle DBA set me up as a user and installed the Oracle client on my box and I have the tnsnames file, but I still can't establish a connection to the database from my...
1
4720
by: Cliff Cooley | last post by:
Can anybody suggest what may be causing the following problem ? I have an ASP script that opens a connection to an Oracle database using a DSN connection string, such as : Set dbConn= Server.CreateObject("ADODB.Connection") dbConn.Open "DSN=somedsn; UID=someuser; PWD=somepassword" With the ASP running on an IIS 5 server, using the Oracle 8 driver to connect to an Oracle 9 database, there are no connection problems, and
1
9200
by: Andrew Arace | last post by:
I scoured the groups for some hands on code to perform the menial task of exporting table data from an Access 2000 database to Oracle database (in this case, it was oracle 8i but i'm assuming this will work for 9i and even 10g ) No one had what I needed, so I wrote it myself. I Rule. This code isn't going for efficiency, and isn't trying to be dynamic. It doesn't create the table structure in Oracle, that's up to you. (I
9
17034
by: mcbill20 | last post by:
Hello all. I just installed Oracle 10g developer tools on a machine running XP Pro and Office XP. Before this I had just the Oracle 9 client installed. I the previous configuration, I was able to access any of the Oracle tables on another machine but now I am having problems. Unfortunately, I don't remember the correct syntax for the ODBC connect string and I am hoping that is my whole problem. I am trying to connect to an Oracle 9...
0
5778
by: ʹÃûÑï | last post by:
ORA-03114: not connected to ORACLE && MS's Bug?? DataBase:Oracle 817 using OracleClient,net framework 1.1 I'm using ADO.Net in C# with Oracle 817. and following is my public data access class. using System.Data.OracleClient;
2
6825
by: Steve Foo | last post by:
I have been posting this question in google group, EE, and Oracle OTN forum and still no cannot find a suitable solution for it. I have contacted Singapore Microsoft support regarding the problem .Unfortunately they are not able to help me and eventually direct me here i'm not 100% sure if this problem is due to ODP.net provider or asp.net IIS setting Hopefully Microsoft Experts here can help me up. Thx Introduction...
2
10271
by: Ben | last post by:
Hi, I have a problem connecting to Oracle using and ODBC connection in a ASP.Net web page. The TNS Names works fine because when I create a DSN it works, and it works in SQL Plus. Here are the error I get depending on the connection string: Using the right server (Oracle 9i), and the Native Oracle Driver
9
2419
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...
0
2617
by: | last post by:
Hi All, I have a client connection problem with Oracle. The exe which i did with C# (vs.net 2005) and Oracle XE , works well on my developer machine but i am getting a connection string error on the client side. The error comes from System.Exception class not from OracleException. The properties of the Oracle.DataAccess reference are ; Description: Oracle.DataAccess.dll
0
9639
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
9479
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
10311
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
9942
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8967
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
7492
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
5378
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
4043
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
2874
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.