I am currently writing a script in vbs, that will eventually run via the scheduler.
The script reads in some data, plays with it and then needs to insert some records into a SQL Server database.
I am getting the error: Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Now for the connection string, I am using the same one that is used for a website that is accessing the server:
Conn_SQLConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=LocalServer;Initial Catalog=BatchImport;User Id=AAAA;PASSWORD=ZZZZZ;"
The DataSource is called LocalServer and is a system DSN, in which I was able to test the connection successfully.
Someone had mentioned to me that they didn't like the name LocalServer, even though this is working flawlessly with the website, I did create another DSN with a different name which also successfully connected to the database, but failed w/ the same error from the script.
The code is below and is failing on : oCONN.Open Conn_SQLConnectionString
Private Sub DBRealConnect()
if (ErrNum = 0) then
gb_IsConnected = false
Set oCONN = CreateObject("ADODB.Connection")
oCONN.ConnectionTimeout = 15
oCONN.CommandTimeout = 30
ErrNum = Err.Number
ErrStr = "Open: " & Err.Description
If ErrNum = 0 Then
gb_IsConnected = True
ErrStr = "Database unavailable"
not sure if this matters but here is some other info:
OS: Windows 2000 Server (latest packs / patches)
SQL Server: 2000
Any ideas? All help appreciated.