Configuring a database interface with IWS is basically linking tasks from IWS (Alarms, Events or Trends) to tables of external databases via a specific Database Provider that supports the database you have chosen.
Each history task (Alarm, Events or Trend) can be configured to save data either to files with the proprietary format from IWS or to external SQL Relational Databases. Use the Options tab to configure the database to save Alarm and Event history. (See the Trend Folder for instructions for saving history for the trend tasks.)
IWS supports ADO.NET to provide an intuitive, simple, flexible and powerful interface with standard technologies from MDAC (Microsoft Data Access Components) such as OLE-DB (Object Linking Embedded — Database) and ODBC (Open Database Connectivity). By using this capability, you can connect to any database that is MDAC compatible (please see the Conformance Table for the list of databases already tested)
Using its embedded database interface, IWS can easily provide data from the plant floor to third-party systems (e.g., ERP) or get data from them.
Database | Database Version | ADO.NET Provider | Assembly Version |
---|---|---|---|
Microsoft SQL Server 2000 | 8.0 | System.Data.SqlClient | 1.0.5000.0 |
Microsoft Access 2000 | 9.0.3821 SR-1 | System.Data.OleDbClient | 1.0.5000.0 |
Microsoft Excel 2000 | 9.0.3821 SR-1 | System.Data.OleDbClient | 1.0.5000.0 |
Oracle | 10g Release 1 for Windows | System.Data.OracleClient | 1.0.5000.0 |
Sybase | Anywhere 9.0.1.1751 | iAnywhere.Data.AsaClient | 9.0.1.1751 |
MySQL | 4.0.20a | ByteFX.MySqlClient | 0.7.6.15073 |
A SQL Relational Database is a set of information stored in tables with fields and registers, which support SQL commands.
IWS uses Database Providers (ADO.NET) to interface with SQL Relational Databases. Database Providers are libraries developed to access data from different databases through SQL commands. The ADO.NET Provider for a specific database can be supplied by the operating system or by the database manufacturer.
The previous picture shows some of the most popular ADO.NET Providers for databases. Notice that the Microsoft ADO.NET Provider for ODBC Drivers allows you to access the database through an ODBC driver. See Database Appendix A: Using ODBC Databases for information about how to use this provider. It is also possible that you do not have an ADO.NET provider, but an OLE DB provider is available. By using the Microsoft ADO.NET Provider for OLE DB you can get access to the database; the Microsoft Jet OLE DB provider gives access to applications in the Microsoft Office package by using this approach.
Although most projects typically link to only one type of database, IWS gives you the flexibility to link each task to a specific database supported by a Database Provider. Furthermore, by using this architecture, you do not need to worry about the specific characteristics of each database (it is mostly handled by the Database Provider for each database or by the IWS Database Gateway interface). Therefore, the project settings are mostly uniform, regardless of the specific database chosen by you.
The project is running on the Server station (where InduSoft Web Studio or CEView is installed). The project can communicate with the IWS Database Gateway (running in a remote computer) via TCP/IP. The Gateway implements the interface with the Database through the Database Provider available in the computer where it is running.
The Studio Database Gateway does not require complex configuration. Just copy the files STADOSvr.exe and StADOSrv.ini from the \BIN sub-folder of IWS and paste them under any directory of the computer that will be used as the Gateway station and execute the STADOSvr.exe program. There are advanced settings associated with the IWS Database Gateway, but they should be changed only under special circumstances. See Studio Database Gateway for information on how to configure the IWS Database Gateway advanced settings.
STADOSvr.exe Port Number
Example: STADOSvr 3998
The Studio Database Gateway is a TCP/IP server that interacts with databases using the Microsoft .Net Framework. It can run on the same computer that is running the IWS project, or on a different computer. The Database Gateway Host in the Advanced Settings (see Database Configuration dialog) specifies whether the gateway will be running on the local computer or not. If you are using the local computer you should enter either localhost or 127.0.0.1 in the Host name. You do not need to worry about starting or stopping the gateway because it will be done automatically by IWS tasks. On the other hand, when running the gateway remotely, you need to start the gateway manually. To do so, copy the files StADOSvr.exe and StADOSvr.ini from the \BIN folder to the remote computer, and then execute the StADOSvr.exe.
Any failure that occurs during operations with databases will be displayed both in this window and also in the LogWin window. The messages are reported by exceptions generated by the ADO.NET Provider. (Please refer to Database Troubleshooting for more information about error messages in the gateway module.)
Section of .INI File | Parameter | Accepted Values | Description |
---|---|---|---|
Providers | SaveMSec | 1 : Disable 2 : Enable 3 : Separate Column | This setting specifies the default behavior for the provider when saving milliseconds. The default can be changed on the Advanced Settings in the Database Configuration Dialogs. |
Assembly | Any string that contains a .Net Framework assembly | Assembly option for all providers. The assembly has all the classes required to interface with the database. Most of the providers are inside the System.Data assembly. | |
ConnectionClass | Any connection class inside the assembly | The Connection Class is the one that implements the System.Data.IDbConnection interface. | |
DateAdapterClass | Any data adapter class inside the assembly | The Data Adapter class is used on operations where updates to the database are necessary. It must be compatible with the connection class specified and it should implement IDbDataAdapter. | |
CommandBuilderClass | Any command builder class inside the assembly | The Command Builder class is also responsible for updates on databases. It must be compatible with the connection class. | |
Provider | Name of the provider | One of the parameters in the connection string is the "Provider". The Studio ADO Gateway compares the value on the connection string with the value for this parameter in each provider and defines the proper one to be used. | |
ColumnDelimiterPrefix | Any character or group of characters | Specify a character that will be placed before column names on SQL statements | |
ColumnDelimiterSuffix | Any character or group of characters | Specify a character that will be placed after column names on SQL statements | |
TableDelimiterPrefix | Any character or group of characters | Specify a character that will be placed before table names on SQL statements | |
TableDelimiterSuffix | Any character or group of characters | Specify a character that will be placed after table names on SQL statements | |
ValueString | Any string | This value indicates how constant values are identified on SQL statements. For Microsoft SQL databases for instance, the value should be @Value, for ODBC question mark (?) | |
ValueStringPrefix | Any string | This value indicates a prefix to be used before the values. Oracle values, for instance, require the prefix. The SQL statements use value identifiers by using their prefixes, but the parameters in the Connection class do not use the prefix. | |
ValueAddNumber | 0 or 1 | Indicates whether a sequential number should be added to the ValueString to identify the parameter or not. For Microsoft SQL database, this parameter should have the value 1, because parameters are identified by using @Value1, @Value2, …, @ValueN. For ODBC, this parameter should be 0. | |
BoolType | Any string representing a valid data type for the database | When trying to create columns to store boolean values, the data type specified on this parameter will be used. You need to make sure that the data type specified is able to save boolean values. | |
IntegerType | Any string representing a valid data type for the database | When trying to create columns to store integer values, the data type specified on this parameter will be used. You need to make sure that the data type specified here is able to store 32 bit values. | |
RealType | Any string representing a valid data type for the database | When trying to create columns to store real values, the data type specified on this parameter will be used. You need to make sure that the data type specified here is able to store 64 real values. | |
StringType | Any string representing a valid data type for the database | When trying to create columns to store string values, the data type specified on this parameter will be used. You need to make sure that the data type specified is able to save the number of characters that you are willing to save on your project. | |
TimeStampType | Any string representing a valid data type for the database | When trying to create columns to store TimeStamp values, the data type specified on this parameter will be used. | |
EnableTop | 0 or 1 | When this field is set to 1, the ADO will place the TOP in the SQL statement to limit the amount of registers required. | |
SingleConnection | 0 or 1 | When this field is set to 1, the ADO will open only one connection with the database, regardless of how many tasks or computers are requesting services from it. The synchronization between the tasks will be performed by the gateway, and they will not be able to be executed simultaneously if this option is enabled. | |
Communication | TimeOut | 2 | Time out to perform insert and update operations |
LongTimeOut | 5 | Time out to perform connection and query updates | |
SyncTimeOut | 60 | Time out to perform synchronization | |
Connection | RegBufSize | 128 | Size of the internal buffer used by the database API. |
[Providers] DefaultSaveMSec=3 DefaultAssembly=System.Data DefaultConnectionClass=System.Data.OleDb.OleDbConnection DefaultDataAdapterClass=System.Data.OleDb.OleDbDataAdapter DefaultCommandBuilderClass=System.Data.OleDb.OleDbCommandBuilder DefaultValueString=@Value DefaultValueAddNumber=1 DefaultBoolType=INTEGER DefaultIntegerType=INTEGER DefaultRealType=REAL DefaultStringType=VARCHAR(255) DefaultTimeStampType=DATETIME DefaultSingleConnection=0
Count=5
Count=7 Provider1=MICROSOFT.JET.OLEDB SaveMSec1=3 ColumnDelimiterPrefix1=[ ColumnDelimiterSuffix1=] SingleConnection1=1 Provider2=SQLOLEDB ConnectionClass2=System.Data.SqlClient.SqlConnection DataAdapterClass2=System.Data.SqlClient.SqlDataAdapter CommandBuilderClass2=System.Data.SqlClient.SqlCommandBuilder ColumnDelimiterPrefix2=[ ColumnDelimiterSuffix2=] TableDelimiterPrefix2=[ TableDelimiterSuffix2=] RealType2=FLOAT Provider3=MSDASQL ConnectionClass3=System.Data.Odbc.OdbcConnection DataAdapterClass3=System.Data.Odbc.OdbcDataAdapter CommandBuilderClass3=System.Data.Odbc.OdbcCommandBuilder ValueString3=? ValueAddNumber3=0 StringType3=VARCHAR(128) EnableTop3=0 Provider4=ORAOLEDB Assembly4=System.Data.OracleClient ConnectionClass4=System.Data.OracleClient.OracleConnection DataAdapterClass4=System.Data.OracleClient.OracleDataAdapter CommandBuilderClass4=System.Data.OracleClient.OracleCommandBuilder ValueString4=Value ValueAddNumber4=1 ValueStringPrefix4=: BoolType4=Number(1) IntegerType4=Number(10) RealType4=Number StringType4=VARCHAR(255) TimeStampType4=TIMESTAMP(0) EnableTop4=0 Provider5=ASAPROV Assembly5=iAnywhere.Data.AsaClient ConnectionClass5=iAnywhere.Data.AsaClient.AsaConnection DataAdapterClass5=iAnywhere.Data.AsaClient.AsaDataAdapter CommandBuilderClass5=iAnywhere.Data.AsaClient.AsaCommandBuilder ValueString5=? ValueAddNumber5=0 ColumnDelimiterPrefix5=[ ColumnDelimiterSuffix5=] TableDelimiterPrefix5=[ TableDelimiterSuffix5=] Provider6=MYSQLPROV Assembly6=ByteFX.MySqlClient ConnectionClass6=ByteFX.Data.MySqlClient.MySqlConnection DataAdapterClass6=ByteFX.Data.MySqlClient.MySqlDataAdapter CommandBuilderClass6=ByteFX.Data.MySqlClient.MySqlCommandBuilder ValueString6=@Value ValueAddNumber6=1 StringType6=VARCHAR(128) EnableTop6=0 Provider7=MSDAORA Assembly7=System.Data.OracleClient ConnectionClass7=System.Data.OracleClient.OracleConnection DataAdapterClass7=System.Data.OracleClient.OracleDataAdapter CommandBuilderClass7=System.Data.OracleClient.OracleCommandBuilder ValueString7=Value ValueAddNumber7=1 ValueStringPrefix7=: BoolType7=Number(1) IntegerType7=Number(10) RealType7=Number StringType7=VARCHAR(255) TimeStampType7=TIMESTAMP(0) EnableTop7=0