[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Runtime error '-2147467259' [Mcrosoft] [ODBC Driver Manager] Data Source name not found and no default driver specified.

Posted on 2006-05-13
4
Medium Priority
?
1,712 Views
Last Modified: 2013-12-03


I have one database called test_project in my local sql server and sql server authetication to this local database as
below
                Server : (local)
               username : sa
               password :    
   
password i leave it as "blank password" while installing the sql server.

My program ini file as below

 
Main DB=Driver={SQL Server};Server=local;Database=test_project ;Uid=sa;Pwd=;

I have encountered some error while running the application however i have configured the system DSN successfully.

Pls help.
                   
0
Comment
Question by:nyee84
  • 2
4 Comments
 
LVL 6

Expert Comment

by:junglerover77
ID: 16677033
Are you using ADO?

What's the usage of your INI file? It looks like a connection string. If so, the connection should be:

Provider=MSDASQL.1;Persist Security Info=False;Data Source=xxx;Uid=sa;Pwd=;

xxx should be the name of your successfully configured system DSN.
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 16677164
You connection string is attempting to use the ODBC driver, which you probably don't want to be doing as it is much slower than the OLEDB dirvers. Secondly, "local" needs to be enclosed in brackets when referring to a SQL Server.

Try changing your connection string to:

    Provider=SQLOLEDB.1;Server=(local);UID=sa;PWD=;
0
 
LVL 17

Accepted Solution

by:
inthedark earned 2000 total points
ID: 16677173
Microsoft advise the use of the UDL Wizzard in order to create your connection string.

It is very easy to use, and it proves your connection is OK. The following link shows how to create a UDL file.

http://support.microsoft.com/kb/q264691/


So once you have created an empty text file, then renamed as x.udl, just double click on the file and the UDL Wizzard starts running.  Click on the Providers tab and select theProvider for  SQL Server.  (If you don't have a provider it means that you did not install the data access components when you installed VB.)

Once you have selected the provider, click next and enter the datails of the sql server database.  There is a test button which checks that the connection is OK.

Once you have a UDL file, a cute thing to do is to open the file and load the provider details into your software.  In this way you can change your SQL server without having to change your code. (You need to employ a few tricks to do this as the file is saved as unicode.)

Once the connection is tested I edit the file using notepad and change the password, like %PASSWORD%.  In your code you can replace the %PASSWORD% token for the correct password.

Hope this helps~:)
0
 
LVL 17

Expert Comment

by:inthedark
ID: 16677179
Further it is a good idea to create a special user in SQL the server and not to rely on Windows authentication.  This is becuase sometimes your application may be running as an unauthenictaed user, say if it is a web application.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month18 days, 3 hours left to enroll

830 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