Search in sources :

Example 11 with JdbcConnection

use of com.adaptris.core.jdbc.JdbcConnection in project interlok by adaptris.

the class JdbcQueryServiceCase method createMetadataServiceNoResult.

protected static JdbcDataQueryService createMetadataServiceNoResult() {
    JdbcDataQueryService service = new JdbcDataQueryService();
    JdbcConnection connection = new JdbcConnection(PROPERTIES.getProperty(JDBC_QUERYSERVICE_URL), PROPERTIES.getProperty(JDBC_QUERYSERVICE_DRIVER));
    service.setConnection(connection);
    service.setStatementCreator(new ConfiguredSQLStatement(QUERY_SQL_NO_RESULT));
    return service;
}
Also used : JdbcConnection(com.adaptris.core.jdbc.JdbcConnection)

Example 12 with JdbcConnection

use of com.adaptris.core.jdbc.JdbcConnection in project interlok by adaptris.

the class JdbcBatchingDataCaptureServiceTest method createJdbcConnection.

@Override
protected JdbcConnection createJdbcConnection() {
    JdbcConnection connection = super.createJdbcConnection();
    connection.setAutoCommit(false);
    return connection;
}
Also used : JdbcConnection(com.adaptris.core.jdbc.JdbcConnection)

Example 13 with JdbcConnection

use of com.adaptris.core.jdbc.JdbcConnection in project interlok by adaptris.

the class StaticIdentitySequenceNumberServiceTest method retrieveObjectForSampleConfig.

@Override
protected StaticIdentitySequenceNumberService retrieveObjectForSampleConfig() {
    JdbcConnection connection = new JdbcConnection();
    connection.setConnectUrl("jdbc:mysql://localhost:3306/mydatabase");
    connection.setConnectionAttempts(2);
    connection.setConnectionRetryInterval(new TimeInterval(3L, "SECONDS"));
    StaticIdentitySequenceNumberService service = new StaticIdentitySequenceNumberService();
    service.setIdentity("adaptrismsg");
    service.setMetadataKey("sequence_no");
    service.setNumberFormat(DEFAULT_NUMBER_FORMAT);
    service.setConnection(connection);
    service.setOverflowBehaviour(AbstractJdbcSequenceNumberService.OverflowBehaviour.Continue);
    return service;
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) JdbcConnection(com.adaptris.core.jdbc.JdbcConnection)

Example 14 with JdbcConnection

use of com.adaptris.core.jdbc.JdbcConnection in project interlok by adaptris.

the class JdbcRawDataCaptureServiceTest method retrieveObjectForSampleConfig.

@Override
protected JdbcRawDataCaptureService retrieveObjectForSampleConfig() {
    JdbcRawDataCaptureService service = createService();
    JdbcConnection connection = new JdbcConnection();
    connection.setConnectUrl("jdbc:mysql://localhost:3306/mydatabase");
    connection.setConnectionAttempts(2);
    connection.setConnectionRetryInterval(new TimeInterval(3L, "SECONDS"));
    service.setConnection(connection);
    return service;
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) JdbcConnection(com.adaptris.core.jdbc.JdbcConnection)

Example 15 with JdbcConnection

use of com.adaptris.core.jdbc.JdbcConnection in project interlok by adaptris.

the class JdbcRawDataCaptureServiceTest method createServiceNamedParameters.

private JdbcRawDataCaptureService createServiceNamedParameters(boolean createConnection) {
    JdbcRawDataCaptureService service = new JdbcRawDataCaptureService();
    if (createConnection) {
        JdbcConnection connection = new JdbcConnection();
        connection.setConnectUrl(PROPERTIES.getProperty(JDBC_CAPTURE_SERVICE_URL));
        connection.setDriverImp(PROPERTIES.getProperty(JDBC_CAPTURE_SERVICE_DRIVER));
        service.setConnection(connection);
    }
    service.setParameterApplicator(new NamedParameterApplicator());
    StatementParameter param1 = new StatementParameter(METADATA_KEY, "java.lang.String", StatementParameter.QueryType.metadata);
    param1.setName("param1");
    service.addStatementParameter(param1);
    DateStatementParameter param2 = new DateStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"));
    param2.setName("param2");
    service.addStatementParameter(param2);
    TimestampStatementParameter param3 = new TimestampStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"));
    param3.setName("param3");
    service.addStatementParameter(param3);
    TimeStatementParameter param4 = new TimeStatementParameter("timestamp", StatementParameter.QueryType.metadata, new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"));
    param4.setName("param4");
    service.addStatementParameter(param4);
    StatementParameter param5 = new StatementParameter(null, "java.lang.String", StatementParameter.QueryType.payload);
    param5.setName("param5");
    service.addStatementParameter(param5);
    BytePayloadStatementParameter param6 = new BytePayloadStatementParameter();
    param6.setName("param6");
    service.addStatementParameter(param6);
    CharacterStreamStatementParameter param7 = new CharacterStreamStatementParameter();
    param7.setName("param7");
    service.addStatementParameter(param7);
    BinaryStreamStatementParameter param8 = new BinaryStreamStatementParameter();
    param8.setName("param8");
    service.addStatementParameter(param8);
    StatementParameter param9 = new StatementParameter(null, "java.lang.String", StatementParameter.QueryType.id);
    param9.setName("param9");
    service.addStatementParameter(param9);
    StatementParameter param10 = new StatementParameter(CONSTANT_VALUE, "java.lang.String", StatementParameter.QueryType.constant);
    param10.setName("param10");
    service.addStatementParameter(param10);
    service.setStatement("insert into jdbc_raw_data_capture_basic " + "(string_value, date_value, timestamp_value, time_value, payload_clob, payload_blob, payload_clob2, payload_blob2, id_value, constant_value) " + "values (#param1, #param2, #param3, #param4, #param5, #param6, #param7, #param8, #param9, #param10)");
    return service;
}
Also used : BytePayloadStatementParameter(com.adaptris.core.services.jdbc.BytePayloadStatementParameter) CharacterStreamStatementParameter(com.adaptris.core.services.jdbc.CharacterStreamStatementParameter) DateStatementParameter(com.adaptris.core.services.jdbc.DateStatementParameter) BinaryStreamStatementParameter(com.adaptris.core.services.jdbc.BinaryStreamStatementParameter) TimeStatementParameter(com.adaptris.core.services.jdbc.TimeStatementParameter) TimestampStatementParameter(com.adaptris.core.services.jdbc.TimestampStatementParameter) BinaryStreamStatementParameter(com.adaptris.core.services.jdbc.BinaryStreamStatementParameter) TimestampStatementParameter(com.adaptris.core.services.jdbc.TimestampStatementParameter) DateStatementParameter(com.adaptris.core.services.jdbc.DateStatementParameter) BytePayloadStatementParameter(com.adaptris.core.services.jdbc.BytePayloadStatementParameter) TimeStatementParameter(com.adaptris.core.services.jdbc.TimeStatementParameter) StatementParameter(com.adaptris.core.services.jdbc.StatementParameter) CharacterStreamStatementParameter(com.adaptris.core.services.jdbc.CharacterStreamStatementParameter) JdbcConnection(com.adaptris.core.jdbc.JdbcConnection) NamedParameterApplicator(com.adaptris.core.services.jdbc.NamedParameterApplicator) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

JdbcConnection (com.adaptris.core.jdbc.JdbcConnection)30 TimeInterval (com.adaptris.util.TimeInterval)6 Test (org.junit.Test)6 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)4 BinaryStreamStatementParameter (com.adaptris.core.services.jdbc.BinaryStreamStatementParameter)3 BytePayloadStatementParameter (com.adaptris.core.services.jdbc.BytePayloadStatementParameter)3 CharacterStreamStatementParameter (com.adaptris.core.services.jdbc.CharacterStreamStatementParameter)3 DateStatementParameter (com.adaptris.core.services.jdbc.DateStatementParameter)3 StatementParameter (com.adaptris.core.services.jdbc.StatementParameter)3 TimeStatementParameter (com.adaptris.core.services.jdbc.TimeStatementParameter)3 TimestampStatementParameter (com.adaptris.core.services.jdbc.TimestampStatementParameter)3 SimpleDateFormat (java.text.SimpleDateFormat)3 ServiceException (com.adaptris.core.ServiceException)2 JdbcService (com.adaptris.core.jdbc.JdbcService)2 KeyValuePair (com.adaptris.util.KeyValuePair)2 KeyValuePairSet (com.adaptris.util.KeyValuePairSet)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 CoreException (com.adaptris.core.CoreException)1 XStreamMarshaller (com.adaptris.core.XStreamMarshaller)1