Standalone Application

To use either Driver or DataSource based connections, add the client JAR to your Java client application’s classpath. See the simple client example in the kit for a full Java sample of the following.

Driver Connection

Sample Code:

public class TeiidClient {
    public Connection getConnection(String user, String password) throws Exception {
        String url = "jdbc:teiid:myVDB@mm://localhost:31000;ApplicationName=myApp";
        return DriverManager.getConnection(url, user, password);
    }
}

Datasource Connection

Sample Code:

public class TeiidClient {
    public Connection getConnection(String user, String password) throws Exception {
        TeiidDataSource ds = new TeiidDataSource();
        ds.setUser(user);
        ds.setPassword(password);
        ds.setServerName("localhost");
        ds.setPortNumber(31000);
        ds.setDatabaseName("myVDB");
        return ds.getConnection();
    }
}

results matching ""

    No results matching ""