This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-11-14
Channels
- # adventofcode (1)
- # babashka (60)
- # beginners (107)
- # calva (11)
- # cider (3)
- # clara (11)
- # clj-kondo (6)
- # cljs-dev (33)
- # clojure (70)
- # clojure-dev (4)
- # clojure-europe (3)
- # clojure-italy (2)
- # clojure-kc (1)
- # clojure-losangeles (12)
- # clojure-nl (4)
- # clojure-spec (32)
- # clojure-uk (35)
- # clojuredesign-podcast (1)
- # clojurescript (28)
- # core-logic (4)
- # cursive (5)
- # datomic (34)
- # devcards (1)
- # emacs (16)
- # events (13)
- # fulcro (15)
- # graalvm (5)
- # graphql (3)
- # jobs (8)
- # joker (2)
- # kaocha (17)
- # malli (6)
- # music (3)
- # off-topic (58)
- # protorepl (7)
- # re-frame (28)
- # rewrite-clj (9)
- # shadow-cljs (102)
- # spacemacs (3)
- # sql (20)
- # tools-deps (9)
Hi @seancorfield we're having an 'interesting' issue using next
and java.jdbc
with Snowflake. They've made some decisions which are causing us some pain. Unfortunately, they don't support prepared statements with all sql commands, as a hack, what they do is not return an error to the connection but instead re-run the sql in the background.
Usually this isn't much of an issue, but when we're running commands with upstream deps, we're having issues where either the old data is being ingested, or the table has been dropped. Is there a way we could execute a statement not as a prepared statement? I was hoping that as execute-one
was meant to be used for DDLs that it might the one to use.
More information on the original issue that was reported to Snowflake can be found here - https://github.com/snowflakedb/snowflake-jdbc/issues/7
Hi. Does anyone know how I would run the mssql stored procedure "EXECUTE pc_ListMyTimeseriesObservations @TimeseriesCodes='EACM026A', @StartDate='19600101', @EndDate='20190630'"
, my db being given by mssql-db
, using java.jdbc
?
@vale I consider your PostgreSQL issue blocking for 1.0.10 (nearly everything else since 1.0.9 is documentation updates).
@byrongibby Have you tried running that EXECUTE
statement with clojure.java.jdbc/execute!
?
(I never use stored procs so I have no idea beyond suggesting that)
@seancorfield I haven't I've been trying db-do-prepared
with no luck - SQL noob here. Will try your suggestion, thanks!
@geek-draven I'll take a look at that when I get time later today. There may be paths through clojure.java.jdbc
that do not use PreparedStatement
but I suspect they won't return result sets. As for next.jdbc
, no, there's no path through that without PreparedStatement
right now.
Thanks @seancorfield, for now we're resorting to using java interop
@byrongibby Did you try query
first, by the way?
(if that stored proc returns a result set, that would be my first attempt)
(jdbc/execute! mssql-db "EXEC pc_ListMyTimeseriesObservations @TimeseriesCodes='EACM026A', @StartDate='20190101', @EndDate='20190630'")
returns
Execution error (SQLServerException) at com.microsoft.sqlserver.jdbc.SQLServerException/makeFromDriverError (SQLServerException.java:234).
A result set was generated for update.
Yep, I did try query
.Neither clojure.java.jdbc
nor next.jdbc
support multiple result sets BTW which is common for stored procs I gather. Just FYI.
Oh, and query
failed how?
query
returns an empty collection ()
Sorry, I have no idea then... ¯\(ツ)/¯
I'll keep on trying, maybe try solve it in Java first. 🙂
So it turns out there were no observations for the date range I gave and j/query
works a charm. It's difficult being a noob some days. Thanks for the help.
Thanks for reporting back on that!
@geek-draven I'm looking at Statement
/`PreparedStatement` stuff now... it looks relatively easy to add support for Statement
https://github.com/seancorfield/next-jdbc/issues/75 but it will require use of a tiny bit of interop (calling .createStatement
yourself on a java.sql.Connection
).