I am currently on Exposed `0.17.3` and I'm trying ...
# exposed
k
I am currently on Exposed
0.17.3
and I'm trying to upgrade to
0.25.1
. A recent change has meant that I am seeing the following error when using
Database.connect
with `org.apache.tomcat.jdbc.pool.DataSource`:
Copy code
Overload resolution ambiguity. All these functions match.
public final fun connect(datasource: ConnectionPoolDataSource, setupConnection: (Connection) → Unit = ..., manager: (Database) → TransactionManager = ...): Database defined in org.jetbrains.exposed.sql.Database.Companion
public final fun connect(datasource: DataSource, setupConnection: (Connection) → Unit = ..., manager: (Database) → TransactionManager = ...): Database defined in org.jetbrains.exposed.sql.Database.Companion
I can successfully upgrade from
0.17.3
to
0.17.7
It looks like this change was first added in
0.18.1
It's unclear how Exposed is supposed to be used going forwards with a connection pool
In my case, I'm using Tomcat to allow usage of
com.amazonaws.xray.sql.postgres.TracingInterceptor
for distributed tracing in AWS
If it's any help, I'm using PostgreSQL 10
j
k
I have not! It wasn't showing up in the sidebar for me
Screenshot from 2020-06-02 17-15-33.png
This is great. I'll take a look now
Interestingly, all of the migration information is about swapping out the
Connection
variants. I'm using a
org.apache.tomcat.jdbc.pool.DataSource
which implements both
javax.sql.DataSource
and
javax.sql.ConnectionPoolDataSource
leading to the error in OP
I've figured it out. Looks like all I needed to do was swap:
Copy code
Database.connect(dataSource)
For:
Copy code
Database.connect({ dataSource.connection })
Actually, that may not have worked 🤔
I've created the following issue: https://github.com/JetBrains/Exposed/issues/938
My hope is that, once solved, it may also help someone who is searching for the same problem
For those who might come across this, the problem is going to be solved in the next release of Exposed. See the GitHub issue above for details on the change.