Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is the best Library to use access a Database using SQL from Scala?

I am looking for a Scala Database library which allows me to use SQL to talk to Databases with Connection pooling and preferably multiple end points (master and slave) taken care of.

The Scala ORM/DSL tools look too complicated and have a higher learning curve without much value addition for my use case. So I am looking for a simpler library which allows me write SQL directly.

But the connection pooling is a must for the library.

Any suggestions for the above?.

like image 726
sheki Avatar asked Oct 05 '11 18:10

sheki


4 Answers

Using JDBC in scala is pretty much seamless. In my case, I wrote a small reusable db library for bridging JDBC to Scala (i.e., generate SQL from Scala objects and generate scala objects from results).

For pooling, you could use a 3rd party db pool library (such as http://www.snaq.net/java/DBPool/) Using all this in Scala (once your library is done) requires very few lines of code.

like image 81
Jus12 Avatar answered Oct 20 '22 08:10

Jus12


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

like image 39
Phil Avatar answered Oct 20 '22 06:10

Phil


Doesn'T ScalaQuery work for you? http://scalaquery.org/

like image 1
AndreasScheinert Avatar answered Oct 20 '22 07:10

AndreasScheinert


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

like image 1
user272735 Avatar answered Oct 20 '22 06:10

user272735