Fork me on GitHub

what is the recommended way to deal with connection problems? should I wrap my db calls in try and manually perform reconnects or does connection pools(libs) offer that automatically?


@roguas Use HikariCP (connection pooling). Always.


next.jdbc supports it out of the box.


We used c3p0 at work for years and it was fine. We just switched to HikariCP and it was painless and it much better maintained, documented, and supported.


Create a connection pooled datasource at app startup. Pass it to every next.jdbc call. End of story.


thanks, exactly the info i wanted ūüôā


Hello > What does this mean for your use of `next.jdbc`? In `plan`, `execute!`, and `execute-one!`, you can use `col = ANY(?)` in the SQL string and a single primitive array parameter, such as `(int-array [1 2 3 4])`. That means that in `next.jdbc.sql`’s functions that take a where clause (`find-by-keys`, `update!`, and `delete!`) you can specify `["col = ANY(?)" (int-array data)]` for what would be a `col IN (?,?,?,,,?)` where clause for other databases and require multiple values. Is there an equivalent to this for SqlServer? I found but it was rejected. Is there anything better than creating the (?,?,?,,,?) section in the query? Thanks in advance


Yea, you just use Here is an example:

(defn select-objects-by-ids [conn]
      ["select * 
        from sys.objects
        where object_id in (
          select id 
          from openjson(?) with (id int '$')
       (cheshire.core/generate-string [1 2 3])]))


@orlando No idea about SQL Server -- never used it -- but databases vary a huge amount and JDBC is a very minimal commonality.

ūüĎć 1
gratitude-thank-you 1