Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2004
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

    %>

  • #2
    New to the CF scene
    Join Date
    Dec 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <%
    '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.

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    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" -->


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •