Using ADO Connection Strings in InTouch SQL Access

 

InTouch SQL Access Manager is an inherent feature of the product that allows InTouch to interact with relational databases – i.e., reading data out of a database such as recipe parameters or work order information, and storing data such as quality checks or production data.  SQL Access Manager is an ODBC (Open Database Connectivity) compliant application that communicates with any database system, provided the database has an ODBC driver available for it, which needs to be loaded and configured on the InTouch PC.  ODBC is a Microsoft standard for accessing databases. It was the first such standard, and dates back to Windows 3.x.  The ODBC driver(s) need to be configured using the Microsoft ODBC Administrator program to set up the links between the ODBC-compliant application and the database.

 

OLE-DB is an updated Microsoft standard created for Microsoft's 32-bit platforms. OLE-DB was designed to be faster, more efficient, and most of all, more stable than ODBC.  To make OLE-DB easier for developers using high-level languages such as InTouch scripting, VBScript, etc, ADO was created.  ADO (ActiveX Data Objects) provides a simplified mechanism for accessing OLE-DB databases.  ADO is the current programming interface from Microsoft that is designed as "the" Microsoft standard for data access.  ADO provides a simplified mechanism for accessing databases.  From a Wonderware InTouch perspective, its main advantages over ODBC are:

  1. Speed

  2. No ODBC set required on each InTouch PC (complete database connectivity information is contained within the InTouch application)

The only change that needs to be made to an InTouch application using SQL Access is the connection string in the SQLConnect() function.  An example ODBC SQLConnect() statement against a SQL Server database might look as follows:

 

       SQLConnect(ConnectionID, “DSN=ProductionDB;UID=wwAdmin;PWD=wwAdmin”);

 

Using an ADO, the connection string parameter no longer references an ODBC DSN (Data Source Name), but rather the connection parameters implicitly – i.e., contained within the connection string in InTouch.  Using OLE-DB to connect to your SQL Server database is as simple as changing your connection string to the include following

 

Provider = SQLOLEDB

Data Source = SERVER NAME

User ID = USERID

Password = PASSWORD

Initial Catalog = DB NAME

 

For example, to connect to the RUNTIME database on the MS SQLServer named PlantServer, the following SQLConnect() statement would be used:

 

SQLConnect(ConnectionID, “Provider=SQLOLEDB.1;Password=wwAdmin;Persist Security Info=True;User ID=wwadmin;Initial Catalog=RUNTIME;Data Source=PlantServer”);

 

The following table shows a few examples of commonly used ADO connection strings:

 

Provider

Connection String

ODBC

Provider=MSDASQL.1;Password=PWD;Persist Security Info=True;User ID=UID;Data Source=TheDSN;Initial Catalog=TheDB

ORACLE

Provider=MSDAORA.1;Password=PWD;User ID=UID;Data Source=OrServer;Persist Security Info=True

SQL Server

Provider=SQLOLEDB.1;Password=PWD;Persist Security Info=True;User ID=UID;Initial Catalog=TheDATABASE;Data Source=SQLServer

Jet 3.51 *

Provider=Microsoft.Jet.OLEDB.3.51;Password=myPWD;Persist Security Info=True;User ID=myUID;Data Source=MyDB.mdb

Jet 4.0  *

Provider=Microsoft.Jet.OLEDB.4.0;Password=myPWD;Persist Security Info=True;User ID=myUID;Data Source=C:\NWIND.MDB

* MS Access

 

Used in an Application-On Startup script, the code would be as follows:

To learn more, feel free to contact our technical support team!

 

 

©2003 Q-mation, Inc. All rights reserved. All trademarks are the property of their respective owners.