ODBC And SQL. V4.x 06/30/2005 Document v1.01



Similar documents
ODBC Client Driver Help Kepware, Inc.

Kepware Technologies OPC Quick Client Connectivity Guide

Kepware Technologies KEPServerEX Client Connectivity Guide for GE's Proficy ifix

CIMHT_006 How to Configure the Database Logger Proficy HMI/SCADA CIMPLICITY

2. Unzip the file using a program that supports long filenames, such as WinZip. Do not use DOS.

Jolly Server Getting Started Guide

INTRODUCTION: SQL SERVER ACCESS / LOGIN ACCOUNT INFO:

Sage Intelligence Financial Reporting for Sage ERP X3 Version 6.5 Installation Guide

HOW TO CONFIGURE SQL SERVER REPORTING SERVICES IN ORDER TO DEPLOY REPORTING SERVICES REPORTS FOR DYNAMICS GP

MICROSTRATEGY 9.3 Supplement Files Setup Transaction Services for Dashboard and App Developers

How to Connect to CDL SQL Server Database via Internet

Outlook Profile Setup Guide Exchange 2010 Quick Start and Detailed Instructions

Lab: Data Backup and Recovery in Windows XP

ODBC Driver Version 4 Manual

Crystal Reports Installation Guide

Setting up a database for multi-user access

PrivateWire Gateway Load Balancing and High Availability using Microsoft SQL Server Replication

Migrating helpdesk to a new server

PaperClip Audit System Installation Guide

HansaWorld SQL Training Material

Lab - Data Backup and Recovery in Windows XP

DataLogger Kepware, Inc.

AvePoint Tags 1.1 for Microsoft Dynamics CRM. Installation and Configuration Guide

Suite. How to Use GrandMaster Suite. Exporting with ODBC

ODBC Group Policy Settings

Converting InfoPlus.21 Data to a Microsoft SQL Server 2000 Database

RE:Open for SQL Anywhere. Installation Guide. RE:Open for SQL Anywhere Installation Guide 1

28 What s New in IGSS V9. Speaker Notes INSIGHT AND OVERVIEW

Installing LearningBay Enterprise Part 2

Connecting to Manage Your MS SQL Database

MS SQL Express installation and usage with PHMI projects

Insight Video Net. LLC. CMS 2.0. Quick Installation Guide

Kepware Technologies KEPServerEX OPC Tunnel

Linking Access to SQL Server

WorldShip Export Shipment Data

Setting Up ALERE with Client/Server Data

Define ODBC Database Library using Management Console

1. Open the preferences screen by opening the Mail menu and selecting Preferences...

Unique promotion code

Technical Paper. Defining an ODBC Library in SAS 9.2 Management Console Using Microsoft Windows NT Authentication

Creating a connection using Microsoft Excel 2007, 2010, 2013

Nexio Connectus Cluster Set Up with SQL Server Backend

Advanced Event Viewer Manual

Fax and SMS Quickguide

Installation Instruction STATISTICA Enterprise Small Business

AXIS 70U - Using Scan-to-File

0651 Installing PointCentral 8.0 For the First Time

Tool Tip. SyAM Management Utilities and Non-Admin Domain Users

Migrating a Database from Legi for Windows 2.X to MS Access

Using KEPServerEX OPC Server (Kepware)with the iologik E2210

Implementing Microsoft SQL Server 2008 Exercise Guide. Database by Design

Transferring Your Hosting Account

for Networks Installation Guide for the application on the server August 2014 (GUIDE 2) Lucid Exact Version 1.7-N and later

STATISTICA VERSION 12 STATISTICA ENTERPRISE SMALL BUSINESS INSTALLATION INSTRUCTIONS

for Networks Installation Guide for the application on the server July 2014 (GUIDE 2) Lucid Rapid Version 6.05-N and later

How To Create An Easybelle History Database On A Microsoft Powerbook (Windows)

Installing the BlackBerry Enterprise Server Management Software on an administrator or remote computer

Share Point Document Management For Sage 100 ERP

Step-By-Step build Advanced InfoPath Form and SharePoint Designer Workflow

Voyager Reporting System (VRS) Installation Guide. Revised 5/09/06

When you publish data to a SharePoint site, you first

Creating Connection with Hive

STIDistrict SQL 2000 Database Management Plans

Allen Bradley ControlLogix Ethernet Driver for KEPServerEX

Introduction and Overview

KEPServerEX Client Connectivity Guide

Dream Report Version 4.5

Configuring the SST DeviceNet OPC Server

Configuration of Kepware OPC Server in PanelMate Configuration Editor

Magento Integration Manual (Version /24/2014)

ThinManager and Active Directory

Customer to Partner Relationship

Excel Companion. (Profit Embedded PHD) User's Guide

Option nv, Gaston Geenslaan 14, B-3001 Leuven Tel Fax Page 1 of 14

Introduction. There are several bits of information that must be moved:

How to Setup SQL Server Replication

SQL Express to SQL Server Database Migration MonitorIT v10.5

BSDI Advanced Fitness & Wellness Software

WorldShip Import Customer Addresses

CONTACTS SYNCHRONIZER FOR IPAD USER GUIDE

Tech Note 663 HMI Reports: Creating Alarm Database (WWALMDB) Reports

TARGETPROCESS HELP DESK PORTAL

Application Notes for Calabrio Workforce Management Release 9.2(1) SR3 with Avaya Aura Contact Center Release 6.4 Issue 1.0

How to Schedule Report Execution and Mailing

Database Assistant. Once Database Assistant is installed you must login to gain access to the database. Copyright 2009

Weston Public Schools Virtual Desktop Access Instructions

Installing SQL Express. For CribMaster 9.2 and Later

STEP BY STEP IIS, DotNET and SQL-Server Installation for an ARAS Innovator9x Test System

SPECIALIST PRACTICE MANAGER

Technical Note. Configuring an Omron PLC with Omron FINS Ethernet Driver. 1. Introduction

Table of Contents ShareCenter Sync Overview...3

Creating a System DSN for Crystal Reports to Access a Sentinel Server Database. Configuration Guide Version 1.0

ReportBy ODBC Connection setup

OneLogin Integration User Guide

ODBC Overview and Information

How-to configure Auditing for IDENTIKEY Authentication Server 3.2 to a remote Oracle Database on a standalone Microsoft machine.

How Do I Load Data Stored in a Microsoft Excel File?

Transcription:

ODBC And SQL V4.x 06/30/2005 Document v1.01 Overview The purpose of this document is to provide a basic understanding of how Kepware s ODBC driver works with Microsoft SQL. This is a quick reference document, and not a detailed instruction manual. Getting Started The first topic we will cover is setting up a project within the ODBC driver. The ODBC driver uses the ODBC API, which requires the MDAC be installed. MDAC consists of several core components that provide various database technologies; including ODBC and its drivers. Creating a Channel We will start by creating a channel in the new project. The channel represents the connection to the data base. 1. Start by creating a new server project. To do this Click the New Project button in the main menu. 2. Click the Add a New Channel link to open the channel wizard. Assign a name for your channel then click next to select the ODBC Client Driver. 3. Next, select write optimization options. Accepting the defaults is fine. 4. Now select your Data Source. You must have a data source configured for the SQL database you are connecting to. 5. If you do not have a data source configured, click the Configure DSN button to open the Microsoft ODBC Data Source Administrator and do that now. See the Kepware ODBC driver Help file for information on creating a DSN for you database. KTAN-90035 Page 1 of 9

6. Finish the channel set up wizard, and click the Add a New Device link to open the device wizard. Creating a Device 7. The device created is a Fixed table, Dynamic table, Query, or Stored Procedure view of the SQL Database. 8. Next, select the Table or Stored Procedure that you want to use for your device. If you selected Query as an access method, enter the query you want to use here. Page 2 of 9 KTAN-90035

9. Next, decide if the connected OPC client should be allowed permission to write to the table by placing a check mark in the Set write access for imported database tags checkbox. Note: Enabling this option allows you to write, or modify the fields in the current record as long as the database allows it. This setting does not allow you to write, or append data to the database. 10. Lastly, set the rate at which you would like the Kepserver to refresh the dynaset of the table. Refreshing the dynaset too often may negatively affect the performance of the SQL data base. KTAN-90035 Page 3 of 9

Creating Tags 11. Once you have finished creating the device, the driver will automatically generate tags for the device. In this example we manually created tags to allow a user to navigate within the data base. We also created tags for the data fields located in the database table we wish to look at. Page 4 of 9 KTAN-90035

12. Notice the difference in the organizational method of tags in the example of a fixed table located below. A fixed table creates tag groups for each data field, and then generates a tag for every database record within the group. Note: Notice the fixed table does not provide a means for navigating through the data in the table. In fact, true to its name, the number of tags created is fixed to the number of records in the table when it was created. Alternatively, when a dynamic table is refreshed the record count will increase if new records have been added to the database. Writing or Logging to SQL One of the most common questions we get with the ODBC driver is, How can I change, or log data, in the database? There is no direct way to append data to a table without using a Stored Procedure. However, changing existing data in the table requires only the proper configuration. We will describe both methods briefly. Changing Data in a SQL Database Table The ability to change existing data in a table has 4 requirements. 1. When you create a table in the SQL data base, set access permissions to allow user writes. 2. Make sure you assign a primary index. If you do not assign the primary index, your connection with the server project will default to a read only state. This occurs because we take a dynaset snapshot of the table when we connect to it at run time. Without an index there is no way to verify data write transactions are sent to the correct record. When there is a unique index we know exactly where new data is being sent. 3. When you create the device in the server place a check in the Set write access for imported database tags check box, to ensure the data tags generated are Write Enabled. A good thing to remember when using the ODBC driver; writing data to tables may take longer than writing data to a PLC. That means if data is changing very rapidly, some changes may be lost if the database is overwhelmed. KTAN-90035 Page 5 of 9

Logging Data to SQL Database Tables When logging data to a SQL table using the ODBC Client driver you will need to use a Stored Procedure. This is because data cannot be appended to a dynaset. The following content is from a Stored Procedure named Log_to_OrderDetail. Stored Procedures can create dynamic queries by using user input. For instance, in the query below we are logging POS (Point of Sale) information to a SQL table. CREATE PROCEDURE Log_to_OrderDetail @SKU Text, @Family Text, @Price Money, @Count Int AS Insert Into OrderDetail (Product_SKU, Family, Price, Quantity) Values (@SKU, @Family, @Price, @Count) GO The way this works is as follows: 1. First we need to create a stored procedure like the one above. Notice we have assigned input parameter data types that match the data types of the fields they will be written to. 2. In our example the input parameters are SKU, Family, Price, and Count. 3. Specify which fields the data will be inserted into. This is important because we will not be starting with the first field in the table. 4. Determine which values will be entered into the fields, and specify the parameters. When you create a table in the server you will notice several tags are generated. There should be one tag for each of the input parameters. There should be an output tag for the return value. This tag is not used for data logging. Lastly there should be an Execute tag. This tag is very important because it is the trigger that enables the Stored Procedure to log data. To log data write to the input tags using your client. Then write a 1 to the Execute tag to log the data. The procedure will only run when you execute it. Page 6 of 9 KTAN-90035

Querying SQL Tables There are 2 ways to query data when connecting to SQL Databases. The first is to use a stored procedure as we did when logging data. The second is to pass a query statement to the SQL database and receive the response. The query is evaluated at the rate of the query interval, which is set in the device s property page. This example will use a simple table with sales data in it. The following graphic shows the structure of the table. Query Statement The following is an example of how to create a simple query. In a KepserverEx ODBC project create a device. The Access Method will be Query. In this query we will ask for all Employee Sales records for the year 1998. The following example is how the query is entered, SELECT * FROM Sales_Example WHERE (Year = 1998). KTAN-90035 Page 7 of 9

When you complete the wizard the server will automatically generate tags for items that are returned. In our database there are 4 different Employees with Sales Total records for 1998. Next, let s look at a more complex query. In this example we want to see a total sales amount for the year 1998. To obtain this information we must create another device with a Query Access mode, and enter the following query statement, SELECT Year, SUM(Sales) AS Total FROM Sales_Example GROUP BY Year HAVING (Year = 1998). Page 8 of 9 KTAN-90035

This is referred to as a compound query. The server should contain two tag groups named Year, and Total, with one tag in each of them. If you want to retrieve the yearly total for all sales data in the database table, simply modify the pervious query as follows, SELECT Year, SUM(Sales) AS Total FROM Sales_Example GROUP BY Year. With this query statement the server should contain two data groups with a tag for each year that contained data. KTAN-90035 Page 9 of 9