use of com.sldeditor.common.data.DatabaseConnectionField in project sldeditor by robward-scisys.
the class DatabaseConnectionFactory method createTeradata.
/**
* Creates a new DatabaseConnection object for Teradata.
*
* @return the database connection
*/
public static DatabaseConnection createTeradata() {
List<DatabaseConnectionField> list = new ArrayList<DatabaseConnectionField>();
list.add(new DatabaseConnectionField(TeradataDataStoreFactory.HOST));
list.add(new DatabaseConnectionField(TeradataDataStoreFactory.PORT));
list.add(new DatabaseConnectionField(TeradataDataStoreFactory.DATABASE));
list.add(new DatabaseConnectionField(TeradataDataStoreFactory.USER));
list.add(new DatabaseConnectionField(TeradataDataStoreFactory.SCHEMA));
list.add(new DatabaseConnectionField(TeradataDataStoreFactory.PASSWD));
TeradataDataStoreFactory factory = new TeradataDataStoreFactory();
DatabaseConnection databaseConnection = new DatabaseConnection(TeradataDataStoreFactory.DBTYPE, factory.getDisplayName(), true, list, new DatabaseConnectionName() {
@Override
public String getConnectionName(String duplicatePrefix, int noOfTimesDuplicated, Map<String, String> properties) {
String connectionName = String.format("%s/%s@%s:%s", properties.get(TeradataDataStoreFactory.SCHEMA.key), properties.get(TeradataDataStoreFactory.DATABASE.key), properties.get(TeradataDataStoreFactory.HOST.key), properties.get(TeradataDataStoreFactory.PORT.key));
for (int i = 0; i < noOfTimesDuplicated; i++) {
connectionName = duplicatePrefix + connectionName;
}
return connectionName;
}
});
return databaseConnection;
}
Aggregations