Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Denied access to SQL Server through Asp.net application

Posted on 2006-04-21
9
Medium Priority
?
301 Views
Last Modified: 2006-11-18
Howdie

My web app runs on my machine fine when querying the local database.
However when I want the app to query a sql server instance on another machine on the network
it does not allow me access. I know my connection string is correct - I can access
the database through Enterprise manager, and definately am using the right username
and password. The error message is something to this effect "Cannot connect to server, invalid
username or instance doesn't exist" - poor description but am not at work to get the exact message.
It fails when doing the whole objConnection.Open() thing.
However it works fine when I am accessing the web app when connection through the Internet.
ie through a machine not connected to the network.
Any ideas ?
0
Comment
Question by:gusdogs
  • 5
  • 3
9 Comments
 
LVL 5

Expert Comment

by:Joe Jenkins
ID: 16512004
A couple questions:

1) Do you have the ability to set up a DSN?
2) If so, have you tried this method?
3) Can you post your current connect string?

Joe Jenkins
0
 

Author Comment

by:gusdogs
ID: 16513569
Hey bud, unfortunately I can only try that
when I get back to work on Monday - will let you know.
Many thanks
0
 
LVL 5

Expert Comment

by:Joe Jenkins
ID: 16514947
Sounds good.  Thanks for checking in during the weekend.  

Talk to next week.

Joe Jenkins
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 15

Expert Comment

by:deepaknet
ID: 16522536
You need to have both Named Pipes and TCP enabled. I guess ASP.NET would connect via TCP but Ent. Manager via Named Pipes.

Check out this: http://www.aspfaq.com/sql2005/show.asp?id=3
0
 

Author Comment

by:gusdogs
ID: 16526000
Hey Joe

Tried using a dsn to no avail, here are the error messages I get
and the respective connection strings used in each

Error Message -
SQL Server does not exist or access denied.
Connection string used -
"Server=EGGX; Database=EggX; User ID=sa; Password=3159"

Using a DSN, I get...
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
Connection string used -
"Provider=sqloledb;Data Source=EggX;Initial Catalog=EggX;User Id=sa; Password=3159;"

Once Again I'm 100% sure the credentials are correct.


Hey DEEPAKNET

Both Named Pipes and TCP are enabled.

Any other ideas guys ?

0
 
LVL 5

Accepted Solution

by:
Joe Jenkins earned 2000 total points
ID: 16579918
Gusdogs,

The credentials probably are correct.  The DSN may be set up wrong... Let's see what you have..

1. Admin Tool -> ODBC Connections -> System DSN Tab
2. Select EggX DSN, hit configure

Give me a run-down of what you have in there.  Is the database selected?  That error message you posted is telling me that the SQL Server you're connecting to does not exist or that it just can't find the database.  You can try setting up a User DSN as well and when you click finish it will give you a Test Connection button to test it.  If it works from there, your identically configured SYSTEM DSN should work fine.  

Let's fill in those blanks and see what we have there.

Also, let me see your connection code in your ASP file.  That could be the source of the problem too.

Thanks!
Joe Jenkins
0
 
LVL 5

Expert Comment

by:Joe Jenkins
ID: 16585957
I take it the DSN was configured incorrectly?  I'm glad to have been of assistance!

Joe Jenkins
0
 

Author Comment

by:gusdogs
ID: 16593298
Hey,

I didn't realise we could post a reponse and accept the answer -
new to Experts-Exchange ! Once I selected the correct database,
and not Master, it worked - what an idiot ! Thanks man.
0
 
LVL 5

Expert Comment

by:Joe Jenkins
ID: 16595025
hah!  That's great.  I'm glad you got it.  I bet you'll never make that mistake again!  

Great job!

Joe Jenkins
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month20 days, 20 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question