private Connection getConnection() throws SQLException { Connection connection = ConnectionFactory.getInstance().getConnection( jdbcConnectionConfiguration); return connection; }
public GeneratedKey(String column, String configuredSqlStatement, boolean isIdentity, String type) { super(); this.column = column; this.type = type; this.isIdentity = isIdentity; this.configuredSqlStatement = configuredSqlStatement; DatabaseDialects dialect = DatabaseDialects .getDatabaseDialect(configuredSqlStatement); if (dialect == null) { this.runtimeSqlStatement = configuredSqlStatement; } else { this.runtimeSqlStatement = dialect.getIdentityRetrievalStatement(); } }
@Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof ActualTableName)) { return false; } return obj.toString().equals(this.toString()); }
private List<IntrospectedTable> calculateIntrospectedTables(TableConfiguration tc, Map<ActualTableName, List<IntrospectedColumn>> columns) { boolean delimitIdentifiers = tc.isDelimitIdentifiers() || stringContainsSpace(tc.getCatalog()) || stringContainsSpace(tc.getSchema()) || stringContainsSpace(tc.getTableName()); List<IntrospectedTable> answer = new ArrayList<IntrospectedTable>(); for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns.entrySet()) { ActualTableName atn = entry.getKey(); // we only use the returned catalog and schema if something was // actually // specified on the table configuration. If something was returned // from the DB for these fields, but nothing was specified on the // table // configuration, then some sort of DB default is being returned // and we don't want that in our SQL FullyQualifiedTable table = new FullyQualifiedTable(stringHasValue(tc.getCatalog()) ? atn.getCatalog() : null, stringHasValue(tc.getSchema()) ? atn.getSchema() : null, atn.getTableName(), tc.getDomainObjectName(), tc.getAlias(), isTrue(tc.getProperty(PropertyRegistry.TABLE_IGNORE_QUALIFIERS_AT_RUNTIME)), tc.getProperty(PropertyRegistry.TABLE_RUNTIME_CATALOG), tc.getProperty(PropertyRegistry.TABLE_RUNTIME_SCHEMA), tc.getProperty(PropertyRegistry.TABLE_RUNTIME_TABLE_NAME), delimitIdentifiers, context); IntrospectedTable introspectedTable = ObjectFactory.createIntrospectedTable(tc, table, context); for (IntrospectedColumn introspectedColumn : entry.getValue()) { introspectedTable.addColumn(introspectedColumn); } calculatePrimaryKey(table, introspectedTable); answer.add(introspectedTable); } return answer; }
private void calculateIdentityColumns(TableConfiguration tc, Map<ActualTableName, List<IntrospectedColumn>> columns) { GeneratedKey gk = tc.getGeneratedKey(); if (gk == null) { // no generated key, then no identity or sequence columns return; } for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns.entrySet()) { for (IntrospectedColumn introspectedColumn : entry.getValue()) { if (isMatchedColumn(introspectedColumn, gk)) { if (gk.isIdentity() || gk.isJdbcStandard()) { introspectedColumn.setIdentity(true); introspectedColumn.setSequenceColumn(false); } else { introspectedColumn.setIdentity(false); introspectedColumn.setSequenceColumn(true); } } } } }
public Connection getConnection(JDBCConnectionConfiguration config) throws SQLException { Driver driver = getDriver(config); Properties props = new Properties(); if (stringHasValue(config.getUserId())) { props.setProperty("user", config.getUserId()); //$NON-NLS-1$ } if (stringHasValue(config.getPassword())) { props.setProperty("password", config.getPassword()); //$NON-NLS-1$ } props.putAll(config.getProperties()); Connection conn = driver.connect(config.getConnectionURL(), props); if (conn == null) { throw new SQLException(getString("RuntimeError.7")); //$NON-NLS-1$ } return conn; }
public Connection getConnection() throws SQLException { Connection connection = ConnectionFactory.getInstance().getConnection(jdbcConnectionConfiguration); return connection; }
/** * */ public GeneratedKey(String column, String configuredSqlStatement, boolean isIdentity, String type) { super(); this.column = column; this.type = type; this.isIdentity = isIdentity; this.configuredSqlStatement = configuredSqlStatement; DatabaseDialects dialect = DatabaseDialects.getDatabaseDialect(configuredSqlStatement); if (dialect == null) { this.runtimeSqlStatement = configuredSqlStatement; } else { this.runtimeSqlStatement = dialect.getIdentityRetrievalStatement(); } }
@Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof ActualTableName)) { return false; } return obj.toString().equals(this.toString()); }
private void calculateIdentityColumns(TableConfiguration tc, Map<ActualTableName, List<IntrospectedColumn>> columns) { GeneratedKey gk = tc.getGeneratedKey(); if (gk == null) { // no generated key, then no identity or sequence columns return; } for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns .entrySet()) { for (IntrospectedColumn introspectedColumn : entry.getValue()) { if (isMatchedColumn(introspectedColumn, gk)) { if (gk.isIdentity() || gk.isJdbcStandard()) { introspectedColumn.setIdentity(true); introspectedColumn.setSequenceColumn(false); } else { introspectedColumn.setIdentity(false); introspectedColumn.setSequenceColumn(true); } } } } }
public Connection getConnection(JDBCConnectionConfiguration config) throws SQLException { Driver driver = getDriver(config); Properties props = new Properties(); if (stringHasValue(config.getUserId())) { props.setProperty("user", config.getUserId()); //$NON-NLS-1$ } if (stringHasValue(config.getPassword())) { props.setProperty("password", config.getPassword()); //$NON-NLS-1$ } props.putAll(config.getProperties()); Connection conn = driver.connect(config.getConnectionURL(), props); if (conn == null) { throw new SQLException(getString("RuntimeError.7")); //$NON-NLS-1$ } return conn; }
private Connection getConnection() throws SQLException { Connection connection = ConnectionFactory.getInstance().getConnection(jdbcConnectionConfiguration); return connection; }
/** * */ public GeneratedKey(String column, String configuredSqlStatement, boolean isIdentity, String type) { super(); this.column = column; this.type = type; this.isIdentity = isIdentity; this.configuredSqlStatement = configuredSqlStatement; DatabaseDialects dialect = DatabaseDialects .getDatabaseDialect(configuredSqlStatement); if (dialect == null) { this.runtimeSqlStatement = configuredSqlStatement; } else { this.runtimeSqlStatement = dialect.getIdentityRetrievalStatement(); } }
@Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof ActualTableName)) { return false; } return obj.toString().equals(this.toString()); }
private void calculateIdentityColumns(TableConfiguration tc, Map<ActualTableName, List<IntrospectedColumn>> columns) { GeneratedKey gk = tc.getGeneratedKey(); if (gk == null) { // no generated key, then no identity or sequence columns return; } for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns .entrySet()) { for (IntrospectedColumn introspectedColumn : entry.getValue()) { if (isMatchedColumn(introspectedColumn, gk)) { if (gk.isIdentity() || gk.isJdbcStandard()) { introspectedColumn.setIdentity(true); introspectedColumn.setSequenceColumn(false); } else { introspectedColumn.setIdentity(false); introspectedColumn.setSequenceColumn(true); } } } } }
public Connection getConnection(JDBCConnectionConfiguration config) throws SQLException { Driver driver = getDriver(config); Properties props = new Properties(); if (stringHasValue(config.getUserId())) { props.setProperty("user", config.getUserId()); //$NON-NLS-1$ } if (stringHasValue(config.getPassword())) { props.setProperty("password", config.getPassword()); //$NON-NLS-1$ } if (stringHasValue(config.getRemarksReporting())) { props.setProperty("remarksReporting", config.getRemarksReporting()); //$NON-NLS-1$ } else { props.setProperty("remarksReporting", "true"); //$NON-NLS-1$ } props.putAll(config.getProperties()); Connection conn = driver.connect(config.getConnectionURL(), props); if (conn == null) { throw new SQLException(getString("RuntimeError.7")); //$NON-NLS-1$ } return conn; }
@Override public boolean validate(List<String> warnings) { boolean valid = true; srid = properties.getProperty(SRID_NAME); if(StringUtils.isEmpty(srid)){ srid = "3857"; } if(connection == null){ try { connection = ConnectionFactory.getInstance().getConnection(context.getJdbcConnectionConfiguration()); } catch (SQLException e) { e.printStackTrace(); valid = false; } } elementsList = FieldUtils.getField(XmlElement.class, "elements", true); return valid; }
/** * */ public GeneratedKey(String column, String configuredSqlStatement, boolean isIdentity, String type) { super(); this.column = column; this.type = type; this.isIdentity = isIdentity; this.configuredSqlStatement = configuredSqlStatement; DatabaseDialects dialect = DatabaseDialects .getDatabaseDialect(configuredSqlStatement); if (dialect == null) { this.runtimeSqlStatement = configuredSqlStatement; } else { this.runtimeSqlStatement = dialect.getIdentityRetrievalStatement(); } }
@Override public boolean equals(Object obj) { if (obj == null || !(obj instanceof ActualTableName)) { return false; } return obj.toString().equals(this.toString()); }
private void calculateIdentityColumns(TableConfiguration tc, Map<ActualTableName, List<IntrospectedColumn>> columns) { GeneratedKey gk = tc.getGeneratedKey(); if (gk == null) { // no generated key, then no identity or sequence columns return; } for (Map.Entry<ActualTableName, List<IntrospectedColumn>> entry : columns .entrySet()) { for (IntrospectedColumn introspectedColumn : entry.getValue()) { if (isMatchedColumn(introspectedColumn, gk)) { if (gk.isIdentity() || gk.isJdbcStandard()) { introspectedColumn.setIdentity(true); introspectedColumn.setSequenceColumn(false); } else { introspectedColumn.setIdentity(false); introspectedColumn.setSequenceColumn(true); } } } } }