Developer Quick Start
 
Developer Quick Start
The PSQL Software Development Kit (SDK) offers you the best of both worlds for database solutions: the MicroKernel Engine offers high speed data transactions, and the Relational Engine provides full featured relational data access to the same data with greater performance in reporting and decision support.
This chapter provides quick tips to help you begin building applications with PSQL, which are described in the following sections:
Choosing An Access Method
Database Connection Quick Reference
Additional Resources for Application Developers
Choosing An Access Method
Many factors affect development strategy choices. Availability of tools on different platforms, the developer's familiarity with a given programming environment, and portability requirements often play decisive roles in the process. On the other hand, when the developer has more flexibility, various subtle factors should be considered.
Performance is always a consideration. Run-time performance, however, must be balanced against development time: is it more important to deliver the program quickly, or to have it run quickly in use?
In the context of database programming, the database interface affects both development time and run-time performance. Often the choice between SQL and Btrieve is based on these factors alone.
If you are new to PSQL products, you may want to use access methods such as ADO.NET/OLE DB, ActiveX controls, JDBC, PSQL Direct Access Components for Delphi and C++ Builder, or other third-party development tools to develop PSQL applications.
If you want to directly write to the Btrieve API, see Btrieve API Programming.
Table 1 compares the various PSQL access methods.
 
Table 1 A Comparison of Application Programming Access Methods
Access Method
Characteristics
Suitable For
Btrieve API
DLL can be called by (almost) any Windows programming language.
Exposes the complete feature set of the database.
Minimum size.
Greatest flexibility.
Shortest code path between application and data.
Least code overhead in the relational database management system (but more application code must be devoted to database management issues).
Client/Server capability.
BLOB support.
Applications where size or run-time performance is the primary consideration.
Java
Thin client.
Cross-platform portability.
Internet/Intranet capability.
Supports Winsock and JNI protocols.
Machine and OS independence. Internet and Web capability.
Minimum size.
Good flexibility.
Rowset, field abstractions implemented in the interface.
Fair overall performance (Java is an interpreted language which carries a heavy code overhead).
Client-server features, version control inherent in the language
Web applets.
Internet-based applications.
Applications which must run on various hardware and OS platforms.
ADO/OLE DB
Good integration with Visual Studio
Can work in either a transactional or relational context
Internet/Intranet capability
Rowset, field abstractions
Applications development using Visual Studio.
ADO.NET
Good overall performance.
Internet capability.
XML Support
Efficient scalable architecture
Applications running in a managed environment where runtime is paramount.
ActiveX
Visual Basic native interface.
Supported in most Windows programming environments.
Good flexibility.
Good overall performance.
Internet capability.
Rowset, field abstractions.
Extended operations, table join features.
Client-server features.
Applications where a balance of runtime performance and ease of coding is important.
Applications that do not require the minimum download footprint or the machine independence of Java, but may require Internet access to data.
SQL/ODBC
Abstracts the application interface from the database implementation.
Most programming languages, many applications support it.
Relational access only.
Large. Generally slower than direct interface to the native DBMS API. Provides a “generic” interface to an application.
Full relational implementation.
Subset of native functionality.
Standard interface supported by nearly all Windows programming environments and many off-the-shelf applications.
Applications that require heterogeneous access to different data stores, or which must be independent of any particular data store, should consider ODBC.
Applications where maintaining a relational data store is the primary consideration, but run-time performance is still important.
PSQL Direct Access Components
Replaces Embarcadero Database Engine in Delphi and C++ Builder
Classes to access data from either a transactional or relational context.
Application development using Embarcadero IDEs.
Database Connection Quick Reference
This section provides links to quick information on how to get connected to a PSQL database.
These examples should only supplement the full documentation for each access method. For each access method, there are links to more detailed information.
Each sample references the Course table in the DEMODATA sample database, which is included with PSQL.
ADO.NET Connections
ADO/OLE DB Connections
JDBC Connections
Java Class Library
DSN-Less Connections
ADO.NET Connections
For complete information on ADO.NET tasks, see
Using the Data Providers in Data Provider for .NET Guide
Code examples provided when you install the downloaded ADO.NET sample headers and files
Sample ADO.NET DB Connection Code
"ServerDSN=Demodata;UID=test;PWD=test;ServerName=localhost;";
ADO/OLE DB Connections
For complete information on ADO/OLE DB tasks, see
Getting Started with OLE DB Provider
Programming with PSQL OLE DB Provider
Sample ADO/OLE DB Connection Code
Dim rs As New ADODB.Recordset
rs.Open "Course", "Provider=PervasiveOLEDB;Data
Source=DEMODATA", adOpenDynamic,
adLockOptimistic, adCmdTableDirect
 
' work with data
 
rs.Close
JDBC Connections
For complete information on JDBC tasks, see the following topics in JDBC Driver Guide:
Introducing the PSQL JDBC Driver
Programming with the PSQL JDBC 2 Driver
Sample JDBC Connection Code
Class.forName("com.pervasive.jdbc.v2.Driver");
Connection con = DriverManager.getConnection("jdbc:pervasive://localhost:1583/DEMODATA");
PreparedStatement stmt = con.prepareStatement("SELECT * FROM Course ORDER BY Name");
ResultSet rs = stmt.executeQuery();
Java Class Library
For complete information on Java Class Library tasks, see
Introduction to the PSQL Java Interface
Programming with the Java Class Library
Sample JCL Connection String
Session session = Driver.establishSession();
Database db = session.connectToDatabase();
db.setDictionaryLoc("c:\\PVSW\\DEMODATA");
DSN-Less Connections
PSQL allows an application to perform a DSN-less connection (connecting to the SQL engine without using a DSN) :
The following steps should be used when running locally on the Server or from a Remote Client. This method works with Server as well as Workstation/WorkGroup Engines.
1 SQLAllocEnv
2 SQLAllocConnect
3 SQLDriverConnect: "Driver={Pervasive ODBC Client Interface};ServerName=<ServerName to Resolve>;dbq=@<ServerSide DBName>;"
Example
Driver={Pervasive ODBC Client Interface};ServerName=myserver;dbq=@DEMODATA;
Note Releases earlier than Pervasive.SQL 2000 (SP3) supported DSN-less connections only for applications running local to the engine (i.e. running on the same machine where the engines were running). However, the format of the Driver string changed starting with Pervasive.SQL 2000i (SP3). Any applications using DSN-less connections will have to be modified as shown above, and recompiled in order to run without a DSN under Pervasive.SQL 2000 (SP2a) or earlier.
ODBC Information
The implementation and limitations of the PSQL ODBC access method is documented in the ODBC Guide. This documentation is shipped with PSQL Server, Workgroup, and Client products.
For ODBC information, see PSQL ODBC Reference in ODBC Guide.
For supported SQL syntax, see SQL Syntax Reference in SQL Engine Reference.
Other SQL Access Methods
ADO/OLEDB
For ADO/OLE DB programming information, see OLE DB Provider Guide.
JDBC
For JDBC programming to the SQL engine, see the following topics in JDBC Driver Guide.
Introducing the PSQL JDBC Driver
Programming with the PSQL JDBC 2 Driver
PDAC
PSQL Direct Access Components are for Delphi and C++ Builder applications. For more information, see the following topics in PSQL Direct Access Components Guide.
Using Direct Access Components
Direct Access Components Reference
Additional Resources for Application Developers
The following topics provide further reading on PSQL concepts.
Conceptual Information
This manual contains database conceptual information on both the MicroKernel Engine and Relational Engine.
Reference Information
Reference information for developers is contained in the various software development kit (SDK) manuals. In the Eclipse Help that can be installed with the database engine, see the topic Developer Reference.
Online Developer Resources
Get information for developers online at the Actian PSQL website.
Sample Code
You can find the sample applications in your installation of the SDK component. The available samples include the following:
ADO/OLE DB Programming using Visual Basic or Visual C++
PSQL Direct Access Components using Delphi or C++ Builder
Java Programming with the PSQL Java Class Library or JDBC
Distributed Tuning Interface for Visual C++ or Delphi
Distributed Tuning Objects for Visual Basic