use of nl.nn.adapterframework.jdbc.JdbcException in project iaf by ibissource.
the class Migrator method configure.
public synchronized void configure(String configurationName, ClassLoader classLoader, String changeLogFile) throws ConfigurationException {
if (configurationName == null)
throw new ConfigurationException("configurationName cannot be null");
AppConstants appConstants = AppConstants.getInstance(classLoader);
if (changeLogFile == null)
changeLogFile = appConstants.getString("liquibase.changeLogFile", "DatabaseChangelog.xml");
LiquibaseClassLoader cl = new LiquibaseClassLoader(classLoader);
if (cl.getResource(changeLogFile) == null) {
log.debug("unable to find database changelog file [" + changeLogFile + "] configuration [" + configurationName + "]");
} else {
String dataSource = appConstants.getString("jdbc.migrator.dataSource", "jdbc/" + appConstants.getResolvedProperty("instance.name.lc"));
setDatasourceName(dataSource);
try {
JdbcConnection connection = new JdbcConnection(getConnection());
instance = new LiquibaseImpl(ibisContext, cl, connection, configurationName, changeLogFile);
} catch (JdbcException e) {
throw new ConfigurationException("migrator error connecting to database [" + dataSource + "]", e);
} catch (ValidationFailedException e) {
throw new ConfigurationException("liquibase validation failed", e);
} catch (LiquibaseException e) {
throw new ConfigurationException("liquibase failed to initialize", e);
}
}
}
use of nl.nn.adapterframework.jdbc.JdbcException in project iaf by ibissource.
the class DomainTransformerPipe method configure.
public void configure() throws ConfigurationException {
super.configure();
IbisContext ibisContext = getAdapter().getConfiguration().getIbisManager().getIbisContext();
qs = (FixedQuerySender) ibisContext.createBeanAutowireByName(FixedQuerySender.class);
qs.setProxiedDataSources(proxiedDataSources);
qs.setJmsRealm(jmsRealm);
// dummy query required
qs.setQuery("SELECT count(*) FROM ALL_TABLES");
qs.configure();
Connection conn = null;
try {
conn = qs.getConnection();
if (!JdbcUtil.columnExists(conn, tableName, "*")) {
throw new ConfigurationException("The table [" + tableName + "] doesn't exist");
}
if (!JdbcUtil.columnExists(conn, tableName, labelField)) {
throw new ConfigurationException("The column [" + labelField + "] doesn't exist");
}
if (!JdbcUtil.columnExists(conn, tableName, valueInField)) {
throw new ConfigurationException("The column [" + valueInField + "] doesn't exist");
}
if (!JdbcUtil.columnExists(conn, tableName, valueOutField)) {
throw new ConfigurationException("The column [" + valueOutField + "] doesn't exist");
}
query = "SELECT " + valueOutField + " FROM " + tableName + " WHERE " + labelField + "=? AND " + valueInField + "=?";
} catch (JdbcException e) {
throw new ConfigurationException(e);
} catch (SQLException e) {
throw new ConfigurationException(e);
} finally {
JdbcUtil.close(conn);
}
}
use of nl.nn.adapterframework.jdbc.JdbcException in project iaf by ibissource.
the class WebSphereMsSqlServerDbmsSupport method updateBlob.
public void updateBlob(ResultSet rs, int column, Object blobUpdateHandle) throws SQLException, JdbcException {
File blobFile = (File) blobUpdateHandle;
try {
InputStream is = new FileInputStream(blobFile);
rs.updateBinaryStream(column, is, (int) blobFile.length());
} catch (FileNotFoundException e) {
throw new JdbcException("cannot read blob for column [" + column + "] from file [" + blobFile.toString() + "]", e);
}
}
use of nl.nn.adapterframework.jdbc.JdbcException in project iaf by ibissource.
the class WebSphereMsSqlServerDbmsSupport method updateClob.
public void updateClob(ResultSet rs, int column, Object clobUpdateHandle) throws SQLException, JdbcException {
File clobFile = (File) clobUpdateHandle;
try {
InputStream is = new FileInputStream(clobFile);
InputStreamReader isr = new InputStreamReader(is, StreamUtil.DEFAULT_INPUT_STREAM_ENCODING);
// FIXME: should use character count instead of byte count!
rs.updateCharacterStream(column, isr, (int) clobFile.length());
} catch (Exception e) {
throw new JdbcException("cannot read clob for column [" + column + "] from file [" + clobFile.toString() + "]", e);
}
}
use of nl.nn.adapterframework.jdbc.JdbcException in project iaf by ibissource.
the class WebSphereMsSqlServerDbmsSupport method updateClob.
public void updateClob(ResultSet rs, String column, Object clobUpdateHandle) throws SQLException, JdbcException {
File clobFile = (File) clobUpdateHandle;
try {
InputStream is = new FileInputStream(clobFile);
InputStreamReader isr = new InputStreamReader(is, StreamUtil.DEFAULT_INPUT_STREAM_ENCODING);
// FIXME: should use character count instead of byte count!
rs.updateCharacterStream(column, isr, (int) clobFile.length());
} catch (Exception e) {
throw new JdbcException("cannot read clob for column [" + column + "] from file [" + clobFile.toString() + "]", e);
}
}
Aggregations