Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB2 Connectivity Unchecked At Connector Initialization #39

Open
fwhippleibm opened this issue Jun 29, 2020 · 2 comments
Open

DB2 Connectivity Unchecked At Connector Initialization #39

fwhippleibm opened this issue Jun 29, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@fwhippleibm
Copy link

The JDBC sink does not make an attempt to log into the target database via JDBC until after it receives data from the intended topic(s). I suggest an initial connection attempt be made as soon as activated via REST in order to allow for easier configuration / debugging rather than finding out the connection is invalid only after data is flowing.

[2020-06-29 20:57:32,688] INFO Received 1 records. First record kafka coordinates:(inventory-0-1). Writing them to the database... (com.ibm.eventstreams.connect.jdbcsink.JDBCSinkTask:90)
[2020-06-29 20:57:32,688] INFO # of records: 1 (com.ibm.eventstreams.connect.jdbcsink.JDBCSinkTask:96)
[2020-06-29 20:57:32,691] WARN com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@2091eb53 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:  (com.mchange.v2.resourcepool.BasicResourcePool:1841)
com.ibm.db2.jcc.am.SqlInvalidAuthorizationSpecException: [jcc][t4][2013][11249][4.26.14] Connection authorization failure occurred.  Reason: User ID or Password invalid. ERRORCODE=-4214, SQLSTATE=28000
@iamgollum iamgollum added the enhancement New feature or request label Jun 30, 2020
@iamgollum
Copy link
Contributor

iamgollum commented Jun 30, 2020

@fwhippleibm thank you for identifying this and making the suggestion!
This is a serious developer UX issue and may even bleed into performance.

At a quick glance, it seems like the solution to this is initializing the DatabaseFactory here

  /**
     * Start this Connector. This method will only be called on a clean Connector, i.e. it has
     * either just been instantiated and initialized or {@link #stop()} has been invoked.
     *
     * @param props configuration settings
     */
    @Override public void start(Map<String, String> props) {
        this.props = props;

      // ADDITION: from JdbcSInkTask

      DatabaseFactory databaseFactory = new DatabaseFactory();
        try {
            this.database = databaseFactory.makeDatabase(this.config);
        } catch (Exception e) {
            logger.error("Failed to build the database {} ", e);
            e.printStackTrace();
            throw e;
        }

       // TODO Additional tests...
    }

@fwhippleibm if you want to take a stab at this - go for it!
If not the team will let you know when we will get to it.

Thank you again!

@AyamiOhhira
Copy link

I have a similar problem. The JDBC sink connector can not update the table of Db2.
I'm not sure the way to solve it. Could you tell me how to solve the errors? Could you tell me which file should I edit ?
Error messages are to the following.

[2021-12-29 17:41:25,806] ERROR [jdbc-sink-connector|task-0] java.sql.SQLException: Connections could not be acquired from the underlying database! (com.ibm.eventstreams.connect.jdbcsink.JDBCSinkTask:151)
[2021-12-29 17:41:25,807] ERROR [jdbc-sink-connector|task-0] Write of 1 records failed, remainingRetries=0 (com.ibm.eventstreams.connect.jdbcsink.JDBCSinkTask:106)
java.sql.SQLException: Connections could not be acquired from the underlying database!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants