...

View Full Version : Db connection denied



danjapro
12-09-2004, 08:37 PM
HEre is my connection to my databse ,I keep getting permision denied at conn.open(conn_str)

What am i doing wrong.

<!-- METADATA TYPE="TypeLib" FILE="C:\Program Files\Common Files\system\ado\msado15.dll" -->

<%
'you must specify db login here
db_server = "nfiserver001"
db_user = "admin"
db_pass = "admin"
db_name = "ashanti"

conn_str = "Provider=SQLOLEDB;Data Source=" & db_server & ";User ID=" & db_user & ";Password=" & db_pass & ";Initial Catalog=" & db_name


Set conn = Server.CreateObject("ADODB.Connection")

'on error resume next
conn.open(conn_str)


if err <> 0 then
'database connection failed
response.write("Error when connecting to database. The database may be down or not setup properly.")
response.end
end if

%>

huykhoi
12-10-2004, 04:17 AM
<%
'you must specify db login here
'Check this statement
db_server = "nfiserver001"
db_user = "admin"
db_pass = "admin"
'Check this statement
db_name = "ashanti"

conn_str = "Provider=SQLOLEDB;Data Source=" & db_server & ";User ID=" & db_user & ";Password=" & db_pass & ";Initial Catalog=" & db_name


Set conn = Server.CreateObject("ADODB.Connection")

'on error resume next
conn.open(conn_str)


if err <> 0 then
'database connection failed
response.write("Error when connecting to database. The database may be down or not setup properly.")
response.end
end if

%>

If nfiserver001 server exists and ashanti database exists, It runs normally, I did.

ghell
12-10-2004, 04:05 PM
yup, should work if you have set up a login properly on the server and the database is there (the login must have access to the database as well btw :))

also i dont think you need this line (ive never needed a metadata line at all but theres probably something you need it for :p)

<!-- METADATA TYPE="TypeLib" FILE="C:\Program Files\Common Files\system\ado\msado15.dll" -->



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum