Fork me on GitHub
#sql
<
2017-11-16
>
Mattias Didriksson08:11:57

Hi, jdbc/get-connection db worked like a charm.

Mattias Didriksson09:11:18

It works on one of my stored procedures but not the other one. Only difference I can see is that the one not working returns a value. We have used java with Spring previously to contact this procedure with SimpleJdbcCall. Could it be that I need to specify that the procedure returns a value? I'm getting error message: Caused by: java.sql.SQLException: ORA-06550: rad 1, kolumn 7: PLS-00221: 'RECEIVE_MESSAGE' is not a procedure or is undefined ORA-06550: rad 1, kolumn 7: PL/SQL: Statement ignored

Mattias Didriksson09:11:59

Cant upload my code snippet for some reason.

seancorfield17:11:43

@mattias.didriksson java.jdbc doesn't do much to help you with stored procs so you'll need to use Java interop and whatever the java.sql.* classes would require. Feel free to add information about what would make life easier to this JIRA issue https://dev.clojure.org/jira/browse/JDBC-48

gdeer8120:11:29

Sidenote: I totally agree with the sentiment on this ticket about stored procedures. Also, I like this part of the ticket "March 15, 2013: I'll be hacking on this, so patches forthcoming" ...crickets

seancorfield21:11:07

@gdeer81 Well, you know how it goes with OSS and volunteers... 🙂

seancorfield21:11:35

If I ever actually used stored procs myself, you can bet this feature would have been added years ago...

seancorfield21:11:15

...but I don't even have a test case to try it out (and I don't know how cross-platform-DB such a test case would be -- I only use MySQL).

gdeer8121:11:10

I was thinking about this the other day. Lets say you had a script that would spin up a docker instance for each OS and database vendor and ran the tests for each combination. That test suite might be harder to maintain than the codebase itself

seancorfield21:11:28

Well, I already have PostgreSQL and Percona 5.7 locally in Docker instances for testing. I also have a Windows XP VM with SQL Server Express on it. I run clojure.java.jdbc tests against all those plus MySQL 5.5, Apache Derby, SQLite, H2, HSQLDB...

seancorfield21:11:36

But the real problems come from where the SQL dialect supported by each DB differs. Even something as simple as auto-generated integer PK differs on almost every DB. How to do EXPLAIN (that's in the java.jdbc test suite).

gdeer8121:11:37

hrm it's almost like you need a .sqlc file that has reader conditionals for each database vendor 😆

bja21:11:03

@gdeer81 or just generic feature expressions

gdeer8121:11:35

@bja did you just tell me to go fun myself?

bja21:11:46

lol 😁

gdeer8121:11:36

sorry that's my default response to statements where I know all the words individually but not as a whole

bja21:11:17

if you're looking for a good time this weekend, fork clojure/clojure and add some feature expressions. Then for symbolic effect, submit a PR. PRs and Jira tickets on this are equally likely to be accepted.

bja21:11:28

clojure has a limited form of this for specifically targeting clj/cljs/cljr from inside cljc files

gdeer8121:11:30

wait, how is this different than reader conditionals? I'm confused

bja21:11:59

clojure's limited form is called reader conditionals

gdeer8121:11:25

ah I see, so reader conditionals only handle clojure dialects whereas feature expressions could handle different platforms and what not