473,395 Members | 2,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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.ora" file for it to work correctly. If
i copy and paste the entry in the "tnsname.ora" file it complains the
connection string is too long. I want to avoid using the "tnsnames.ora" 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.ora" file and specify a connection string?

Thanks

Bala
Nov 22 '05 #1
6 17691
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 misunderstanding 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.ora" file.My connection string looked something like
this

string connString = "DataSource =db.entry;UserID = 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.ora" 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.ora" 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.ora" file?

Thanks

Bala

"Kevin Yu [MSFT]" <v-****@online.microsoft.com> wrote in message
news:p6**************@TK2MSFTNGXA02.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 misunderstanding 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=mydatasource

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=mydatasource as you suggested i get the
following error.

An unhandled exception of type 'System.Data.OracleClient.OracleException'
occurred in system.data.oracleclient.dll

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

It seems to like the OracleClient always looks for "tnsnames.ora" 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.microsoft.com> wrote in message
news:gh**************@TK2MSFTNGXA02.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=mydatasource

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

Dec 12 '05 #5

"Bala Nagarajan" <ba********@newsgroups.nospam> wrote in message
news:el**************@TK2MSFTNGP12.phx.gbl...
When i try to set the DataSource=mydatasource as you suggested i get the
following error.

An unhandled exception of type 'System.Data.OracleClient.OracleException'
occurred in system.data.oracleclient.dll

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

It seems to like the OracleClient always looks for "tnsnames.ora" 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.microsoft.com> wrote in message
news:gh**************@TK2MSFTNGXA02.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=mydatasource

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
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...
1
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=...
1
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...
9
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...
0
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...
2
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...
2
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...
9
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....
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...

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.