The Teiid JDBC DataSource implementation class of {@link javax.sql.DataSource} and{@link javax.sql.XADataSource}.
The {@link javax.sql.DataSource} interface follows the JavaBean design pattern,meaning the implementation class has properties that are accessed with getter methods and set using setter methods, and where the getter and setter methods follow the JavaBean naming convention (e.g., get
PropertyName() :
PropertyType and set
PropertyName(
PropertyType) : void
).
The {@link javax.sql.XADataSource} interface is almost identical to the {@link javax.sql.DataSource}interface, but rather than returning {@link java.sql.Connection} instances, there are methods thatreturn {@link javax.sql.XAConnection} instances that can be used with distributed transactions.
The following are the properties for this DataSource:
Property Name | Type | Description |
portNumber | int | The port number where a Teiid Server is listening for requests. |
serverName | String | The hostname or IP address of the Teiid Server. |
If "serverName" property is not set then data source will try to create a embedded connection to the Teiid server.
|
return DriverManager.getConnection(url,"user", "user");
}
static Connection getDataSourceConnection(String host, String port, String vdb) throws Exception {
TeiidDataSource ds = new TeiidDataSource();
ds.setDatabaseName(vdb);
ds.setUser("user");
ds.setPassword("user");
ds.setServerName(host);
ds.setPortNumber(Integer.valueOf(port));
ds.setShowPlan("on"); //turn show plan on
return ds.getConnection();
}
|
| Connection getConnection(String vdbName) throws Exception;
}
static class ServerDatasourceConnection implements DataSourceFactory {
public Connection getConnection(String vdbName) throws Exception {
TeiidDataSource ds = new TeiidDataSource();
ds.setUser(user);
ds.setPassword(password);
ds.setServerName("localhost");
ds.setPortNumber(31000);
ds.setDatabaseName(vdbName);
ds.setAutoCommitTxn("DETECT");
return ds.getConnection();
}
|
Related Classes of org.teiid.jdbc.TeiidDataSource
Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact
coftware#gmail.com.