Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2003
    Location
    The Netherlands
    Posts
    149

    Angry Unanswered: Connect with ADODB to sqlanywhere 9

    I'm calling the following routine:

    Sub OpenUmmSybase
    Set sobjUmmConnSybase = CreateObject("ADODB.Connection")
    'sobjUmmConnSybase.ConnectionString = "DSN=Umm;UID=dba;PWD=sql;"
    sobjUmmConnSybase.ConnectionString = "UID=dba;PWD=sql;ENG=umm;DBF=C:\Builds\UFM\6.01.00 .40603\Data\Demo\ASA9\umm.db;CS=cp850"
    sobjUmmConnSybase.Open
    End Sub

    I get the following error-message:

    ---------------------------
    Windows Script Host
    ---------------------------
    Script: C:\Builds\OneLogin\GetBuild.vbs
    Line: 116
    Char: 2
    Error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    Code: 80004005
    Source: Microsoft OLE DB Provider for ODBC Drivers

    ---------------------------
    OK
    ---------------------------


    Does anyone have an idea why i get this message?

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    You didn't specify the driver? Check KB#147875 for more details.

    -PatP

  3. #3
    Join Date
    Jan 2003
    Location
    The Netherlands
    Posts
    149

    Talking it works!

    ok thanx, i use the following code now:

    Sub OpenUmmSybase
    Set sobjUmmConnSybase = CreateObject("ADODB.Connection")
    sobjUmmConnSybase.ConnectionString = "DSN=GETBUILD;UID=dba;PWD=sql;"
    sobjUmmConnSybase.Open
    End Sub

    Sub AddUltimoLogin( sstrLocalDb, sstrAsaVersion)
    Dim objUSER, strUserName, sstrReg, sstrDriver
    ' Create ODBC entry
    sstrReg = "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\GETBUIL D"
    On Error Resume Next
    WshShell.RegDelete sstrReg
    On Error GoTo 0

    If sstrAsaVersion = "9" Then
    sstrDriver = "C:\\Program Files\\Sybase\\SQL Anywhere 9\\win32\\dbodbc9.dll"
    Else
    sstrDriver = "C:\\Program Files\\Sybase\\Adaptive Server Anywhere 6.0\\win32\\dbodbc6.dll"
    End If

    WshShell.RegWrite sstrReg & "\Driver", sstrDriver, "REG_SZ"
    WshShell.RegWrite sstrReg & "\DatabaseFile", sstrLocalDb, "REG_SZ"
    WshShell.RegWrite sstrReg & "\AutoStop", "Yes", "REG_SZ"
    WshShell.RegWrite sstrReg & "\Integrated", "No", "REG_SZ"
    WshShell.RegWrite sstrReg & "\Compress", "NO", "REG_SZ"

    OpenUmmSybase

    Set objUSER = CreateObject("ADODB.Command")
    'Set objSUSER = CreateObject("ADODB.Recordset")
    objUSER.ActiveConnection = sobjUmmConnSybase
    'objSUSER.CommandText = _"set temporary option ANSI_UPDATE_CONSTRAINTS='OFF'"
    objUSER.CommandText = "GRANT DBA, CONNECT TO ULTIMOLOGIN IDENTIFIED BY OMITLU"
    objUSER.Execute

    sobjUmmConnSybase.Close
    End Sub

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Does that work ?!?!

    -PatP

Posting Permissions

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