Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

iis and sql server 1

Status
Not open for further replies.

rufc

Programmer
Nov 20, 2001
47
0
0
GB
I have just installed SQL Server on my home machine and cannot connect to a database?!?!

I have not had to install sql server before (always installed at work). Do I have to use any settings to get it to install to work with localhost?

Here's is a sample string that works at work but not at home

Code:
<%

Set objConn=Server.CreateObject("ADODB.Connection")
      cs = "Provider=MSDASQL.1;Extended Properties='DRIVER={SQL Server};SERVER=localhost; DATABASE=davidtest; REGIONAL=NO'"
       objConn.open cs

SQL = "SELECT * FROM test where id = 1"
set rs = server.CreateObject("ADODB.RECORDSET")
rs.open SQL,objConn

response.write RS("name")

%>

"If a man is a fool, you don't train him out of being a fool by sending him to university. You merely turn him into a trained fool, ten times more dangerous."
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Try using oledb to sql

dim cn
set cn=server.createobject("Adodb.connection")
cn.open "Provider=SQLOLEDB;Server=(local);integrated security=sspi;database=DavidTest"

then work with your connection..

Be aware that this connection will use the IIS account to Login to SQL server "integrated security=sspi"

Therfore you will need to find out "who" your iis is..
You do that by goint to the security section of your website in the IIS Management tool and "Seeing" who "Anonymous" access is working as..

Then add that user to sqlserver via Enterprise Mangaer and the Security->LOgins section of your server..


HTH


Rob
 
Try using oledb to sql

dim cn
set cn=server.createobject("Adodb.connection")
cn.open "Provider=SQLOLEDB;Server=(local);integrated security=sspi;database=DavidTest"

then work with your connection..

Be aware that this connection will use the IIS account to Login to SQL server "integrated security=sspi"

Therfore you will need to find out "who" your iis is..
You do that by goint to the security section of your website in the IIS Management tool and "Seeing" who "Anonymous" access is working as..

Then add that user to sqlserver via Enterprise Mangaer and the Security->LOgins section of your server..

You will also need to configure access to your Database at the time you add the login (all point and click - not to hard once you have played with it, but 1 thing to remember about SQL server is that it is 90% secure out of the box.

Even after you have added your login to the db as a user, they still cant see any data unless you give them permission to do so. You do that by going to the databases section of SQL and right clicking on the User (in users for each database) and selecting "permissions")

Happy holidays

HTH


Rob
 
that's great thanks very much matey.

Now the hard part is over I can get on with the easy part and building the website [smile2] on 26th.

Finished for the festivities, have a good christmas!!

"If a man is a fool, you don't train him out of being a fool by sending him to university. You merely turn him into a trained fool, ten times more dangerous."
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top