LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error while connecting to MySQL database using DSN

Hi All,
 
I have some problems with connecting to the MySQL database.
 
I have created the dsn as follows..
from control pannel,odbc connection..then user dsn filled in the computer name,username,pwd and db name
Connect option and advanced option(the next two tabs) i havent filled anything.
as i have installed mysql in mypc and so its a local host.Test connection also successful.
 
But i was getting an error when i was trying to open the connection.
using open connection.vi.
 
In the open connection.vi. i gave the dmu.dsn(the name of dsn i created ) for connection information parameter,for userid ,user name to MySQL which is root and the appropriate password also(i tried both wth giving user name and password and also without giving username and password.)
 
TRied by creating user dsn and also system dsn and establishing connection.But i was getting the following error.
 
the error is...
Error -2147467259 occurred at DB Tools Open Connec (String).vi->DB Tools Open Connec (Path).vi->Untitled 1
Possible reason(s):
Exception occured in Microsoft OLE DB Provider for ODBC Drivers: General error: Invalid file dsn 'dmu.dsn' in DB Tools Open Connec (String).vi->DB Tools Open Connec (Path).vi->Untitled 1
 
 
Can anybody help me?
 
 
 
0 Kudos
Message 1 of 9
(8,221 Views)
If I correctly remember the other thread where you were dealing with this issue ( Smiley Mad ) when you created the dsn it tested good, but it doesn't work with the database connectivity toolkit. The problem is that the DCT can't read System or User DSNs it requires a File DSN - as the error message clearly points out. The process for creating a file dsn is the same as for a user or system dsn but you start from the File DSN tab. Once you have it created, that is the file name (path actually) that you need to pass the database VIs.

Mike...

Message Edited by mikeporter on 06-28-2007 10:12 PM


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 9
(8,220 Views)
Thank u sir and sorry for the disturbance caused by my repeted question.
 
I managed to connect to mysql database without using dsn.I created a text file which contains information about the driver,database,server,uid and password and i fed to the connection information of the db tools open connection.vi.the contents from the text file.
Its working and nw can interact with the database.
 
But i will surely try with the File dsn also so if a need arises,i can manage and i can learn a new method also.
 
Thank you so much
 
0 Kudos
Message 3 of 9
(8,211 Views)

hai

 

 check wheather you have installed the MySQL  is installed properly, and ensure in ODBC connection the Driver is added and it is installed correctly, check the server host id and user name password and port id are corect, try reinstalling the MySQL and check once from the MySQL query browser wheather the connection is established. if it is then it should work with the DB Open function. else i will get back with  furthur solutions.

Message 4 of 9
(8,192 Views)
Hello again..
 
I tried by creating file dsn. i tried to create file dsn,as follows..
selected file dsn tab,added MySQL ODBC 3.51 driver,gave the name data to the dsn theh while entering the login information i entered login info ,i gave localhost for servername,root for user name and the password also.It did not allow me to select(the list was empty) the database name as it was giving me the eeror-loading database list not implemented for sql driver connect.Then i clicked ok after typing the database name in the box.After that when i opened the dsn the password column was empty.
 
When i used the dsn with DB tools open connection.vi it gave me the following error...
 
Error -2147467259 occurred at DB Tools Open Connec (String).vi->DB Tools Open Connec (Path).vi->connecttomysql.vi
Possible reason(s):
Exception occured in Microsoft OLE DB Provider for ODBC Drivers: [MySQL][ODBC 3.51 Driver]Access denied for user 'root'@'localhost' (using password: NO) in DB Tools Open Connec (String).vi->DB Tools Open Connec (Path).vi->connecttomysql.vi
 
But for system dsn and user dsn i could complete all information and test connection was also successful.But i need to create a file dsn as both system dsn and user dsn wont work wth DB tools open connection.vi
 
Pls help me regarding this.
0 Kudos
Message 5 of 9
(8,184 Views)
i think that the problem is only in the driver installation,please check the user name and password is correct or not. also the connection ID reference might be the error, in the odbc connection check the particular database is choosen or not. in ODBC data source administrator click that particular driver and press configure fill all the details and check your databse dropbox is showing all the database present in Mysql, try this, otherwise your Mysql driver is not properly installed, try with the other one. if it doesnot work send me reply, i will look forward for the futhur solutions. i strongly feels that this is one driver and configuration issues, we will solve easyly.
Message 6 of 9
(8,179 Views)
you have to uninstall the MySQL and install propely, i dont what version of driver you are using, else i have working version with me, if it is attachable i will send you that one.
Message 7 of 9
(8,177 Views)

ok Thanksss a lot...

But the test connection was successful for user dsn and system dsn and in that cases the database names were also appearing.

But i think labview can deal with file dsn only as the user dsn and system dsn were giving me errors.

Thats why i tried to create file dsn.Dont know what is happening.

Any way i tried to establish a connection wthout using dsn by giving connection information of the DB tools connect as follows

DRIVER=MySQL ODBC 3.51 Driver; DB=dmu; server=Localhost; UID=root; PWD=pwd; OPTION=785

it can connect to my sql.But when executing query i have specify the database name also along with the table name

say....select * from dmu.tab1(tab1 be the table name)So i  changed to Data Source Name instead of DB but still the same.

So any way i have to create file dsn.

I will check the Driver installation is proper as told by u,once again.And if not if possible can u send me the working one pls?

Thanks once again

 

0 Kudos
Message 8 of 9
(8,174 Views)
sure i will send you that one try and tell me.
0 Kudos
Message 9 of 9
(8,169 Views)