By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,795 Members | 1,216 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,795 IT Pros & Developers. It's quick & easy.

ERROR [IM002] [Microsoft][ODBC Driver Manager]

P: n/a
I wrote a program with c# for connecting mysql and taking data from it
but when someone without me try to execute the program they are taking
this error
ERROR [IM002] [Microsoft][ODBC Driver Manager]
Data source name not found and
no default driver
is this somethin about odbc driver does every machine must have odbc
driver or just the mysql server machine?
Thanks
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
ODBC requires a driver in order to access a database. Although it's a bridge
between your application and a database, it needs to know what database it's
talking too.

take a look here:
http://www.able-consulting.com/MDAC/...DriverForMySQL

[beware of line wraps]

Hope that helps.

Dan.

"Dakkar" <da****@sylveria.gen-dot-tr.no-spam.invalid> wrote in message
news:42********@127.0.0.1...
I wrote a program with c# for connecting mysql and taking data from it
but when someone without me try to execute the program they are taking
this error
ERROR [IM002] [Microsoft][ODBC Driver Manager]
Data source name not found and
no default driver
is this somethin about odbc driver does every machine must have odbc
driver or just the mysql server machine?
Thanks
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 16 '05 #2

P: n/a
I think its because i didnt make the dsn is a system dsn but i dont
know how can i do it can somebody help me?

here is my connection code
MyCmd = new OdbcCommand();
MyConn = new OdbcConnection("DRIVER={MySQL ODBC 3.51
Driver};" + "SERVER=139.179.149.238;" +
"DATABASE=account;" + "UID=root;" +
"PWD=root;" + "OPTION=3;");
MyConn.Open();
MyCmd.Connection = MyConn;

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #3

P: n/a
Jakka,

You don't need a DSN (data source name) because you've wrapped up the server
address, driver and database details in your connect string.

What a DSN does allow you to do though, is to move this logic into system
settings so that all you need do is specify a DSN name, and the other
details here are not required (driver included). Another huge benefit is the
ability to test a DSN connection before you even use the connection in your
code.

To create a DSN for your connection, go to "Start->Control
Panel->Administrative Tools->Data Sources(ODBC)".
There's a System DSN tab there for DSN's that any user that logs on can
access.
Click Create New... the rest is quite self explanatory, but let me know if
you've any problems.
At the end of creating the connection there's a "Test" button somewhere that
open and closes the connection for you to decide whether it's valid
configuration.

In your code all you need to do is specify the name of your DSN, plus a uid
and pwd...
http://www.able-consulting.com/MDAC/...BC_DSN.htm#DSN

good luck.

"Dakkar" <da****@sylveria.gen-dot-tr.no-spam.invalid> wrote in message
news:42********@127.0.0.1...
I think its because i didnt make the dsn is a system dsn but i dont
know how can i do it can somebody help me?

here is my connection code
MyCmd = new OdbcCommand();
MyConn = new OdbcConnection("DRIVER={MySQL ODBC 3.51
Driver};" + "SERVER=139.179.149.238;" +
"DATABASE=account;" + "UID=root;" +
"PWD=root;" + "OPTION=3;");
MyConn.Open();
MyCmd.Connection = MyConn;

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com

Nov 16 '05 #4

P: n/a
Dakkar,

Another suggestion on this is to move away from ODBC. A connector to the
MySQL database would be better...

http://www.able-consulting.com/dotne...ETDataProvider

Thanks.

Dan.
"Dan Bass" <Not Listed> wrote in message
news:um**************@TK2MSFTNGP10.phx.gbl...
Dakkar,

You don't need a DSN (data source name) because you've wrapped up the
server address, driver and database details in your connect string.

What a DSN does allow you to do though, is to move this logic into system
settings so that all you need do is specify a DSN name, and the other
details here are not required (driver included). Another huge benefit is
the ability to test a DSN connection before you even use the connection in
your code.

To create a DSN for your connection, go to "Start->Control
Panel->Administrative Tools->Data Sources(ODBC)".
There's a System DSN tab there for DSN's that any user that logs on can
access.
Click Create New... the rest is quite self explanatory, but let me know if
you've any problems.
At the end of creating the connection there's a "Test" button somewhere
that open and closes the connection for you to decide whether it's valid
configuration.

In your code all you need to do is specify the name of your DSN, plus a
uid and pwd...
http://www.able-consulting.com/MDAC/...BC_DSN.htm#DSN

good luck.

"Dakkar" <da****@sylveria.gen-dot-tr.no-spam.invalid> wrote in message
news:42********@127.0.0.1...
I think its because i didnt make the dsn is a system dsn but i dont
know how can i do it can somebody help me?

here is my connection code
MyCmd = new OdbcCommand();
MyConn = new OdbcConnection("DRIVER={MySQL ODBC 3.51
Driver};" + "SERVER=139.179.149.238;" +
"DATABASE=account;" + "UID=root;" +
"PWD=root;" + "OPTION=3;");
MyConn.Open();
MyCmd.Connection = MyConn;

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com


Nov 16 '05 #5

P: n/a
> Dan Basswrote:
Dakkar,

Another suggestion on this is to move away from ODBC. A connector to the MySQL database would be better...

http://www.able-consulting.com/dotne...ETDataProvider
Thanks.

Dan.


Thanks but i need something free this mysqldirect.net is trial and
want money for profesional edition
Doesn anyone have any idea?
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #6

P: n/a
Hi!

Dakkar wrote:
I think its because i didnt make the dsn is a system dsn but i dont
know how can i do it can somebody help me?

here is my connection code
MyCmd = new OdbcCommand();
MyConn = new OdbcConnection("DRIVER={MySQL ODBC 3.51
Driver};" + "SERVER=139.179.149.238;" +
"DATABASE=account;" + "UID=root;" +
"PWD=root;" + "OPTION=3;");
MyConn.Open();
MyCmd.Connection = MyConn;

[...snip...]

Make sure the MySQL ODBC 3.51 Driver is installed on the client machine and
the server can be contacted from the client. As Dan suggested, it is a good
idea to create a system ODBC data source on all client machines (let's call
it MYODBC) encapsulating all the information you provide in your connection
string (maybe except UID and PWD; these should be provided by your
application). So you can connect using something like

myConn = new OdbcConnection("DSN=MYODBC;UID=root;PWD=root;");
myConn.Open();

So, you will most likely encounter less problems on other client machines
(e. g. driver has other version, client uses other database server etc.).
Nov 16 '05 #7

P: n/a
so you re saying if someone out of my computer wants to acces my mysql
they have to have the myodbc 3.51 driver?

So how can i import this driver into my program because i cant say
everyone "Download and install this driver"
Thanks
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
Nov 16 '05 #8

P: n/a
Hi!

Dakkar wrote:
so you re saying if someone out of my computer wants to acces my mysql
they have to have the myodbc 3.51 driver?
Yes. You actually specify what ODBC driver to use in your "connection
string". This is why I suggested creating an ODBC data source with a
specified name. To each client can have another version of the ODBC driver
installed (to some extent, they have to be compatible with what you intend
to do). If there is no ODBC driver for MySql installed, you cannot connect
to MySql using ODBC. That's why Dan suggested using a native way of
connecting to MySql: No ODBC driver needed.
So how can i import this driver into my program because i cant say
everyone "Download and install this driver"


Sorry, that's what you have to do, basically: Ask your users to install the
appropriate ODBC driver on their local machine. This is the only way to go
if you want to use ODBC (unless someone else knows some different
approach...). Think about Dan's suggestion.

[...snip...]
Nov 16 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Browse more C# / C Sharp Questions on Bytes