From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems opening mysql database connection

I am using the database connectivity tool kit to access a mysql database. The problem we've been having is the very first time a query is run after a period of inactivity it is extremely slow to respond (several minutes). After that the same query and other queries of the same database/table are fast 3-4 seconds. 

 

We've been using the ODBC 5.1 driver but i wanted to switch to OLE DB to see if that would fix the problem. But I havent been able to get it to connect at all. I've searched the https://www.connectionstrings.com/ site and came up with the following:

 

Provider=sqloledb;Data Source=IPaddress, 3306;Initial Catalog=catname;
User Id=user;Password=bla;

 

but i get the error

 

Possible reason(s):
ADO Error: 0x80004005
Exception occured in Microsoft OLE DB Provider for SQL Server: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. in NI_Database_API.lvlib:DB Tools Open Connec (String).vi->db query test.vi

 

Looking in data sources it says SQL server version 6.01.7601.17514

Seems like an old version...maybe the connection string format is different but i havent been able to find it...

 

Anyone know the correct connection string and/or another possible cause of the delay in returning query results?? Thank you.

0 Kudos
Message 1 of 7
(3,619 Views)

Are you talking to mySQL or SQL Server -- that two different products. There are OLE DB drivers for mySQL but you aren't refering to them in the connect string.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

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

For help with grief and grieving.
0 Kudos
Message 2 of 7
(3,612 Views)

Thanks Mike, I think it's mysql. The original connection string was Driver=[mysql odbc 5.1 Driver} . I installed the mysql driver you linked to and tried

 

Provider=MySQLProv;Data Source=mydb;User Id=myUsername;Password=myPassword;

 

but i get

 

 NI_Database_API.lvlib:DB Tools Open Connec (String).vi->db query test.vi<ERR>ADO Error: 0x80004005
Exception occured in Provider: Unspecified error in NI_Database_API.lvlib:DB Tools Open Connec (String).vi->db query test.vi

0 Kudos
Message 3 of 7
(3,605 Views)

is http://cherrycitysoftware.com/ccs/Download/Download.aspx equivalent to the my ole db you linked? 

0 Kudos
Message 4 of 7
(3,601 Views)
0 Kudos
Message 5 of 7
(3,578 Views)
In theory they are, but I have never used the others. The ones from sourceforge I have and they work well.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

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

For help with grief and grieving.
0 Kudos
Message 6 of 7
(3,590 Views)

You can do the following:

 

Create a text document on your desktop and rename it to something like connection.udl

Double click the file

Configure the settings and test the connection

Open up the UDL file in a text editor and it will contain the connection string.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 7 of 7
(3,581 Views)