Developer Reference : Data Access Methods : OLE DB Provider Guide : Introducing Zen OLE DB Provider
 
Introducing Zen OLE DB Provider
An Overview of the Provider and Its Use
The following topics introduce and summarize Zen OLE DB Provider:
Getting Started with OLE DB Provider
OLE DB Provider Architecture
OLE DB Provider and Visual Studio.NET
Performance Considerations with OLE DB
OLE DB Provider Limitations
For implementation instructions and details, see these topics:
Programming with Zen OLE DB Provider
ADO/OLE DB Reference Information
Zen OLE DB Provider Implementation
Getting Started with OLE DB Provider
The Zen OLE DB Provider is for use with OLE DB consumers, including ADO.
This documentation does not attempt to describe OLE DB and ADO, which are covered in depth in the Microsoft specifications. Instead, it gives specifics about the Zen provider and helps you get started as a new user.
This provider supports only Zen databases in the current release. You cannot use this OLE DB provider to connect to machines that use previous versions of Zen.
OLE DB Provider Architecture
Zen OLE DB is an implementation of the Microsoft OLE DB Provider specification.
For relational access, the provider connects to the database engine via a network protocol. The server engine processes the request, then sends the data back to the provider for processing and handoff to the client. The provider uses the same protocol as the ODBC client interface.
The following diagram shows the architecture of the OLE DB provider.
Relational Performance
The Zen OLE DB Provider uses an architecture similar to that of the ODBC and JDBC drivers to communicate to the remote server. By using the relational engine on the server-side, you should see increased performance in most SQL-based use of the provider, including stored procedures and complex queries.
Remote Connections
Use the Location parameter in the connection string to specify a remote server.
Provider=PervasiveOLEDB;Data Source=MyDBname;Location=MyServer
For additional information, see Remote Connections.
Pessimistic Cursors
There are certain situations in database programming where great importance is attached to the success of updates, even if that focus increases the chances that other clients will encounter record locks.
When you obtain a record set and specify deferred update, you might encounter a concurrency violation when trying to perform an update because another client has updated a row that you also intend to update. Setting a pessimistic cursor can help in these situations.
For additional information, see Pessimistic Cursors.
Support for ADO Refresh Method
The Zen OLE DB Provider supports the Refresh method of the Parameters collection of a Command object so that you can retrieve parameter information from a stored procedure or parameterized query.
For additional information, see Support for ADO Refresh Method Examples.
Review of Previous OLE DB Providers
For a comparison with the current version, this section provides a brief overview of past providers. Zen first shipped an OLE DB provider with Service Pack 2 of the Pervasive.SQL 2000i release. This release is the third-generation provider.
First Version: Pervasive.SQL 2000i (SP2)
The first provider was transactional (Btrieve) only. For relational access, you had to use Microsoft’s ODBC to OLE DB bridge provider. The following figure shows the architecture of the first OLE DB provider.
Figure 1 Architecture of First Zen OLE DB Provider
Second Version: Pervasive.SQL 2000i (SP3, SP4)
Pervasive.SQL 2000i released an updated provider that allowed relational access. It allowed developers access to relational and transactional access using the same API. Updates to the data could even be encapsulated within transactions, even between relational and transactional access. The provider also incorporated some ADOX features, so in addition to the capabilities of SQL, database creation became available.
Figure 2 Architecture of Second OLE DB Provider
This second version of the provider did have some drawbacks. It was considered a thick client because the relational engine was encapsulated in the provider. Therefore, the provider had to cross the process boundary for each row, which led to performance issues for applications in a client-server setting.
This version of the provider resolves this performance issue.
Features in Pervasive.SQL 2000i OLE DB Provider
This topic provides an overview of the changes made to the Zen OLE DB driver in the Pervasive.SQL 2000i SP3 release.
Command-Based Recordsets Supported
The OLE DB provider that shipped with Pervasive.SQL 2000i prior to its SP3 did not include support for SQL statements. This meant that Command objects were not supported and that result sets required table names to open successfully. This version includes support for SQL commands and conforms to 2.5 specifications. Unlike the SQL Server provider or the ODBC bridge, the provider can open result sets that are either command based or purely navigational. Additionally, server-side cursors on either can be forward-only, static, or dynamic. Both command-based result sets and navigational (table-based) result sets can be open and operated on at the same time.
Command-based record sets provide the power and flexibility of the SQL engine, but server-side navigational result sets provide direct access to indexes; this feature is not available with command-based result sets (indirect access is provided by the query optimizer). With the index capability comes the ability to perform Seek operations. A routine that uses Seek can significantly outperform a similar routine that performs the same functions via a SQL statement. When used properly, server-side navigational record sets can improve application performance by allowing rapid positioning on records that contain specific values.
ADOX
Zen supports ADO Extensions for Data Definition Language and Security (ADOX). ADOX is used to create tables, modify schema definitions, and view the contents of database tables. Currently, catalog, table, column, and index objects are supported. The creation of tables and indexes is supported; database creation is not supported at this time.
Navigational Recordsets in the Provider
In order to open a navigational result set, adCmdTableDirect must be used in the options of the Open method. In the previous version, adCmdTable would successfully open a navigational result set. However, ADO will turn this into a "SELECT * FROM" SQL statement. This will make the result set command-based, and indexes will be unavailable.
Note Since ADO treated this differently when command support was unavailable, existing applications that take advantage of index capabilities will no longer function unless the Open method calls use adCmdTableDirect.
Large Binary Objects
ISequentialStream support has been added to the OLE DB provider. In ADO, this translates into AppendChunk/GetChunk functionality of the record set object. It also allows complex data binding to transfer BLOB data to and from visual controls.
OLE DB Provider and Visual Studio.NET
This topic outlines issues you should be aware of when using Zen OLE DB Provider with Visual Studio .NET.
Wizards in Visual Studio .NET
The wizards in Visual Studio .NET that generate ADO.NET code are designed for use only with Microsoft providers. Therefore, it is not recommended that you use these wizards with Zen. However, the function of these wizards is only to generate code, so everything that the wizards can do can be accomplished with your own code.
Security with ASP.NET
To work with ASP.NET, you need to ensure that both ASP.NET and the user account used by IIS (IUSR_machinename) have read and write access to the following files and directories:
Directories for your data and DDF files
The location of Zen binaries, by default in C:\Program Files\Actian\Zen\bin and C:\Program Files (x86)\Actian\Zen\bin
dbnames.cfg, by default in C:\ProgramData\Actian\Zen
Supported Objects
For a reference of supported objects in Visual Studio.NET, see Visual Studio.NET Implementation Reference.
Performance Considerations with OLE DB
This topic covers performance issues related to OLE DB.
Cache Engine
The Zen cache engine can impact performance of the OLE DB provider when used in a client/server environment. You may want to disable the cache engine using Zen Control Center depending on your configuration. Static cursors are most affected by this issue.
Best Performance is Navigational
Server-side navigational record sets will have a significant performance advantage over command-based record sets for tasks that require frequent positioning on records that contain specific values.
Static vs. Dynamic Cursors
Static cursors will create a temporary table behind the scenes whenever one would not have been created by the relational engine (for more information about temporary tables, see SQL Engine Reference). This will be the case for both command-based and navigational tables. When bandwidth is not a significant consideration, dynamic cursors can provide higher performance, since they do not always involve temporary tables. However, in low bandwidth scenarios, round-trips can be too expensive to justify dynamic cursors; in this case RDS is often a good solution. The drawback to RDS is that Microsoft has implemented it as a command-based only solution, which means that index functionality (using Seek) is unavailable. Performance can be maintained regardless of deployment by implementing an abstraction layer that works identically on RDS-based and local record sets. The nature of this abstraction would depend on the needs of the application and would likely take the form of a runtime business object.
Disable Unused Services
When developing OLE DB applications, a way to improve performance is to turn off any OLE DB Services that are not being used. See the documentation for DBPROP_INIT_OLEDBSERVICES for more information.
Turning off the Automatic Transaction Enlistment will not instantiate the ITransactionJoin interface on the session and will also keep the provider from looking for MTS objects.
OLE DB Provider Limitations
Asynchronous operations are not supported.
The Record and Stream objects are not supported.
The Index property cannot be set on a static navigational cursor once the record set has been used. Set the index appropriately before performing the open operation on the record set. After opening the record set, the index cannot be changed.