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

JTOpen Toolbox driver 11.1 JDBC connections fail from Open Liberty to IBM i #23690

Closed
gjwatts opened this issue Dec 14, 2022 · 0 comments · Fixed by #23698
Closed

JTOpen Toolbox driver 11.1 JDBC connections fail from Open Liberty to IBM i #23690

gjwatts opened this issue Dec 14, 2022 · 0 comments · Fixed by #23698
Assignees
Labels
release bug This bug is present in a released version of Open Liberty release:23001 team:Zombie Apocalypse

Comments

@gjwatts
Copy link
Member

gjwatts commented Dec 14, 2022

Describe the bug
When using the IBM JTOpen toolbox driver 11.1 to establish a JDBC connect with an IBM i system, the connection fails with the following error:
{exception=The application server rejected the connection. (Password is not set.) DSRA0010E: SQL State = 08004, Error Code = -99,999, id=jdbc/database}

and stacktrace:

[INFO] [WARNING ] DSRA8021W: Warning: error setting 'password'=******: java.lang.NoSuchMethodException: [C.<init>(java.lang.String)
[INFO]  at java.base/java.lang.Class.getConstructor0(Class.java:3585)
[INFO]  at java.base/java.lang.Class.getConstructor(Class.java:2271)
[INFO]  at com.ibm.ws.jdbc.internal.JDBCDriverService.setProperty(JDBCDriverService.java:1005)
[INFO]  at com.ibm.ws.jdbc.internal.JDBCDriverService.access$200(JDBCDriverService.java:76)
[INFO]  at com.ibm.ws.jdbc.internal.JDBCDriverService$1.run(JDBCDriverService.java:301)
[INFO]  at com.ibm.ws.jdbc.internal.JDBCDriverService$1.run(JDBCDriverService.java:262)
[INFO]  at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
[INFO]  at com.ibm.ws.jdbc.internal.JDBCDriverService.create(JDBCDriverService.java:262)
[INFO]  at com.ibm.ws.jdbc.internal.JDBCDriverService.createAnyPreferLegacyOrder(JDBCDriverService.java:405)
[INFO]  at com.ibm.ws.jdbc.DataSourceService.init(DataSourceService.java:608)
[INFO]  at com.ibm.ws.jca.cm.AbstractConnectionFactoryService$2.run(AbstractConnectionFactoryService.java:522)
[INFO]  at com.ibm.ws.jca.cm.AbstractConnectionFactoryService$2.run(AbstractConnectionFactoryService.java:519)
[INFO]  at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
[INFO]  at com.ibm.ws.jca.cm.AbstractConnectionFactoryService.initPrivileged(AbstractConnectionFactoryService.java:519)
[INFO]  at com.ibm.ws.jca.cm.AbstractConnectionFactoryService.createResource(AbstractConnectionFactoryService.java:149)
...

This problem was initially reported against the JTOpen team here, but they determined their change to deprecate setPassword(String) and replace it with setPassword(char[]) exposed a hole in our code to be able to handle char[] values for passwords sent into our com.ibm.ws.jdbc.internal.JDBCDriverService.setProperty() method.

This worked fine in JTOpen 11.0 and earlier.

Steps to Reproduce
Use the JTOpen toolbox driver 11.1 (or newer) and attempt to connect to an IBM i system using the JTOpen setPassword(char[]) method.

Expected behavior
The correct password value be used an allow the connection to complete successfully.

Diagnostic information:

  • OpenLiberty Version: 22.0.0.12 and earlier
  • Affected feature(s) JDBC
  • Java Version: Java 11 & 17

server.xml

<server>
    <dataSource id="DB_JDBC" jndiName="jdbc/database" transactional="false" isolationLevel="TRANSACTION_NONE">
        <connectionManager minPoolSize="1" maxPoolSize="5"/>
        <jdbcDriver libraryRef="toolbox-lib"/>
        <properties.db2.i.toolbox
                databaseName="mydb"
                serverName="myserver"
                libraries="lib1,lib2"
                user="user"
                password="pass"
                autoCommit="false"
                transactionIsolation="none"
                naming="system"
                dateSeparator="-"
                timeSeparator="."
                timeFormat="iso"
                dateFormat="iso"
        />
    </dataSource>

    <library id="toolbox-lib">
        <fileset dir="${server.config.dir}/lib" includes="jt400*.jar"/>
    </library>
</server>
@gjwatts gjwatts added team:Zombie Apocalypse release bug This bug is present in a released version of Open Liberty labels Dec 14, 2022
@gjwatts gjwatts self-assigned this Dec 14, 2022
@gjwatts gjwatts changed the title JTOpen Toolbox driver 11.1 JDBC connection fails with Open Liberty JTOpen Toolbox driver 11.1 JDBC connection fails from Open Liberty to IBM i Dec 14, 2022
@gjwatts gjwatts changed the title JTOpen Toolbox driver 11.1 JDBC connection fails from Open Liberty to IBM i JTOpen Toolbox driver 11.1 JDBC connections fail from Open Liberty to IBM i Dec 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release bug This bug is present in a released version of Open Liberty release:23001 team:Zombie Apocalypse
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants