473,385 Members | 1,782 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,385 software developers and data experts.

database connection.

wei
i tested database connection to oracle. the code worked on windows
application but didn't work on web application. the code is as following:
OleDbDataAdapter DataAdapter = new OleDbDataAdapter(commandString,
connectionString);

DataSet dataSet = new DataSet( );

// fill the data set object

DataAdapter.Fill(dataSet,dataSetName);

// Get the one table from the DataSet

DataTable dataTable = dataSet.Tables[0];
return dataTable;

codes in two application are exactly same. when run web application, it
stopped at DataAdapter.Fill(dataSet,dataSetName) and gave an exception
message of:

ORA-12154: TNS:could not resolve service name
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: ORA-12154: TNS:could
not resolve service name

did i miss something?

thank you for any help.
Nov 18 '05 #1
6 2649
wei wrote:

ORA-12154: TNS:could not resolve service name
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: ORA-12154: TNS:could
not resolve service name


looks like something in your connectString is not correct. It should
not have to be different for web vs win. I'd check to make sure your
web app is setup correctly for database access. Also check the tns
settings for your oracle connection on that box.

Actually, maybe it's because of permissions, you can't read the file
where the tns values are stored. If this is a dev box, try temporarily
changing your user setup in machine.config to SYSTEM instead of machine
(it's in the processModel node/section). Then re-run this. See if it
works. (and then of course, as a good developer, change machine.config
back :-) )

If it fails (which I would hope), then you know it's something with
permissions for the aspnet account accessing some Oracle settings/files.
Maybe have to give the aspnet user access to that directory. I
haven't worked with Oracle in awhile, so I'm drawing from vague memories...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #2
wei wrote:

ORA-12154: TNS:could not resolve service name
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: ORA-12154: TNS:could
not resolve service name


looks like something in your connectString is not correct. It should
not have to be different for web vs win. I'd check to make sure your
web app is setup correctly for database access. Also check the tns
settings for your oracle connection on that box.

Actually, maybe it's because of permissions, you can't read the file
where the tns values are stored. If this is a dev box, try temporarily
changing your user setup in machine.config to SYSTEM instead of machine
(it's in the processModel node/section). Then re-run this. See if it
works. (and then of course, as a good developer, change machine.config
back :-) )

If it fails (which I would hope), then you know it's something with
permissions for the aspnet account accessing some Oracle settings/files.
Maybe have to give the aspnet user access to that directory. I
haven't worked with Oracle in awhile, so I'm drawing from vague memories...

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #3
wei
Thanks Craig. i think you are right.the connectString is not set properly.
if i down the ip address, how do i set it?
string connectionString = "Provider=MSDAORA.1;Data source=server;User
ID=username;Password=password";

this is my current setting. i try to replace server with ip+port, it didn't
work either. how do i set it? thanks.

"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:eU*************@TK2MSFTNGP09.phx.gbl...
wei wrote:

ORA-12154: TNS:could not resolve service name
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: ORA-12154: TNS:could not resolve service name

looks like something in your connectString is not correct. It should
not have to be different for web vs win. I'd check to make sure your
web app is setup correctly for database access. Also check the tns
settings for your oracle connection on that box.

Actually, maybe it's because of permissions, you can't read the file
where the tns values are stored. If this is a dev box, try temporarily
changing your user setup in machine.config to SYSTEM instead of machine
(it's in the processModel node/section). Then re-run this. See if it
works. (and then of course, as a good developer, change machine.config
back :-) )

If it fails (which I would hope), then you know it's something with
permissions for the aspnet account accessing some Oracle settings/files.
Maybe have to give the aspnet user access to that directory. I
haven't worked with Oracle in awhile, so I'm drawing from vague

memories...
--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET

Nov 18 '05 #4
wei
Thanks Craig. i think you are right.the connectString is not set properly.
if i down the ip address, how do i set it?
string connectionString = "Provider=MSDAORA.1;Data source=server;User
ID=username;Password=password";

this is my current setting. i try to replace server with ip+port, it didn't
work either. how do i set it? thanks.

"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:eU*************@TK2MSFTNGP09.phx.gbl...
wei wrote:

ORA-12154: TNS:could not resolve service name
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: ORA-12154: TNS:could not resolve service name

looks like something in your connectString is not correct. It should
not have to be different for web vs win. I'd check to make sure your
web app is setup correctly for database access. Also check the tns
settings for your oracle connection on that box.

Actually, maybe it's because of permissions, you can't read the file
where the tns values are stored. If this is a dev box, try temporarily
changing your user setup in machine.config to SYSTEM instead of machine
(it's in the processModel node/section). Then re-run this. See if it
works. (and then of course, as a good developer, change machine.config
back :-) )

If it fails (which I would hope), then you know it's something with
permissions for the aspnet account accessing some Oracle settings/files.
Maybe have to give the aspnet user access to that directory. I
haven't worked with Oracle in awhile, so I'm drawing from vague

memories...
--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET

Nov 18 '05 #5
wei wrote:
Thanks Craig. i think you are right.the connectString is not set properly.
if i down the ip address, how do i set it?
string connectionString = "Provider=MSDAORA.1;Data source=server;User
ID=username;Password=password";

this is my current setting. i try to replace server with ip+port, it didn't
work either. how do i set it? thanks.

"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:eU*************@TK2MSFTNGP09.phx.gbl...
wei wrote:
Actually, maybe it's because of permissions, you can't read the file
where the tns values are stored. If this is a dev box, try temporarily
changing your user setup in machine.config to SYSTEM instead of machine
(it's in the processModel node/section). Then re-run this. See if it
works. (and then of course, as a good developer, change machine.config
back :-) )

If it fails (which I would hope), then you know it's something with
permissions for the aspnet account accessing some Oracle settings/files.
Maybe have to give the aspnet user access to that directory. I
haven't worked with Oracle in awhile, so I'm drawing from vague


memories...
--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET



Here's a site that shows connection strings for different DBs,
providers, etc.:

http://www.connectionstrings.com/

Did you try the permissions check, that's becoming more and more likely
in my mind? Try either changing your user id that ASP.NET runs under to
SYSTEM, or give aspnet access to the folder with the tns entries.....I
don't remember where Oracle stores those on the server.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #6
wei wrote:
Thanks Craig. i think you are right.the connectString is not set properly.
if i down the ip address, how do i set it?
string connectionString = "Provider=MSDAORA.1;Data source=server;User
ID=username;Password=password";

this is my current setting. i try to replace server with ip+port, it didn't
work either. how do i set it? thanks.

"Craig Deelsnyder" <cdeelsny@NO_SPAM_4_MEyahoo.com> wrote in message
news:eU*************@TK2MSFTNGP09.phx.gbl...
wei wrote:
Actually, maybe it's because of permissions, you can't read the file
where the tns values are stored. If this is a dev box, try temporarily
changing your user setup in machine.config to SYSTEM instead of machine
(it's in the processModel node/section). Then re-run this. See if it
works. (and then of course, as a good developer, change machine.config
back :-) )

If it fails (which I would hope), then you know it's something with
permissions for the aspnet account accessing some Oracle settings/files.
Maybe have to give the aspnet user access to that directory. I
haven't worked with Oracle in awhile, so I'm drawing from vague


memories...
--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET



Here's a site that shows connection strings for different DBs,
providers, etc.:

http://www.connectionstrings.com/

Did you try the permissions check, that's becoming more and more likely
in my mind? Try either changing your user id that ASP.NET runs under to
SYSTEM, or give aspnet access to the folder with the tns entries.....I
don't remember where Oracle stores those on the server.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 18 '05 #7

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

Similar topics

3
by: Mudge | last post by:
Hi, My hosting provider only allows me to use 50 connections to my MySQL database that my Web site will use. I don't know what this 50 connections means exactly. Does this mean that only 50...
11
by: pradeep_TP | last post by:
Hi all, I have a few questions that I have been wanting to ask for long. These are all related to ADO.net and specifically to conenction to database. 1) If I have opened a connection to a...
3
by: R Reyes | last post by:
Hi, I'm trying to modularize my database connections a little better and get more out of my project with less code. First check out this common dbOpen() function inside class clsDatabase. I...
14
by: Nick Gilbert | last post by:
Hi, I have an asp.net application which runs from a CD-ROM using Cassini. As such, it is single user only. The application connects to an Access database when it is loaded, and keeps the same...
7
by: Lau Lei Cheong | last post by:
Hello, Actually I think I should have had asked it long before, but somehow I haven't. Here's the scenerio: Say we have a few pages in an ASP.NET project, each of them needs to connect to...
3
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database...
35
by: Terry Jolly | last post by:
Web Solution Goal: Have a global database connection Why: (There will be 30+ tables, represented by 30+ classes) I only want to reference the database connection once. I put the connection...
6
by: Arsalan Ahmad | last post by:
Hi all, I am creating a website in which in an Item detail page there are a number of web controls (7 or 8) and what is happening that inside each of control's Page_Load() function I am creating...
22
Frinavale
by: Frinavale | last post by:
How To Use A Database In Your Program Many .NET solutions are database driven and so many of us often wonder how to access the database. To help you understand the answer to this question I've...
1
Curtis Rutland
by: Curtis Rutland | last post by:
How To Use A Database In Your Program Part II This article is intended to extend Frinny’s excellent article: How to Use a Database in Your Program. Frinny’s article defines the basic concepts...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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...

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.