Carolina S-JDBC Driver Usage

Driver class

com.dullesopen.jdbc.Driver

JDBC URL Format

jdbc:carolina:v2:libnames=(<list of directories >);

JDBC URL Examples

jdbc:carolina:v2:libnames=(mydata='C:/data/sasdata');
jdbc:carolina:v2:libnames=(data1='/home/demo/mydata1',data2='/home/demo/mydata2');

Username and Password

Some tools require entering username and password information when creating a connection using a JDBC driver. Carolina S-JDBC will ignore the values provided as the username and password, so providing any non-blank strings as the values will work.

Application Servers

Deploy a JDBC datasource based on sas7bdat files into any application container with support for JDBC DataSources and enable direct SAS datasets file access from within your applications.

Deploy a JDBC datasource based on sas7bdat files into JBOSS or any other container with supporting JDBC DataSources

S-JDBC in JBoss

Database Productivity Tools

Extend the use of any database productivity tool such as Eclipse Database Development Platform or SQuirreL, capable of working with JDBC to working with SAS datasets in sas7bdat file format.

Working with sas7bdat files from Eclipse Database Tools Platform

S-JDBC in Eclipse Database Tools Platform

Create sas7bdat from Java

The example below shows how the S-JDBC Driver can be used from your Java application to create and write data to SAS datasets directly. The file created by this example is stored as /home/demo/mydata1/event.sas7bdat.

Class.forName("com.dullesopen.jdbc.Driver").newInstance();
Connection connection = DriverManager.getConnection(
        "jdbc:carolina:v2:libnames=(data1='/home/demo/mydata1',data2='/home/demo/mydata2');");

try {
    Statement statement = connection.createStatement();
    statement.execute("CREATE TABLE data1.event " +
            "(e CHAR(5) label='Event Type', " +
            "n DOUBLE PRECISION, " +
            "d DATE, " +
            "t TIME, " +
            "dt TIMESTAMP)");
    PreparedStatement preparedStatement = connection.prepareStatement(
            "INSERT INTO data1.event (e, n, d, t, dt) " +
                    "VALUES (?, ?, ?, ?, ? )");
    preparedStatement.setString(1, "a");
    preparedStatement.setDouble(2, 10);
    preparedStatement.setDate(3, Date.valueOf("2014-02-28"));
    preparedStatement.setTime(4, Time.valueOf("05:27:43"));
    preparedStatement.setTimestamp(5, Timestamp.valueOf("2014-02-28 14:43:57.678"));
    preparedStatement.execute();

    preparedStatement.setString(1, "b");
    preparedStatement.setDouble(2, 11);
    preparedStatement.setDate(3, null);
    preparedStatement.setNull(4, Types.TIME);
    preparedStatement.setNull(5, Types.TIMESTAMP);
    preparedStatement.execute();

    preparedStatement.close();
    connection.commit();
} finally {
    connection.close();
}

Carolina S-JDBC Driver Documentation

Carolina S-JDBC documentation is available from our Documentation page