DEV.co
Open-Source Databases · scalikejdbc

scalikejdbc

ScalikeJDBC is a Scala library that wraps JDBC to provide type-safe, ergonomic database access with QueryDSL support. It enables developers to write raw SQL queries efficiently while offering an optional O/R mapper (scalikejdbc-orm) for more complex relational data handling.

Source: GitHub — github.com/scalikejdbc/scalikejdbc
1.3k
GitHub stars
228
Forks
Scala
Primary language
Apache-2.0
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositoryscalikejdbc/scalikejdbc
Ownerscalikejdbc
Primary languageScala
LicenseApache-2.0 — OSI-approved
Stars1.3k
Forks228
Open issues42
Latest release4.3.5 (2025-08-16)
Last updated2026-07-07
Sourcehttps://github.com/scalikejdbc/scalikejdbc

What scalikejdbc is

ScalikeJDBC is a JDBC abstraction layer for Scala featuring connection pooling, string interpolation-based query building, and an optional ORM with join/eager-loading capabilities. Core library is lightweight; orm extension adds ActiveRecord-style CRUD patterns and association handling to reduce N+1 query problems.

Quickstart

Get the scalikejdbc source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/scalikejdbc/scalikejdbc.gitcd scalikejdbc# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Scala microservices with direct SQL control

Teams preferring explicit SQL over black-box ORMs can leverage ScalikeJDBC's QueryDSL for type-safe query composition while retaining full SQL visibility and control over performance.

Multi-database projects (PostgreSQL, MySQL, H2)

Standard JDBC abstraction supports multiple databases with the same API. Useful for teams needing vendor-neutral persistence layers or testing with H2 in-memory databases.

Scala Play Framework applications

Dedicated play-support module bridges ScalikeJDBC into Play's ecosystem. Effective for full-stack Scala web apps requiring integration with Play's request/session lifecycle.

Implementation considerations

  • JDBC driver versions must match database target (H2 2.2+, MySQL, PostgreSQL drivers specified separately). Dependency version alignment is critical.
  • Connection pool configuration (ConnectionPool.singleton or custom) must be initialized before first query. Multi-tenancy or complex pool scenarios require custom session providers.
  • Type safety in QueryDSL requires entity case classes and extractor definitions. Boilerplate is minimal but non-zero compared to raw JDBC.
  • ORM association eager-loading (includes method) and join query semantics require careful schema design; lazy initialization can lead to N+1 if misapplied.
  • Logging integration (logback shown in examples) needed for production debugging; no built-in query logging visible in excerpts—third-party interceptors may be required.

When to avoid it — and what to weigh

  • Non-Scala JVM projects — ScalikeJDBC is Scala-first. Java teams should evaluate HikariCP + Spring Data JPA or Hibernate instead.
  • NoSQL or polyglot persistence — ScalikeJDBC is SQL-relational only. Projects requiring MongoDB, DynamoDB, or mixed datastores need dedicated drivers or polyglot frameworks.
  • GraphQL or REST API generators — ScalikeJDBC does not generate APIs from schemas. Teams needing automatic GraphQL/OpenAPI exposure should pair it with separate code generation tools or switch to JPA/Hibernate with Quarkus.
  • Organizations with strict ORM adoption policies — If enterprise standardizes on full ORMs (Hibernate, EclipseLink), ScalikeJDBC's SQL-centric approach may conflict with governance and training investments.

License & commercial use

Apache License 2.0 (permissive OSI license). Copyright held by scalikejdbc.org. Source code and binaries explicitly licensed under Apache 2.0 terms.

Apache License 2.0 permits commercial use, modification, and distribution with reasonable conditions (including liability/warranty disclaimers and license text reproduction). No commercial support, SLA, or indemnification visible in data. Requires in-house support capability or independent commercial support arrangement.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

JDBC-level SQL injection is mitigated by parameterized queries (string interpolation with `${}` syntax). Connection pooling and JDBC driver credentials must follow standard secrets management practices (environment variables, vaults). No security audit, penetration test results, or vulnerability disclosure policy visible in data; users inherit standard JDBC and driver vulnerability exposure.

Alternatives to consider

Slick (Typesafe Reactive Relational Mapper)

Scala-native with async/reactive support and functional composition. Choose if non-blocking database access and async pipelines are required; ScalikeJDBC is simpler for standard blocking workloads.

Doobie (Scala/Haskell-inspired)

Pure functional with strong type safety via effect systems (Cats Effect). Choose if your codebase requires functional composition and explicit effect control; ScalikeJDBC is less functional but more imperative-friendly.

Quill (Compile-time macro SQL DSL)

Compile-time SQL generation with optional runtime fallback. Choose if metaprogramming safety is critical; ScalikeJDBC is runtime-based with lower compile-time overhead.

Software development agency

Build on scalikejdbc with DEV.co software developers

Our Devco team can review your data layer architecture, assess ORM vs. SQL-first tradeoffs, and guide integration with Play Framework or microservices. Let's build your persistence layer with confidence.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

scalikejdbc FAQ

Does ScalikeJDBC support async/non-blocking I/O?
No. Core library is blocking JDBC only. Async patterns require manual wrapping with Scala Futures/Task libraries. Slick or Doobie are better if full async pipeline is mandatory.
Is connection pooling built-in?
Yes. ConnectionPool is provided in core; singleton or custom pools can be configured. HikariCP integration or other poolers can be substituted if needed.
How does the ORM (scalikejdbc-orm) differ from Hibernate?
ScalikeJDBC-orm is lighter-weight, Rails-inspired, and transparent (you control SQL). Hibernate is heavier, Java-standard, and auto-generates SQL. ScalikeJDBC favors explicit SQL; Hibernate favors annotations and implicit behavior.
Can I use ScalikeJDBC with Kotlin or Java?
Technically possible (JVM compatibility) but not idiomatic. Library is designed for Scala's string interpolation and functional style. Java teams should use JDBC + HikariCP or JPA; Kotlin teams may prefer Exposed or SQLDelight.

Custom software development services

Need help beyond evaluating scalikejdbc? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and open-source databases integrations — and maintain them long-term.

Ready to evaluate ScalikeJDBC for your Scala stack?

Our Devco team can review your data layer architecture, assess ORM vs. SQL-first tradeoffs, and guide integration with Play Framework or microservices. Let's build your persistence layer with confidence.