Pervasive Data Provider for .NET Guide and Reference
Total Page:16
File Type:pdf, Size:1020Kb
Pervasive PSQL 11 Pervasive Data Provider for .NET Guide and Reference Developing Applications with Data Provider for .NET Pervasive Software Inc. 12365 Riata Trace Parkway Building B Austin, TX 78727 USA Telephone: 512 231 6000 or 800 287 4383 Fax: 512 231 6010 Email: [email protected] Web: http://www.pervasivedb.com disclaimer PERVASIVE SOFTWARE INC. LICENSES THE SOFTWARE AND DOCUMENTATION PRODUCT TO YOU OR YOUR COMPANY SOLELY ON AN “AS IS” BASIS AND SOLELY IN ACCORDANCE WITH THE TERMS AND CONDITIONS OF THE ACCOMPANYING LICENSE AGREEMENT. PERVASIVE SOFTWARE INC. MAKES NO OTHER WARRANTIES WHATSOEVER, EITHER EXPRESS OR IMPLIED, REGARDING THE SOFTWARE OR THE CONTENT OF THE DOCUMENTATION; PERVASIVE SOFTWARE INC. HEREBY EXPRESSLY STATES AND YOU OR YOUR COMPANY ACKNOWLEDGES THAT PERVASIVE SOFTWARE INC. DOES NOT MAKE ANY WARRANTIES, INCLUDING, FOR EXAMPLE, WITH RESPECT TO MERCHANTABILITY, TITLE, OR FITNESS FOR ANY PARTICULAR PURPOSE OR ARISING FROM COURSE OF DEALING OR USAGE OF TRADE, AMONG OTHERS. trademarks Btrieve, Client/Server in a Box, Pervasive, Pervasive Software, and the Pervasive Software logo are registered trademarks of Pervasive Software Inc. Built on Pervasive Software, DataExchange, MicroKernel Database Engine, MicroKernel Database Architecture, Pervasive.SQL, Pervasive PSQL, Solution Network, Ultralight, and ZDBA are trademarks of Pervasive Software Inc. Microsoft, MS-DOS, Windows, Windows 95, Windows 98, Windows NT, Windows Millennium, Windows 2000, Windows XP, Win32, Win32s, and Visual Basic are registered trademarks of Microsoft Corporation. NetWare and Novell are registered trademarks of Novell, Inc. NetWare Loadable Module, NLM, Novell DOS, Transaction Tracking System, and TTS are trademarks of Novell, Inc. Sun, Sun Microsystems, Java, all trademarks and logos that contain Sun, Solaris, or Java, are trademarks or registered trademarks of Sun Microsystems. All other company and product names are the trademarks or registered trademarks of their respective companies. © Copyright 2013 Pervasive Software Inc. All rights reserved. Reproduction, photocopying, or transmittal of this publication, or portions of this publication, is prohibited without the express prior written consent of the publisher. This product includes software developed by Data Direct. Copyright 2012 Data Direct, Inc. All rights reserved. Pervasive Data Provider for .NET Guide and Reference January 2013 Contents Contents Preface . xiii What Are the Pervasive PSQL Data Providers? . xiv What’s New in this Release? . .xvi What’s Deprecated in this Release? . xvii Using This Book. xviii Typographical Conventions . xx 1 Quick Start . 1 Supported .NET Framework Versions . 2 Defining Basic Connection Strings . 3 Connecting to a Database . .5 Example: Using the Provider-Specific Objects. 5 Example: Using the Common Programming Model . 7 Example: Using the Pervasive Common Assembly . 8 Using the ADO.NET Entity Framework Data Provider . 10 2 Using the Data Providers . 11 About the Data Providers . .12 Using Connection Strings . .13 Guidelines . 13 Using the Pervasive Performance Tuning Wizard. 14 Stored Procedures. 15 Using IP Addresses . 16 Transaction Support . 17 Using Local Transactions . 17 Thread Support . 18 Unicode Support . 19 Isolation Levels . 20 SQL Escape Sequences . 21 Event Handling . 22 Error Handling . 23 Using .NET Objects. 24 Developing Applications for .NET. 25 3 Advanced Features. 27 Using Connection Pooling . 28 Creating a Connection Pool. 28 Adding Connections to a Pool . 29 Removing Connections from a Pool . 30 Handling Dead Connection in a Pool . 31 Tracking Connection Pool Performance . 32 iii Contents Using Statement Caching . 33 Enabling Statement Caching . 33 Choosing a Statement Caching Strategy. 34 Using Connection Failover . 35 Using Client Load Balancing . 37 Using Connection Retry . 38 Configuring Connection Failover. 39 Setting Security . 41 Code Access Permissions . 41 Security Attributes . 41 Using Pervasive Bulk Load . 42 Use Scenarios for Pervasive Bulk Load . 42 Pervasive Common Assembly . 43 Bulk Load Data File . 44 Bulk Load Configuration File . 45 Determining the Bulk Load Protocol . 46 Character Set Conversions . 46 External Overflow File . 47 Bulk Copy Operations and Transactions . 47 Using Diagnostic Features. 49 Tracing Method Calls . 49 PerfMon Support . 51 Analyzing Performance With Connection Statistics . 52 Enabling and Retrieving Statistical Items . 53 4 The ADO.NET Data Provider. 55 About the ADO.NET Data Provider . 56 Namespace. 56 Assembly Name . 56 Using Connection Strings with the ADO.NET Data Provider . 57 Constructing a Connection String . 57 Performance Considerations . 58 Connection String Options that Affect Performance. 58 Properties that Affect Performance . 59 Data Types . 61 Mapping Pervasive Data Types to .NET Framework Data Types . 61 Mapping Parameter Data Types . 63 Data Types Supported With Stream Objects . 66 Using Streams as Input to Long Data Parameters . 67 Parameter Markers. 68 Parameter Arrays. 69 5 The ADO.NET Entity Framework Data Provider . 71 About the ADO.NET Entity Framework Data Provider . 73 Namespace. 73 iv Contents Assembly Names . 73 Using Connection Strings with the Entity Framework Data Provider . 74 Defining Connection String Values in Server Explorer . 74 Changes in Default Values for Connection String Options. 74 Performance Considerations. 75 Connection String Options that Affect Performance . 75 Properties that Affect Performance . 76 Using the ADO.NET Entity Framework . 77 Mapping Pervasive Data Types to Simple Types. 77 Mapping EDM Canonical Functions to Pervasive Functions. 80 Extending Entity Framework Functionality. 84 Enhancing Entity Framework Performance . 85 Obtaining Connection Statistics . 85 Limiting the Size of XML Schema Files. 86 Using Stored Procedures with the ADO.NET Entity.