Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2006
    Location
    Ireland
    Posts
    8

    Red face Unanswered: SQL-DMO - Problem connecting to remote database

    I'm trying to establish a connection to a Remote SQL Server database

    Using: VBScript

    Code:
    Dim oServer
    Set oServer = CreateObject("SQLDMO.SQLServer")
    tConnection = "\\" & REMOTE_IP & "\" & REMOTE_GROUP
    
    oServer.AutoReConnect = False ' this allows the disconnect event to be trapped
    oServer.LoginSecure = True
    oServer.LoginTimeout = 100
    oServer.Databases = REMOTE_DATABASE
    oServer.Connect tConnection, REMOTE_USERNAME, REMOTE_PASSWORD

    What am I doing wrong?

    All I get is:
    "An unhandled exception.." etc

    I have:-

    Code:
    Private Sub oServer_RemoteLoginFailed( Severity, _
    MessageNumber, _
    MessageState, _
    Message )
    but the process is not getting there

    Any ideas on the syntax - or another forum if I might get better results there!

    I'm trying to test the code on an XP machine, ultimately the script will be running on NT/2000 boxes.

    SQLDMO appears to be installed on my box (loads of entries in the registry) but I can't find some of the 'required' DLL/RLL files as specified in How to distribute and how to install SQL-DMO for SQL Server 2000

    Does anyone know where to find these files or can provide me with an SQLDMO distribution package?

    Language: VBScript
    Platform: XP (eventually NT/2000)
    SQL-DMO: Installed (entries in registry)

    Thanks
    J.

    x-post: Forums: VBScript, Visual Basic, SQL Server, MS SQL
    Last edited by jalford12; 03-09-06 at 07:41.

  2. #2
    Join Date
    Mar 2006
    Location
    Ireland
    Posts
    8

    Slight changes

    OK, I've changed this a bit, but still not connecting:

    Code:
    tConnection = "\\" & REMOTE_IP & "\" & REMOTE_GROUP
    oServer.AutoReConnect = False        ' allow event to be trapped
    oServer.LoginSecure = False            ' use provided username and password
    oServer.LoginTimeout = 100
    oServer.Connect tConnection, REMOTE_USERNAME, REMOTE_PASSWORD

    Err.Number: 20482
    Err.Description: [SQL-DMO]This server object is not connected.

    J.
    Last edited by jalford12; 03-09-06 at 10:06.

  3. #3
    Join Date
    Mar 2006
    Location
    Ireland
    Posts
    8

    Question SQL-DMO - Problem connecting to remote database

    I'm trying to establish a connection to a remote SQL Server database

    Using: VBScript

    Code:
    Dim oServer
    Set oServer = CreateObject("SQLDMO.SQLServer")
    
    tConnection = "\\" & REMOTE_IP & "\" & REMOTE_GROUP
    oServer.AutoReConnect = False ' this allows the disconnect event to be trapped
    oServer.LoginSecure = False
    oServer.LoginTimeout = -1
    oServer.Connect tConnection, REMOTE_USERNAME, REMOTE_PASSWORD
    What am I doing wrong?

    All I get is:
    "An unhandled exception.." etc

    I have:-

    Code:
    Private Sub oServer_RemoteLoginFailed( Severity, _
    MessageNumber, _
    MessageState, _
    Message )
    but the process is not getting there

    Any ideas on the syntax?

    I'm trying to test the code on an XP machine, ultimately the script will be running on NT/2000 boxes.

    SQLDMO appears to be installed on my box (loads of entries in the registry) but I can't find some of the 'required' DLL/RLL files as specified in How to distribute and how to install SQL-DMO for SQL Server 2000

    Does anyone know where to find these files or can provide me with an SQLDMO distribution package?

    Language: VBScript
    Platform: XP (eventually NT/2000)
    SQL-DMO: Installed (entries in registry)

    Thanks
    J.

    x-post: Forums: VBScript, Visual Basic, SQL Server, MS SQL
    Last edited by jalford12; 03-09-06 at 07:40.

  4. #4
    Join Date
    Mar 2006
    Location
    Ireland
    Posts
    8

    SQL-DMO - Problem connecting to remote database

    I'm trying to establish a connection to a Remote SQL Server database


    Code:
        Dim oServer
        Set oServer = CreateObject("SQLDMO.SQLServer")
        tConnection = "\\" & REMOTE_IP & "\" & REMOTE_GROUP
    
        oServer.AutoReConnect = False               ' this allows the disconnect event to be trapped
        oServer.LoginSecure = False
        oServer.LoginTimeout = -1
        oServer.Connect tConnection, REMOTE_USERNAME, REMOTE_PASSWORD
    Connecting locally doesn't work either...

    Code:
        tConnection = "(local)" & "\" & REMOTE_GROUP
    What am I doing wrong?

    All I get is:
    "An unhandled exception.." etc

    I have:-

    Code:
    Private Sub oServer_RemoteLoginFailed( Severity, _
                                           MessageNumber, _
                                           MessageState, _
                                           Message )
    but the process is not getting there

    Language: VBScript
    Platform: XP (eventually NT/2000)
    SQL-DMO: Installed (entries in registry)

    Thanks

    x-post: Forums: VBScript, Visual Basic, SQL Server

  5. #5
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Quote Originally Posted by jalford12
    OK, I've changed this a bit, but still not connecting:

    Code:
    tConnection = "\\" & REMOTE_IP & "\" & REMOTE_GROUP
    oServer.AutoReConnect = False        ' allow event to be trapped
    oServer.LoginSecure = False            ' use provided username and password
    oServer.LoginTimeout = 100
    oServer.Connect tConnection, REMOTE_USERNAME, REMOTE_PASSWORD

    Err.Number: 20482
    Err.Description: [SQL-DMO]This server object is not connected.

    J.
    The code looks OK.

    As a test, try commenting out the first line & hard code the tConnection string. You may have an unexpected character or space on REMOTE_IP or REMOTE_GROUP.

    Also, give it a try without the leading "\\"
    Last edited by loquin; 03-09-06 at 11:21.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

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