Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 "Server does not exist or access denied"

Author  Topic 

nawhaley
Starting Member

4 Posts

Posted - 2006-06-16 : 08:52:58
Hey everyone I"m connecting to my SQL 2k database through a php program I wrote now the issue I'm having is the error message in the title telling me that the server dosent exist or access was denied. Now I know the servers there since I admin the server myself. I also know the database is accessable from other computers using an apache web server just does not seem to work when stored on the main webserver which runs IIS instead. I suspect this is something to do with the way I have the SQL server configured does anyone have a list of things I can check to troubleshoot this in more detail?

mr_mist
Grunnio

1870 Posts

Posted - 2006-06-16 : 09:01:25
What type of connection string are you using? Is it integrated auth or sql login? If it's sql login, test that you can access the server using that login through query analyzer.

-------
Moo. :)
Go to Top of Page

nawhaley
Starting Member

4 Posts

Posted - 2006-06-16 : 10:27:00
I'm using a named pipes odbc connection the code for the connection is as follows

link = odbc_connect("ApplicantQuiz","username","password");

/* set up query for questions */
$catagoryquery = "SELECT CatagoryID FROM tblCatagories WHERE Catagory ='$quizname'";
$catagoryresults = odbc_exec($link,$catagoryquery);
$CatagoryID =odbc_result($catagoryresults,"CatagoryID");
$questionquery = "Select * from tblQuestions WHERE CatagoryID ='$CatagoryID'";
$questionresults = odbc_exec($link,$questionquery);

I"m confused on the whole query analyzer thing I've never used one honestly is there one I can download that has solid instructions on how to configure and use or is it built into the OS?
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-06-16 : 11:38:26
see this
www.connectionstrings.com
Go to Top of Page

nawhaley
Starting Member

4 Posts

Posted - 2006-06-16 : 12:12:03
Sorry not sure how to pull all that out of the server please keep in mind a lot of this stuff was just dropped on my lap with me being the only IT person here and use needing SQl server and some coding done in it the best I can emulate what your asking for is the following which isnt pulled directly from the server just me filling in the necessary information.

"Driver={SQL Server}; Server = Immagetech1;Database=ApplicantQuiz;Uid=sa,Pwd=password"

hopefully this makes more sense if you need me to pull it directly if you'll tell me where to look I'll happly pull it out all I can manage to find is the normal ODBC settings which is what I copied and put here for you.
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-06-16 : 14:11:41
"Driver={SQL Server};Server= Immagetech1;Database=ApplicantQuiz;user=sa;pwd=password"

make reference to the above link i posted earlier

www.connectionstrings.com
Go to Top of Page

nawhaley
Starting Member

4 Posts

Posted - 2006-06-16 : 14:48:54
I did reference the link you gave it ,the problem with the link is it shows you the format of a connectionstring but dosent show you how to get the connectionstring from the server itself so its not very helpful. I looked all over the site for any more information and what I gave you is all I can come up with. If you found something on the site that I didnt let me know what it is and I'll happily correct the above statement so you have the information you need to assist with the issue I'm currently having. Until then I'm honestly confused as to what it is exactly your wanting from me that I havent already provided in reference to the connectionstring.

Edit: I think their might be some confusion as to how this is working I"m using an ODBC connection off a system DSN to make my connection to the SQL server. I'm not using access or excell so their won't be just a string involved in the way the connection works. Where would I find what your asking for based off the fact its on a system DSN reference?
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-06-16 : 17:29:09
1. Whats your server name ?
2. whats your username To the server ?
3. Whats your password ?
4. whats your database name ?

replace them below in the areas i put red and try


link =  "Driver={SQL Server};Server= Immagetech1;Database=ApplicantQuiz;user=sa;pwd=password"
/* set up query for questions */
$catagoryquery = "SELECT CatagoryID FROM tblCatagories WHERE Catagory ='$quizname'";
$catagoryresults = odbc_exec($link,$catagoryquery);
$CatagoryID =odbc_result($catagoryresults,"CatagoryID");
$questionquery = "Select * from tblQuestions WHERE CatagoryID ='$CatagoryID'";
$questionresults = odbc_exec($link,$questionquery);
Go to Top of Page
   

- Advertisement -