|
5 | 5 | */ |
6 | 6 | package io.debezium.connector.informix; |
7 | 7 |
|
8 | | -import java.io.PrintWriter; |
9 | | -import java.sql.Connection; |
10 | 8 | import java.sql.SQLException; |
11 | | -import java.sql.SQLFeatureNotSupportedException; |
12 | 9 | import java.time.Instant; |
13 | 10 | import java.util.Optional; |
14 | 11 |
|
|
18 | 15 | import org.slf4j.LoggerFactory; |
19 | 16 |
|
20 | 17 | import com.informix.jdbc.IfxDriver; |
| 18 | +import com.informix.jdbcx.IfxDataSource; |
21 | 19 |
|
22 | 20 | import io.debezium.DebeziumException; |
23 | 21 | import io.debezium.config.CommonConnectorConfig; |
@@ -176,60 +174,9 @@ public String quoteIdentifier(String columnName) { |
176 | 174 | return InformixIdentifierQuoter.quoteIfNecessary(columnName); |
177 | 175 | } |
178 | 176 |
|
179 | | - public DataSource datasource() { |
180 | | - return new DataSource() { |
181 | | - private PrintWriter logWriter; |
182 | | - |
183 | | - @Override |
184 | | - public Connection getConnection() throws SQLException { |
185 | | - return connection(); |
186 | | - } |
187 | | - |
188 | | - @Override |
189 | | - public Connection getConnection(String username, String password) throws SQLException { |
190 | | - JdbcConfiguration config = JdbcConfiguration.copy(config()).withUser(username).withPassword(password).build(); |
191 | | - return FACTORY.connect(config); |
192 | | - } |
193 | | - |
194 | | - @Override |
195 | | - public PrintWriter getLogWriter() { |
196 | | - return this.logWriter; |
197 | | - } |
198 | | - |
199 | | - @Override |
200 | | - public void setLogWriter(PrintWriter out) { |
201 | | - this.logWriter = out; |
202 | | - } |
203 | | - |
204 | | - @Override |
205 | | - public void setLoginTimeout(int seconds) { |
206 | | - throw new UnsupportedOperationException("setLoginTimeout"); |
207 | | - } |
208 | | - |
209 | | - @Override |
210 | | - public int getLoginTimeout() { |
211 | | - return (int) config().getConnectionTimeout().toSeconds(); |
212 | | - } |
213 | | - |
214 | | - @Override |
215 | | - public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException { |
216 | | - return java.util.logging.Logger.getLogger("io.debezium.connector.informix"); |
217 | | - } |
218 | | - |
219 | | - @Override |
220 | | - @SuppressWarnings("unchecked") |
221 | | - public <T> T unwrap(Class<T> iface) throws SQLException { |
222 | | - if (iface.isInstance(this)) { |
223 | | - return (T) this; |
224 | | - } |
225 | | - throw new SQLException("DataSource of type [" + getClass().getName() + "] cannot be unwrapped as [" + iface.getName() + "]"); |
226 | | - } |
227 | | - |
228 | | - @Override |
229 | | - public boolean isWrapperFor(Class<?> iface) throws SQLException { |
230 | | - return iface.isInstance(this); |
231 | | - } |
232 | | - }; |
| 177 | + public DataSource datasource() throws SQLException { |
| 178 | + IfxDataSource datasource = new IfxDataSource(connectionString()); |
| 179 | + datasource.getDsProperties().putAll(config().withoutKnownFields().asProperties()); |
| 180 | + return datasource; |
233 | 181 | } |
234 | | - |
235 | 182 | } |
0 commit comments