[JDBC-36] using exisiting java based connection pool in clojure Created: 24/Jul/12 Updated: 12/Aug/12 Resolved: 12/Aug/12 |
|
| Status: | Resolved |
| Project: | java.jdbc |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Major |
| Reporter: | Amir | Assignee: | Sean Corfield |
| Resolution: | Declined | Votes: | 0 |
| Labels: | None | ||
| Description |
|
We have a connection pool in Java and would like to use the same for our complete project where code is mixture of Clojure/Java. (def db (ConnectionManager/getConnection)) ; #<ConnectionHandle com.jolbox.bonecp.ConnectionHandle@53371566> connection type we get after excuting this line |
| Comments |
| Comment by Amir [ 24/Jul/12 3:00 AM ] |
|
If we execute the above (with connection - with-query results) i get the following exception IllegalArgumentException db-spec com.jolbox.bonecp.ConnectionHandle@53371566 is missing a required parameter clojure.java.jdbc/get-connection (jdbc.clj:192) |
| Comment by Sean Corfield [ 24/Jul/12 12:34 PM ] |
|
Use the :datasource option to define your db-spec: (def db {:datasource bonecpDataSourceObject}) I looked at the BoneCP docs and I don't see a ConnectionManager class but if you define the db-spec based on the BoneCPDataSource object, java.jdbc will call getConnection on that object to get a working connection for operations. |
| Comment by Sean Corfield [ 31/Jul/12 7:49 PM ] |
|
Amir, have you had a chance to try my suggestion? |
| Comment by Amir [ 01/Aug/12 2:20 AM ] |
|
Hi Sean, No, we moved to clojure based pooling in a while. We thought its better to have all stuff in clojure rather than having java+clojure. But i can give it a try today. Thanks for your suggestion. will keep you posted. |
| Comment by Sean Corfield [ 12/Aug/12 9:35 PM ] |
|
I'll close this out then Amir, thanx. |
| Comment by Sean Corfield [ 12/Aug/12 9:36 PM ] |
|
I believe there is a way to access the the BoneCP connection pool directly and use it with java.jdbc as-is, however it is no longer an issue for the creator of this ticket. |