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

Can I use java.sql.Connection? #303

Closed
KenjiOhtsuka opened this issue May 14, 2018 · 5 comments
Closed

Can I use java.sql.Connection? #303

KenjiOhtsuka opened this issue May 14, 2018 · 5 comments

Comments

@KenjiOhtsuka
Copy link

Can I use java.sql.Connection to connect the database?

like as follows

val connection = (java.sql.Connection instance)
Database.connect(connection)
@Tapac
Copy link
Contributor

Tapac commented May 14, 2018

Database.connect({ connection })

@Tapac Tapac closed this as completed May 14, 2018
@KenjiOhtsuka
Copy link
Author

@Tapac Thank you

@andreas-mausch
Copy link

I've tried this, but the connection is closed by a transaction.

Debugging led me here:

The connection should stay open, the TransactionManager shouldn't close a connection it hasn't established.

@Tapac
Copy link
Contributor

Tapac commented May 8, 2020

@andreas-mausch it's not expected that you manage connections manually.
What the use-case?

@andreas-mausch
Copy link

andreas-mausch commented May 8, 2020

I experimented with some database migration tools and flyway provides a java.sql.Connection in their context object (see an example here: https://flywaydb.org/getstarted/java). And they expect the migration to not close the connection, which is reasonable.

This is related to #165.

If it's not possible to use the connection they provide, I think I cannot use flyway and will have a look at harmonica.

Edit: I've also tried to use their DataSource to create a new connection, but when I do this I run into locking problems with my sqlite database.

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

No branches or pull requests

3 participants