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

Recommended Answers

All 3 Replies

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!

Thanks JasonHippy! You were correct................
Its working now :D

No probs, glad to be of assistance.
Might be an idea to mark the thread as solved though! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.