ScalikeJDBC alternatives and similar packages
Based on the "Database" category.
Alternatively, view ScalikeJDBC alternatives based on common mentions on social networks and blogs.
-
Slick
Slick (Scala Language Integrated Connection Kit) is a modern database query and access library for Scala -
Elastic4s
Elasticsearch Scala Client - Reactive, Non Blocking, Type Safe, HTTP Client -
PostgreSQL and MySQL async
Async database drivers to talk to PostgreSQL and MySQL in Scala. -
scala-redis
A scala library for connecting to a redis server, or a cluster of redis nodes using consistent hashing on the client side. -
Phantom
Schema safe, type-safe, reactive Scala driver for Cassandra/Datastax Enterprise -
ReactiveMongo
:leaves: Non-blocking, Reactive MongoDB Driver for Scala -
rediscala
Non-blocking, Reactive Redis driver for Scala (with Sentinel support) -
Squeryl
A Scala DSL for talking with databases with minimum verbosity and maximum type safety -
mongo-scala-driver
A modern idiomatic MongoDB Scala Driver. -
Scala ActiveRecord
ActiveRecord-like ORM library for Scala -
SwayDB
Persistent and in-memory key-value storage engine for JVM that scales on a single machine. -
Pulsar4s
Idiomatic, typesafe, and reactive Scala client for Apache Pulsar -
scredis
Non-blocking, ultra-fast Scala Redis client built on top of Akka IO, used in production at Livestream -
Scala-Forklift
Type-safe data migration tool for Slick, Git and beyond. -
AnormCypher
Neo4j Scala library based on Anorm in the Play Framework -
neotypes
Scala lightweight, type-safe, asynchronous driver for neo4j -
Scruid
Scala + Druid: Scruid. A library that allows you to compose queries in Scala, and parse the result back into typesafe classes. -
Clickhouse-scala-client
Clickhouse Scala Client with Reactive Streams support -
Tepkin
Reactive MongoDB Driver for Scala built on top of Akka IO and Akka Streams. -
Couchbase
The Couchbase Monorepo for JVM Clients: Java, Scala, io-core… -
ScalaRelational
Type-Safe framework for defining, modifying, and querying SQL databases -
lucene4s
Light-weight convenience wrapper around Lucene to simplify complex tasks and add Scala sugar. -
ReactiveNeo
[DISCONTINUED] Reactive type-safe Scala driver for Neo4J -
GCP Datastore Akka Persistence Plugin
akka-persistence-gcp-datastore is a journal and snapshot store plugin for akka-persistence using google cloud firestore in datastore mode.
Access the most powerful time series database as a service
Do you think we are missing an alternative of ScalikeJDBC or a related project?
README
ScalikeJDBC
Just write SQL and get things done!
ScalikeJDBC is a tidy SQL-based DB access library for Scala that naturally wraps JDBC and provides easy-to-use APIs.
ScalikeJDBC is practical and production-ready. Use this library for your real projects.
Gitter Chat for Casual Q&A
Getting Started
Just add ScalikeJDBC, a JDBC driver, and an slf4j implementation to your sbt build settings:
libraryDependencies ++= Seq(
"org.scalikejdbc" %% "scalikejdbc" % "3.5.+",
"com.h2database" % "h2" % "1.4.+",
"ch.qos.logback" % "logback-classic" % "1.2.+"
)
If you're a Play2 user, take a look at play-support project, too:
https://github.com/scalikejdbc/scalikejdbc-play-support
First example
After adding the above dependencies to your build.sbt
, run sbt console
and execute the following code:
import scalikejdbc._
// initialize JDBC driver & connection pool
Class.forName("org.h2.Driver")
ConnectionPool.singleton("jdbc:h2:mem:hello", "user", "pass")
// ad-hoc session provider on the REPL
implicit val session: DBSession = AutoSession
// table creation, you can run DDL by using #execute as same as JDBC
sql"""
create table members (
id serial not null primary key,
name varchar(64),
created_at timestamp not null
)
""".execute.apply()
// insert initial data
Seq("Alice", "Bob", "Chris") foreach { name =>
sql"insert into members (name, created_at) values (${name}, current_timestamp)".update.apply()
}
// for now, retrieves all data as Map value
val entities: List[Map[String, Any]] = sql"select * from members".map(_.toMap).list.apply()
// defines entity object and extractor
import java.time._
case class Member(id: Long, name: Option[String], createdAt: ZonedDateTime)
object Member extends SQLSyntaxSupport[Member] {
override val tableName = "members"
def apply(rs: WrappedResultSet) = new Member(
rs.long("id"), rs.stringOpt("name"), rs.zonedDateTime("created_at"))
}
// find all members
val members: List[Member] = sql"select * from members".map(rs => Member(rs)).list.apply()
// use paste mode (:paste) on the Scala REPL
val m = Member.syntax("m")
val name = "Alice"
val alice: Option[Member] = withSQL {
select.from(Member as m).where.eq(m.name, name)
}.map(rs => Member(rs)).single.apply()
How did it go? If you'd like to know more details or see more practical examples, see the full documentation at:
License
Published source code and binary files have the following copyright:
Copyright scalikejdbc.org
Apache License, Version 2.0
http://www.apache.org/licenses/LICENSE-2.0.html
*Note that all licence references and agreements mentioned in the ScalikeJDBC README section above
are relevant to that project's source code only.