Hi Guys,

I am working on converting a console application into a user friendly GUI. The actual application is written in visual C++ and person has no information none what so ever on how to run it. So to understand the technique I am trying to experiment with the application.

The application is a Web Crawler and communicates with the web and fetches the data and stores the info in the database using SQL SERVER 2008.

I have created the database in SQL and without interfearing with the connection string in the algorithm, it is giving me the following error on execution:

ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I am not sure if it is to do with DNS settings as I am not sure on how to set that up?

Here is the code the author has used for the connection string:

string helper::getDbConnString()
{
	return "uid=test;pwd=test;dsn=dnsname";
}

Please advice!

Thanks

Edited 5 Years Ago by rEhSi_123: n/a

If it's ODBC you're using, then it sounds like you need to set up a data source in Windows.

To do this you need to run the administrative tools. The location of this varies from version to version of Windows, but I think if you open up control panel, there should be a link to the administrative tools which should bring up an explorer window with shortcuts to various Windows administration programs.

From the admin tools window you need to run the ODBC Data source administrator tool which is listed as 'Data Sources (ODBC)'

From there you need to add a new data source and follow the steps in the wizard to set up the connection to the SQL server database.

Before you do that, going back to your code, in the string returned by your getDbConnString function, uid is the user ID (set to 'test') for the user of the database, pwd is the users password (also set to 'test') and dsn is the data-source name (set to 'dnsname').

Bearing that in mind, when you set up your ODBC connection in the ODBC Data source administrator, the first thing it asks you for is a name to use to refer to the data source. If you use 'dnsname' as the name for the connection then your program should work.

Basically, the name of the ODBC connection needs to match whatever you've put in the 'dsn=...' part of the connection string.
So if you set up an ODBC connection called mydb, then you'd change the connection string accordingly:

return "uid=test;pwd=test;dsn=mydb";

Hope that helps!

This question has already been answered. Start a new discussion instead.