Getting Started with the KingswaySoft JDBC Driver Pack
Overview
The KingswaySoft JDBC Driver Pack is a collection of lightweight JDBC drivers that connect to various proprietary APIs, allowing you to work with them as if they were traditional databases using SQL commands. This guide walks you through installation, licensing, setting up connections, and executing SQL statements.
Prerequisites
Before using the driver, ensure you have the following prerequisites:
- JDK 1.8 or later
- The
kingswaysoft.jdbc.jarlibrary, which is included in the downloaded package - A valid license (a 30-day free trial starts automatically on first use).
Installation
- Download and extract the driver pack.
- Locate the
kingswaysoft.jdbc.jarfile in the extracted folder. - Add the JAR file to your project's classpath or library directory.
Connecting via DriverManager
To connect using the DriverManager class, follow standard JDBC conventions. Load the driver class if required, then establish the connection.
Step 1: Load the Driver
This step is optional as modern JDBC drivers (JDBC 4.0+) auto-register. Only include this if using legacy environments:
Class.forName("com.kingswaysoft.jdbc.Drivers");
Step 2: Establish a Connection
Use the DriverManager.getConnection method with a connection string that begins with jdbc:kingswaysoft:.
In the below example, replace “API Name” with the specific API you are connecting to.
Connection connection = DriverManager.getConnection("jdbc:kingswaysoft:ServiceName=API Name;", null);
You can configure connection options by creating a Properties object and setting the desired properties before passing the object to the DriverManager.
Properties connectionProps = new Properties(); connectionProps.put("UserName", "username"); connectionProps.put("Password", "password"); connectionProps.put("Domain", "domain"); Connection connection = DriverManager.getConnection("jdbc:kingswaysoft:ServiceName=API Name;", connectionProps);
Refer to the Connection Settings section in each driver’s documentation for additional options.
Connecting via DataSource
For connection pooling or JNDI integration, use the JdbcDriverPackDataSource class as an alternative to DriverManager.
JdbcDriverPackDataSource ds = new JdbcDriverPackDataSource ("jdbc:kingswaysoft:ServiceName=API Name;...", connectionProps); Connection connection = ds.getConnection();