impossibl / pgjdbc-ng

A new JDBC driver for PostgreSQL aimed at supporting the advanced features of JDBC and Postgres
https://impossibl.github.io/pgjdbc-ng
Other
600 stars 108 forks source link

[request] example on how to use SQLData with connection pool (and clojure.java.jdbc) #557

Open kirillsalykin opened 3 years ago

kirillsalykin commented 3 years ago

Hi,

I am user of clojure and clojure.java.jdbc. I'd like to take advantage of using SQLData, I am following your user guide https://impossibl.github.io/pgjdbc-ng/docs/current/user-guide/#_java_sql_sqldata and one from psql https://www.postgresql.org/docs/current/rowtypes.html and trying to make SQLData for inventory_item. I assume the SQLData should be attached to the connection (as they do here https://docs.oracle.com/javase/tutorial/jdbc/basics/sqlcustommapping.html) Unfortunately it is tricky to get connection object with clojure and clojure.java.jdbc, also it is not handy to attach mapping to every connection (especially if connection pool used). Please advice, is there a way to attach my SQLData definition to all connection? is it enough to just implement an interface?


Is it possible to provide SQLData via AnyType maybe? or via context.getCustomTypeMap? (if so - how can it be added)

Thanks!