Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-09-2004, 07:37 PM   PM User | #1
danjapro
New Coder

 
Join Date: Dec 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
danjapro is an unknown quantity at this point
Db connection denied

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

%>
danjapro is offline   Reply With Quote
Old 12-10-2004, 03:17 AM   PM User | #2
huykhoi
New to the CF scene

 
Join Date: Dec 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
huykhoi is an unknown quantity at this point
<%
'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.
huykhoi is offline   Reply With Quote
Old 12-10-2004, 03:05 PM   PM User | #3
ghell
Senior Coder

 
Join Date: Apr 2003
Location: England
Posts: 1,192
Thanks: 5
Thanked 13 Times in 13 Posts
ghell is on a distinguished road
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 )

<!-- METADATA TYPE="TypeLib" FILE="C:\Program Files\Common Files\system\ado\msado15.dll" -->
__________________
My tech/code blog
ghell is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:08 AM.


Advertisement
Log in to turn off these ads.