Quick Start
The following basic information enables you to connect to a database using the Zen ADO.NET data providers immediately after their installation:
To take full advantage of Zen ADO.NET data provider features, we recommend that you also read other Zen ADO.NET topics documented here.
ADO.NET Data Providers Installed with Zen
This section describes the .NET Framework versions supported by the Zen ADO.NET data providers installed with Zen v15. For a description of Zen ADO.NET data providers for .NET Core and Entity Framework Core provided by downloading the SDK, see Zen ADO.NET Data Providers Available with SDK Download.
Zen v15 provides two versions of the ADO.NET data providers: 4.4 and 4.5. All versions are installed by default with the database engine.
If you are using ADO.NET without customization, then code written for earlier versions of the .NET Framework and of the Zen data provider is compatible with Zen data provider 4.4 and 4.5.
Supported .NET Framework Versions
Zen ADO.NET Data Provider 4.4 and 4.5 add support for the combinations with Microsoft .NET Framework and Microsoft Entity Framework as shown in the following table. Each row of the table represents the compatible combinations of the supported versions of these three products.
Zen Data Provider for
Version
Namespace
Assembly File Name
(Installed by Zen)
Microsoft .NET Framework
Microsoft Entity Framework
ADO.NET
4.4
Pervasive.Data.SqlClient
Pervasive.Data.SqlClient.dll
2.0, 3.0, 3.5, 3.5 SP1, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
ADO.NET
4.5
Pervasive.Data.SqlClient
Pervasive.Data.SqlClient.dll
2.0, 3.0, 3.5, 3.5 SP1, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
ADO.NET Entity Framework
4.4
Pervasive.Data.SqlClient.Entity
Pervasive.Data.SqlClient.
Entity.dll
4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
6.1, 6.1.1, 6.1.2
ADO.NET Entity Framework
4.5
Pervasive.Data.SqlClient.Entity
Pervasive.Data.SqlClient.
Entity.dll
4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8
6.1, 6.1.1, 6.1.2
To use Zen ADO.NET Entity Framework Provider 4.4 or 4.5, your applications must target .NET Framework 4.5 or later.
All versions listed here apply to both 32- and 64-bit versions of .NET Framework.
Zen ADO.NET Entity Framework Provider 4.4 and 4.5 support Microsoft Entity Framework 6.1.
For more information on the Zen ADO.NET data providers, see the topic for each provider.
Zen ADO.NET Data Providers Available with SDK Download
Beyond the ADO.NET data providers installed with Zen v15, additional providers are available to support .NET Standard 2.0 compliant applications. These providers are listed in the following table and made available as NuGet packages included in a downloadable SDK at the Actian website. As with the versions of providers installed with Zen, the following table lists two versions for compliant applications.
Zen Data Provider for
Version
Namespace
Assembly File Name
.NET
EF Core
NuGet Package
(see note)
SDK Download
ADO.NET Core
4.4
Pervasive.Data.SqlClient
Pervasive.Data.
SqlClientStd.dll
Core 2.0
Pervasive.Data.SqlClientStd.4.4.0.<build>.nupkg
Zen-SDK-AdoNetDataProvider4.4-NetStandard-Windows-noarch-<version>.zip
ADO.NET Core
4.5
Pervasive.Data.SqlClient
Pervasive.Data.
SqlClientStd.dll
Core 2.1, 6.0, 7.0
Pervasive.Data.SqlClientStd.4.5.0.<build>.nupkg
Zen-SDK-AdoNetDataProvider4.5-NetStandard-Windows-noarch-<version>.zip
ADO.NET Entity Framework Core
4.4
Actian.EntityFrameworkCore.Zen
Actian.Entity
Framework
Core.Zen.dll
Core 2.0
3.1
Actian.EntityFrameworkCore.Zen.4.4.0.<build>.nupkg
Zen-SDK-AdoNetDataProvider4.4-NetStandard-Windows-noarch-<version>.zip
ADO.NET Entity Framework Core
4.5
Actian.EntityFrameworkCore.Zen
Actian.Entity
Framework
Core.Zen.dll
Core 2.1, 6.0
3.1, 6.0
Actian.EntityFrameworkCore.Zen.4.5.0.<build>.nupkg
Zen-SDK-AdoNetDataProvider4.5-NetStandard-Windows-noarch-<version>.zip
Note:  The associated NuGet packages are available only in the downloadable SDK listed in the table.
Zen ADO.NET Entity Framework Core data providers require the Zen ADO.NET Core data provider of the same version to be added to the application project.
For more information on the Zen ADO.NET Core data providers, see the topic for each provider.
Defining Basic Connection Strings
The data provider uses a connection string to provide information needed to connect to a specific database server. The connection information is defined by connection string options.
The Zen ADO.NET Entity Framework data provider can specify an existing connection in the Entity Framework Wizard, or can define a new connection. The Zen ADO.NET Entity Framework uses information contained in connection strings to connect to the underlying Zen ADO.NET data provider that supports the Entity Framework. The connection strings also contain information about the required model and mapping files. The data provider uses the connection string when accessing model and mapping metadata and connecting to the data source.
The connection string options have the form:
"option name=value"
Each connection string option value pair is separated by a semicolon. For example,
"Server DSN=DEMODATA;UID=test;PWD=test;Host=localhost"
See Connection String Properties for details about the supported connection string options.
Notes
The spaces in the option names are optional.
All connection string option names are case-insensitive. For example, User ID is the same as user id. However, the values of some options, such as User ID and Password, might be case-sensitive.
If the connection string does not specify a port number, the data provider uses 1583, the default port number.
Minimum Required Connection String Options
The following table gives the name and description for each option required for a minimum connection to a Zen server.
Option
Description
Server DSN
Specifies the name of the data source on the server to which you want to connect, for example, DEMODATA.
Host
Specifies the name or the IP address of the Zen server to which you want to connect. For example, you can specify a server name such as Accountingserver or an IP address such as 199.226.22.34 (IPv4) or 1234:5678:0000:0000:0000:0000:9abc:def0 (IPv6).
The initial default value is localhost.
Connecting to a Database
Once your data provider is installed, you can connect from your application to your database with a connection string. See Connection String Properties for a list of the connection string options.
Note: If your application uses the Zen ADO.NET Entity Framework, you can use the Entity Data Model Wizard to create a new connection or use an existing connection. See Creating a Model for more information.
Example: Using the Provider-Specific Objects
The following example uses the provider-specific objects to connect to a database using the Zen ADO.NET data provider from an application developed in Visual Studio using C#.
1. In the Solution Explorer, right-click References and then select Add Reference.
2. In the Reference Manager wizard, click the Browse button and navigate to the folder that contains the Zen data provider assembly.
3. Select Pervasive.Data.SqlClient.dll and click Add. The Browse tab of the Reference Manager wizard lists the Zen data provider assembly in the Recent items.
4. Select it and click OK. The Solution Explorer now includes the Zen data provider.
5. Add the Zen data provider’s namespace to the beginning of your application, as shown in the following C# code fragment:
// Access Zen
using System.Data;
using System.Data.Common;
using Pervasive.Data.SqlClient;
6. Add exception handling code and the connection information for your server:
PsqlConnection DBConn = new PsqlConnection("Server DSN=DEMODATA;Host=localhost");
try
{
// Open the connection
DBConn.Open();
Console.WriteLine("Connection Successful!")
}
catch (PsqlException ex)
{
// Connection failed
writer.WriteLine(ex.Message);
}
7. Close the connection.
// Close the connection
DBConn.Close();
Example: Using the Common Programming Model
The following example illustrates connecting to a Zen database from an application developed in Visual Studio using C# and the Common Programming Model.
1. Check the beginning of your application. Ensure that the ADO.NET namespaces are present.
// Access Zen using factory
using System.Data;
using System.Data.Common;
2. Add the connection information of your server and exception handling code and close the connection.
DbProviderFactory
factory=DbProviderFactories("Pervasive.Data.SqlClient");
DbConnection Conn = factory.createConnection();
Conn.CommandText = "Server DSN=DEMODATA;Host=localhost;";
try
{
Conn.Open();
Console.WriteLine("Connection successful!");
}
catch (Exception ex)
{
// Connection failed
Console.WriteLine(ex.Message);
}
// Close the connection
Conn.Close();
Example: Using the Zen Common Assembly
You can optionally include the Zen Common Assembly if you want to use features such as Zen Bulk Load in an application that conforms to the Common Programming Model. See Using Zen Bulk Load for information about how to use Zen Bulk Load with your application.
The following example illustrates how to use the Zen Common Assembly in an application developed in Visual Studio using C# and the Common Programming Model.
1. Check the beginning of your application. Ensure the .NET Framework and Zen data provider namespaces are present.
// Access Zen using factory
using System.Data;
using System.Data.Common;
using Pervasive.Data.Common;
2. Add the connection information of your server and exception handling code and close the connection.
// This code does a bulk copy operation from
// one database to another
DbProviderFactory Factory = DbProviderFactories.GetFactory("Pervasive.Data.SqlClient");
DbConnection sourceConnection = Factory.CreateConnection();
sourceConnection.ConnectionString = "Host=localhost;Server DSN=DEMODATA;";
 
sourceConnection.Open();
 
DbCommand command = sourceConnection.CreateCommand();
command.CommandText = "SELECT * FROM test";
DbDataReader reader = command.ExecuteReader();
 
DbConnection destinationConnection = Factory.CreateConnection();
destinationConnection.ConnectionString =
"Host= ntsl2003b;Server DSN=DEMODATA";
destinationConnection.Open();
 
DbBulkCopy bulkCopy = new DbBulkCopy(destinationConnection);
bulkCopy.DestinationTableName = "test";
try
{
bulkCopy.WriteToServer(reader);
}//end try
catch (DbException ex)
{
Console.WriteLine( ex.Message );
}//end catch
finally
{
reader.Close();
MessageBox.Show("done");
}//end finally
Using the Zen ADO.NET Entity Framework Data Provider
The Entity Data Model wizard asks questions that help you to define the components in your Entity Data Model (EDM). The wizard then creates a model of your data in Visual Studio, and automatically sets values for the components in the model. See Using an .edmx File for information about using the wizard to create an EDM.
Alternatively, you can use other tools in Visual Studio to define values and connection strings manually.
Provider is an attribute of the Schema element in the storage model file of an EDM. The storage model file is written in the store schema definition language (SSDL).
The Entity Data Model wizard assigns the value when you select the Zen ADO.NET Entity Framework data provider. If you choose to manually define an Entity Data Model, assign the string Pervasive.Data.SqlClient to the Provider attribute of the Schema element, as shown in the following example:
<Schema Namespace="AdventureWorksModel.Store" Alias="Self" Provider="Pervasive.Data.SqlClient" ProviderManifestToken="Zen" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns="http://schemas.microsoft.com/ado/2006/04/edm/ssdl">
 
Last modified date: 11/02/2023