Skip to content

chakra-coder/jasync-sql

 
 

Repository files navigation

The main goal for this project is to implement simple, async, performant and reliable database drivers for PostgreSQL and MySQL in Kotlin. This is not supposed to be a JDBC replacement, these drivers aim to cover the common process of send a statement, get a response that you usually see in applications out there. So it's unlikely there will be support for updating result sets live or stuff like that.

Show your ❤ with a ★

Getting started

// 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()

See a full example at jasync-mysql-example.

Download

Maven

<dependency>
  <groupId>com.github.jasync-sql</groupId>
  <artifactId>jasync-mysql</artifactId>
  <version>0.8.21</version>
</dependency>
<!-- add jcenter repo: -->
<repositories>
  <repository>
    <id>jcenter</id>
    <url>https://jcenter.bintray.com/</url>
  </repository>
</repositories>

Gradle

dependencies {
  compile 'com.github.jasync-sql:jasync-mysql:0.8.21'
}
// add jcenter repo:
repositories {
    jcenter()
}

Overview

This project is a port of mauricio/postgresql-async to Kotlin.
Why? Because the original lib is not maintained anymore, We use it in ob1k, and would like to remove the Scala dependency in ob1k.

This project always returns JodaTime when dealing with date types and not the java.util.Date class. (We plan to move to jdk-8 dates).

If you want information specific to the drivers, check the PostgreSQL README and the MySQL README.

You can view the project's CHANGELOG here.

Who is using it

Support

More links

Contributing

Pull requests are welcome!
See CONTRIBUTING.

About

Java async database driver for MySQL and PostgreSQL written in Kotlin

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 96.4%
  • Java 3.0%
  • Shell 0.6%