Learn how to a build a cloud-first strategyRegister Now


Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Posted on 2004-11-19
Medium Priority
Last Modified: 2013-12-03
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
      oCONN.Open Conn_SQLConnectionString
      ErrNum = Err.Number
      ErrStr = "Open: " & Err.Description

      If ErrNum = 0 Then
        gb_IsConnected = True
        ErrStr = "Database unavailable"
      End If
    end if
  End Sub

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.
Question by:JeffStone
  • 5
  • 2
  • 2
  • +1
LVL 16

Expert Comment

ID: 12627108
Why not use Provider=SQLOLEDB;? You are trying to use the ODBC driver, which requires an ODBC DSN to be set up. Just change provider to SQLOLEDB, and Data Source to the name of the SQL Server, and you should be up and running.

Author Comment

ID: 12627882
thanks ...
but no closer same error: Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

The connectionstring now looks like:
Conn_SQLConnectionString = "Provider=SQLOLEDB;Persist Security Info=False;Data Source=LOCAL;Initial Catalog=BenefitsPortal;User id=AAAA;PASSWORD=ZZZZZ;"

LVL 18

Expert Comment

ID: 12628040
try this:

Conn_SQLConnectionString = "Provider=SQLOLEDB;Persist Security Info=False;Data Source=(LOCAL);Initial Catalog=BenefitsPortal;User id=AAAA;PASSWORD=ZZZZZ;"

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.


Author Comment

ID: 12628223
Thanks ...
It looks like the only diference is () around LOCAL, did it with the same result ...
LVL 18

Expert Comment

ID: 12628324
Same error msg ?

Author Comment

ID: 12628605
yup ... same error message
LVL 33

Accepted Solution

CarlWarner earned 1500 total points
ID: 12628844

Author Comment

ID: 12629334
Thanks to CarlWarner his link worked ... why is another question ... so this has transformed into this

This works:
oConn.Open "Provider=sqloledb;" & _
           "Data Source=(local);" & _
           "Initial Catalog=qqqqq" & _
           "User ID=aaaa;" & _

but this did not ...
Conn_SQLConnectionString = "Provider=sqloledb;Data Source=(local);Initial Catalog=qqqqq;User Id=aaaa;Password=zzzzz;"
oCONN.Open Conn_SQLConnectionString

Curious and curiousor ....
Thanks to all whom replied.  Very much appreciated.
LVL 33

Expert Comment

ID: 12629488
You're welcome.

Is it simply the trailing semi-colon?

Author Comment

ID: 12629736
nice catch, but I just tried to removed it and it still gave the same error ...
so this shall remain a mystery i guess as I have spent far too much time on this.

Thanks again

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question