LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Help, Cannot connect to ODBC database using SQL Toolkit!

Solved!
Go to solution

Hello All,

 

I am toying around with the SQL Toolkit evaluation (2.2 + the patch) and I am having difficulty.

 

I ran the example program "connect" and it seems to work fine.

 

However, I try to write my own program and I keep getting the same message:

"Function DBConnect: (return value == -10 [0xFFFFFFF6]).

Native error code - 2147467259 0x80004005

 

The message differs from time to time, but the return value is constant.

 

I am using both Microsoft SQL Server 2012 and MySQL.

 

For MySQL I have installed the latest ODBC connector, 5.3.4. Inside the Control Panel/Data Sources(ODBC), I have a DSN named test_mysql in both User DSN and System DSN.

I ran a test on the connection and the test passes. I am not sure if I should use the ansi or unicode driver, I have tried both with the same success.

 

I am not sure I had configured the SQL Server connection properly, and will attempt that again.

 

My CVI Code is simple enough:

 

hdbc = DBConnect ("DSN=test_mysql"); 

 

Every time I get a -10 from DBConnect. Either I have something configured wrong or I am missing something.

 

Does anyone have any suggestions?

Veni Vidi Duci
0 Kudos
Message 1 of 3
(5,035 Views)

Update:

 

I have tried both Microsoft SQL Server ODBC and MySQL ODBC DSN names.

Neither work with the ToolKit.

 

I have verified the connections in the Data Source manager.

 

I used the example code supplied by the toolkit and replaced the DSN name with my DSN in the Data Source manager.

 

My error code says "The specified DSN contains an architecture mismatch between the Driver and Application"

 

I get this for both MySQL and SQL Server. This is not right.

 

Any advice would be appreciated, I am in a pinch.

Veni Vidi Duci
0 Kudos
Message 2 of 3
(5,004 Views)
Solution
Accepted by topic author DB_IQ

Update 2:

After getting off the phone with Tech Support the problem has been identified!

 

LabWindows SQL toolkit requires 32 bit DNS. My PC is a 64 bit, so my DNS manager defaulted to 64 bit.

I needed to use the 32 bit DNS manager when working with the toolkit.

Once I created my DNS connections using the 32-bit version of the ODBC Datga Source manager, everything worked fine.

 

See this tech note:

http://digital.ni.com/public.nsf/allkb/E7984C0DA0F0E65086257694005B4CB7

 

Veni Vidi Duci
0 Kudos
Message 3 of 3
(4,998 Views)