Sql conecction DAQ

Recommended Posts

I am having difficulty connecting to a SQL SERVER database. 
I have created the ODBC connector in the x32 version
and I am working the DAQFactory in version 5.87.
The sequence to communicate with the server is as follows:

global database
dbase= DB.OpenEx("DSN='Advantech';UID='';PWD='';ODBC;")

but when executing this sequence I get the following error:
01002 Unable to open ODBC database: database Line 3 - 
Uncaught error in sequence database.
Link to comment
Share on other sites

There is no reason to use OpenEx() if you aren't using a password or specifying the driver.  Just use Db.open("Advantech").  Next, make sure you have the same data source name (Advantech) and that that data source can actually get to the database.  Usually the data source configuration has an option to test the connection.  You'll also need to make sure you create it in the proper section.  User DSN's for example are only visible to one user.  Finally, 5.87 is really quite old, probably almost 15 years at this point, and as such may not work with some of the more recent ODBC drivers.  I know that for MySQL you typically have to use the 3.51 ODBC driver.  You might try a different driver.

That all said, the most common error is to accidently create the ODBC data source in the 64 bit version of the ODBC configuration tool.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.