You are here: Data Services > Connecting with the Scantron OLE DB Provider > Connection Strings

Connection Strings

Connection String Rules for the Scantron OLE DB Provider

Typically, the consumer will explicitly specify the data file and application definition file paths. When the directory portion is absent, the current directory is assumed.

Whenever a file is explicitly specified and it does not exist or has some error associated with it, the connection attempt will fail with an appropriate error.

If the data file is explicitly specified and the application definition file is unspecified, then the OLE DB provider uses the first 3 characters of the *.dat file as the application number and looks for z<App-Number>.SDS.StxAppDef in the same folder as the *.dat file. If it is present, the OLE DB provider uses that file to initialize the connection. The connection attempt succeeds if the file is not found. Subsequently, when a query is made for a table or column that is not there, the provider reports an error – table or column not found. This allows users to use *.dat files without meta data. A typical use case is a diagnostics utility.

If the data file is unspecified and the application definition file is explicitly specified, the initialization attempt is allowed to succeed. the OLE DB provider uses the the application number (the last 3 characters of the *.SDS.StxAppDef file) as the data file name and looks for <App-Number>.dat in the same folder as the *.SDS.StxAppDef file. If a data file is not found, a use case is schema retrieval. On a subsequent data query, an empty result set may be created.

If neither file is specified, the provider still allows the connection to succeed. Subsequently data queries will likely return no rows or error out. One use case is the retrieval of meta data information for the NCS Header portion of the data file.

These are currently not used by the OLE DB Provider:

Keyword

Description

Data Source or Server

do not specify

Initial Catalog or Database

do not specify.

You or your solution will explicitly specify the data file and application definition file paths.

WARNING: ADO scans the connection string only for well known and provider specific attributes. Any other information is ignored. In particular, ADO does not report an error if you specify "sample.dat" instead of "Data File=sample.dat;". ADO will pass on an empty string for the property to the OLE DB provider. ADO will report an error if the connection string as a whole is empty. It cannot locate the OLE DB provider.

See also:

ADO Example--Open an ADO recordset object using a URL

Opening and Closing Connections During Scanning

We recommend that you open and close the connection between your scanning solution and the OLE DB provider during the processing of each event used during scanning. In order for the connection to be closed immediately so scanning can continue, connection pooling must be disabled. This practice will help you avoid potential problems associated with accessing files that, as a result of ongoing scanning operations, may have changed during the connection.

Opening a connection at the start of an event and closing it at the end of the event will cause minimal performance degradation. If performance is a concern, the connection may be left open while accessing application definition files, edit profiles, and schema rowsets.

When a solution opens a connection to the OLE DB provider, the connection string specifies the names of the files to which the connection is made. When files are changed after the connection is made (clips added to the clip file; records added to the data file), the OLE DB provider does not track the changes, creating the potential for errors.

Some files change while others do not:

 

ADO Connection String Parameters for the Scantron OLE DB Provider

To connect to the Scantron OLE DB Provider (Scantron.Oledb), set the Provider argument of the ConnectionString property to:

Scantron.Oledb

This value can also be set or read using the Provider property.

Typical Connection String

An example connection string for the Scantron OLE DB Provider is:

"Provider=Scantron.Oledb; Data File=sample.dat; App File = z701.sds.StxAppDef; mode = Read; License=XXXXXXXXXXXXXX:"

where XXXXXXXXXXXXXX is the 14 digit license key string that came with your copy of ScanTools Plus Link SDK.

The string consists of these keywords:

Parameter

Description

Provider

Specifies the OLE DB Provider for ScanTools Plus.

Data File

Specifies the data file (*.dat) created by ScanTools Plus.

App File

Specifies the ScanTools Plus application definition file (*.sds.StxAppDef).

Mode

Specifies the read-write mode.

License

Specifies the 14 character license key string that came with your copy of ScanTools Plus Link SDK. This is a mandatory property.

Relative and network paths are supported as file paths. Network paths may use mapped drive letters or UNC.

Examples of supported paths

..\..\data\sample.dat

\\rhino\share\data files\sample.dat

NOTE: Be sure to specify read-write mode in the connection string if you plan to perform an update, delete, or insert. If not specified, the default mode is Read|ShareDenyNone. See Data Link Properties dialog - Advanced Tab.

Provider-Specific Connection Parameters

The Scantron OLEDB Provider supports several provider-specific connection parameters in addition to those defined by ADO. As with the ADO connection properties, these provider-specific properties can be set via the Properties collection of a Connection or can be set as part of the ConnectionString.

Parameter

Type

Description

App Path

String

Fully specified path to the application definition files

Data Path

String

Fully specified path to the data files

Profiles Path

String

Fully specified path to the profiles

App File

String

Specifies the Application definition file name, including extension .sds

Data File

String

Connection to the provider is either during scanning or pre-/post-scanning:

  • During scanning, use ScanEventArgs Document.ConnectionString property.
  • Pre-/post-scanning, specify the data file name, including extension .dat. The data file can’t be accessed during scanning.

Edit Profile

String

Specifies the Edit profile name, including extension .$epStxEdtPrf

Image File

String

Specifies the Image file name, including extension .tif.

Use the Data Path or, if using a file name, go to the data file.

Enforce Date Checks

True/False

True = connection is refused if application file is newer than any of the associated profiles.

False = connection is accepted if application file is newer than any of the associated profiles. Default.

Include NCS Header

True/False

True = all columns in the NCS Header can be specified in a Select statement.

False = no columns in the NCS Header can be specified in a Select statement. Default.

Mode

String

Specifies Read Write permission mode.

Using a URL for a Connection String

Using a URL as a connection string for the Scantron OLE DB Provider can simplify your programming effort because it employs static binding. The provider registers the URL scheme OPL6.

Syntax of the URL in BNF notation

<URL> ::= <Prefix><Data Spec>[<Sep>[<Meta Data Spec>[<Sep>]]]

<Prefix> ::= URL=<Scheme>

<Data Spec> ::= Data File=<data file path> | <DAT file path> | "<DAT file path>"

<Meta Data Spec> ::= App File=<SDS.StxAppDef file path> | <SDS.StxAppDef file path> | "<SDS.StxAppDef file path>"

<DAT file path> ::= [<Dir Spec>\]<file name>.dat

<SDS file path> ::= [<Dir Spec>\]z<App Number>.sds.StxAppDef

<App Number> ::= <N><N><N>

<N> ::= 0|1|2|3|4|5|6|7|8|9

<Dir Spec> ::= <standard dos directory>

<Sep> ::= ;

<Scheme> ::= opl6:

Examples of valid URLs

Opl6:c:\oledb\data\sample.dat

opl6:DataFile="701000001001102700001 Y 5310 #0001 N ALL RIGHT M1003211947012345678998765412345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345 ";App File=c:\oledb\data\z701.sdsStxAppDef;

opl6:DataFile="701000001001102700001 Y 5310 #0001 N ALL RIGHT M1003211947012345678998765412345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345123451234512345 "

opl6:Data File=c:\oledb\data\sample.dat; App File=c:\oledb\data\z701.sds.StxAppDef;

opl6:Data File=c:\oledb\data\sample.dat

opl6:Data File=sample.dat

 

 

See Help on Help for additional information on using this help file.

See Scantron Technical Support for additional information on technical support and training options.

See the ScanTools Suite System Requirements for further details on hardware and software requirements.

ScanTools is a suite of products; the specific information you want may appear in the help for a different module. If you don't find what you're looking for here, try one of the following:

 

Scantron Corporation

Customer Service (forms, products, and services):

1-800-SCANTRON (722-6876)

www.scantron.com

Technical Support:

1-800-445-3141

support@scantron.com

Copyright © 1998-2012 Scantron Corporation. All rights reserved. Use permitted only under license. www.scantron.com. No part of the Help or user guides may be reproduced in any form, or by any means, without express permission from Scantron Corporation.

LINKS TO THIRD PARTY SITES

This help system may contain links to third party websites ("Linked Sites"). The Linked Sites are not under the control of Scantron and Scantron is not responsible for the content of any Linked Site, including without limitation any link contained in a Linked Site or any changes or modifications to a Linked Site. Scantron is not responsible for web casting or any other form of transmission received from any Linked Site. Scantron provides Users with the ability to link the Assessment System to the Linked Sites as a convenience to you, and the inclusion of any link does not imply endorsement by Scantron of the Linked Site or any association with its operators.