Which library is better to use to access a database using SQL from Scala?

I am looking for a Scala database library that allows me to use SQL to work with connection pool databases and, possibly, with multiple endpoints (master and slave).

Scala ORM / DSL tools look too complex and have a higher learning curve without much added value for my use case. So I'm looking for a simpler library that allows me to write SQL directly.

But pooling is a must for the library.

Any suggestions for the above ?.

+6
source share
5 answers

Using JDBC in scala is pretty much no problem. In my case, I wrote a small reusable db library to combine JDBC into scala (i.e., Generated SQL from scala objects and generated scala objects from the results).

To combine, you can use a third-party db pool library (for example, http://www.snaq.net/java/DBPool/ ) Using all of this in scala (once your library is complete) requires very few lines of code.

+3
source

I prefer SQueryL because it has semantics like Scala Collections, but accesses the database, which means that operations that typically use Scala collections can work more easily with its abstractions. http://squeryl.org/

+2
source

Does ScalaQuery work for you? http://scalaquery.org/

+1
source

If you prefer SQL over ORM, you should definitely check out the O / R Broker JDBC library. Unfortunately, I'm not sure if it supports pooling or not.

+1
source

It seems that the most popular ones are currently Slick , and you should check if this is consistent with google trends: https://www.google.com/trends/explore#q=slick%20scala%2C%20scalikejdbc%2C%20Anorm&cmpt= q & tz = Etc% 2FGMT-2

0
source

Source: https://habr.com/ru/post/898693/


All Articles