dcsimg
www.webdeveloper.com
Results 1 to 4 of 4

Thread: Database connection from one server to another

  1. #1
    Join Date
    Jan 2011
    Posts
    60

    Database connection from one server to another

    Hi,

    I'm having trouble connecting to a database on another server. I have setup the DSN which in testing works perfect. However when running the asp script with the follwing code:

    <%
    Dim rsGetInvoiceContact
    Dim rsGetInvoiceContact_numRows

    Set rsGetInvoiceContact = Server.CreateObject("ADODB.Recordset")
    rsGetInvoiceContact.ActiveConnection = MM_conn_to_EFACs_STRING_ap
    rsGetInvoiceContact.Source = "SELECT * from "& ActinicPersons &" p WHERE p.[Contact ID] = " + Replace(rsGetInvoiceContact__vInvoiceID, "'", "''") + ""
    rsGetInvoiceContact.CursorType = 0
    rsGetInvoiceContact.CursorLocation = 2
    rsGetInvoiceContact.LockType = 1
    rsGetInvoiceContact.Open()

    rsGetInvoiceContact_numRows = 0
    %>

    With the below connection string:

    Dim MM_conn_to_EFACs_STRING_ap
    MM_conn_to_EFACs_STRING_ap = "dsn=DSNefacsdb2;uid=IUSR_RFS01;pwd=Splendid01;"

    The error show after running the script:

    [Microsoft][ODBC SQL Server Driver][SQL Server]OLE DB provider 'MSDASQL' reported an error. The provider did not give any information about the error.

    /Sales/order_entry.asp, line 55

    When running the script against the local database it works as I want it, I have adjusted all the permissions on the other database for the user IUSR_RFS01, but still no joy!

  2. #2
    Join Date
    Jan 2008
    Location
    Florida
    Posts
    1,227
    Is there a reason you don't want to use a DSN-less connection?

  3. #3
    Join Date
    Jan 2011
    Posts
    60
    No not at all, I just want a connection that will connect up to the database, using DSN or not just doesn't seem to work

  4. #4
    Join Date
    Jan 2008
    Location
    Florida
    Posts
    1,227
    Set Conn=Server.CreateObject("ADODB.Connection")
    Conn.Open "PROVIDER=SQLOLEDB;" & _
    "DATA SOURCE=DATABASEIPADDRESS;DATABASE=DATABASENAME;" & _
    "USER ID=DATABASEUSERNAME;PASSWORD=DATABASEPASSWORD"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles