programing

connect to maria db with mauricio/postgresql-mysql driver in play2.5

minimums 2023. 11. 4. 10:32
반응형

connect to maria db with mauricio/postgresql-mysql driver in play2.5

is it possible to use mauricio/mysql-async driver in scala and play2.5 to connect to mariadb database? I am using jooq now with the mariadb-java-client currently.

Do you know of any async mariadb driver for scala/play, or oes any of you have maybe an example of config with the mysql-async driver from mauricio for mysql or mariadb?

Have you tried to use play-slick?

just by googling found successful examples:

If it's still relevant, have a look at jasync-sql (Disclaimer: I am working on it). It is a port of Mauricio lib that works with mysql so should work with MariaDB as well.

It is used like this:

  // Connect to DB
  Connection connection = new MySQLConnection(
  new Configuration(
    "username",
    "host.com",
    3306,
    "password",
    "schema"
  )
);
CompletableFuture<?> connectFuture = connection.connect()
// Wait for connection to be ready   
// ...    
// Execute query
CompletableFuture<QueryResult> future =             
connection.sendPreparedStatement("select * from table");
// Close the connection
connection.disconnect().get()

You can read more on the wiki: https://github.com/jasync-sql/jasync-sql/wiki

ReferenceURL : https://stackoverflow.com/questions/41515915/connect-to-maria-db-with-mauricio-postgresql-mysql-driver-in-play2-5

반응형