If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Connect with ADODB to sqlanywhere 9

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-16-04, 06:04
thepercival thepercival is offline
Registered User
 
Join Date: Jan 2003
Location: The Netherlands
Posts: 145
Angry 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?
Reply With Quote
  #2 (permalink)  
Old 06-16-04, 08:23
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
You didn't specify the driver? Check KB#147875 for more details.

-PatP
Reply With Quote
  #3 (permalink)  
Old 06-16-04, 08:27
thepercival thepercival is offline
Registered User
 
Join Date: Jan 2003
Location: The Netherlands
Posts: 145
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
Reply With Quote
  #4 (permalink)  
Old 06-16-04, 10:59
Pat Phelan Pat Phelan is offline
Resident Curmudgeon
 
Join Date: Feb 2004
Location: In front of the computer
Posts: 12,605
Does that work ?!?!

-PatP
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On