Database Connection Quick Reference
This section provides links to quick information on how to get connected to a Pervasive 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 Pervasive PSQL.
ADO.NET Connections
For complete information on ADO.NET tasks, see
Using the Data Providersin Data Provider for .NET Guide
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
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
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
Sample JCL Connection String
Session session = Driver.establishSession();
Database db = session.connectToDatabase();
db.setDictionaryLoc("c:\\PVSW\\DEMODATA");
DSN-Less Connections
Pervasive 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
2
3
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.