ScalikeJDBC is a tidy SQL-based DB access library for Scala developers. This library naturally wraps JDBC APIs and provides you easy-to-use and very flexible APIs.
Questions tagged [scalikejdbc]
97 questions
8
votes
1 answer
troubleshooting jar loading conflicts in sbt
I get the following error on sbt startup, when two specific sbt plugins are added together to a project in its build definition. One of these sbt plugins is scalikejdbc and the other is my own, and clearly their mutual inclusion in a project's build…

matanster
- 15,072
- 19
- 88
- 167
8
votes
2 answers
ScalikeJDBC: Connection pool is not yet initialized.(name:'default)
I'm playing with ScalikeJdbc library. I want to retrieve the data from PostgreSQL database. The error I get is quite strange for me. Even if I configure manually the CP:
val poolSettings = new ConnectionPoolSettings(initialSize = 100, maxSize =…

Finkelson
- 2,921
- 4
- 31
- 49
7
votes
1 answer
Spark Scala Get Data Back from rdd.foreachPartition
I have some code like this:
println("\nBEGIN Last Revs Class: "+ distinctFileGidsRDD.getClass)
val lastRevs = distinctFileGidsRDD.
foreachPartition(iter => {
SetupJDBC(jdbcDriver, jdbcUrl, jdbcUser, jdbcPassword)
…

codeaperature
- 1,089
- 2
- 10
- 25
6
votes
2 answers
Accessing to PostgreSQL array via ScalikeJDBC
I try use ScalikeJDBC for access to array in PostgreSQL 9.4. DDL:
create table itab (
code varchar primary key,
group_list varchar[]
);
A simple case class and loader are defined in Scala application.
case class Item(code: String,…

hoviman
- 73
- 4
5
votes
0 answers
accessing JSONB values using scalikejdbc-async
We are evaluating using scalikejdbc-async for a new play project. The new postgresql-9.4 features: the jsonb and its indexing seem very attractive and so does the scalikejdbc-async.
Is there a way to access JSONB values using scalikejdbc-async, and…

Tjunkie
- 498
- 4
- 7
4
votes
1 answer
Correct way of using multiple ConnectionPool(s)
In my application, I have to interact (read-only) with multiple MySQL DBs one-by-one. For each DB, I need a certain no of connections. Interactions with a DB do not occur in a single stretch: I query the DB, take some time processing the results,…

y2k-shubham
- 10,183
- 11
- 55
- 131
4
votes
2 answers
Select parents for a list of interesting properties in the parent's children
I struggled with the title, but let me explain:
Let's say I have two data structures: Parent and Child. In my (Scala) code, each Parent instance has a list of Child's. In the database I have two tables, one for Parent and one for Child. Each entry…

L42
- 3,052
- 4
- 28
- 49
4
votes
1 answer
query with like clause in scalikejdbc
Can anyone please give me a example for how to use like clause in scalikejdbc with dynamic value. I used following query but it did not work
sql"select * from tables_list where lower(TABLE_NAME) like '%$tableName.toLowerCase%'"

Prasad
- 519
- 9
- 22
4
votes
0 answers
Tinyint not as Boolean
I have an existing mysql database which I want to query with scalikejdbc.
The database uses a nullable tinyint for small values in the range [-1,3].
How can I query this value? The only way that seems to work is treating it as a boolean which does…

J. Doe
- 105
- 1
- 7
4
votes
1 answer
In clauses with sql interpolation
Can I use in-clauses with ScalikeJDBC's SQL Interpolation? e.g.
val ids = Set(1,2,3,5)
sql"""update foo set bar=${bar} where id in ${ids}""".update().apply()
This fails because ids is not interpolated.
sql"""update foo set bar=${bar} where id in…

Synesso
- 37,610
- 35
- 136
- 207
4
votes
4 answers
ScalikeJDBC + SQlite: Cannot change read-only flag after establishing a connection
Trying to get working ScalikeJDBC and SQLite. Have a simple code based on provided examples:
import scalikejdbc._, SQLInterpolation._
object Test extends App {
Class.forName("org.sqlite.JDBC")
ConnectionPool.singleton("jdbc:sqlite:test.db",…

dmitry
- 4,989
- 5
- 48
- 72
3
votes
1 answer
PostgreSQL jsonb update multiple nested fields
I table that has an id field and a jsonb field in a postgresql db. The jsonb has a structure that looks something like this:
{
"id": "some-id",
"lastUpdated": "2018-10-24T10:36:29.174Z",
"counters": {
"counter1": 100,
…

Maria Livia
- 75
- 1
- 9
3
votes
1 answer
Scalikejdbc. Manage transactions without explicit dependency on Scalikejdbc and session
As I understand from docs of Scalikejdbc if I want to have a transaction I need to pass a session. Like this:
class FooBarService {
val fooDao = new FooDao
val barDao = new BarDao
def fooBar(): Unit = {
DB localTx { session =>
…

Artem Malinko
- 1,761
- 1
- 22
- 39
3
votes
1 answer
Left JOIN with AND clause in ON with scalikejdbc
So I have this sql(part of a much larger query):
from Person p left join ForeignCredentials fc on fc.person_id = p.id and fc.type = 'FACEBOOK'
and I'm trying to represent this in scalalikejdbc like this:
select.from(Person as…

jakob
- 5,979
- 7
- 64
- 103
3
votes
1 answer
For scalikejdbc how to write QueryDSL with a foreign key constraint
I use scalikejdbc 2.0.1 and playframework 2.3. I followed the instruction of One-to-many http://scalikejdbc.org/documentation/one-to-x.html, but there is still an error:
My data model is, one Account with many Todo's:
Todo model:
case class Todo…

user504909
- 9,119
- 12
- 60
- 109