Using postgresql jdbc driver to setup session variables on initialization

Hi,

I am trying to connect to cockroachdb using the postgresql jdbc driver and hikaricp. I would also like to set certain session variables when doing so.
As mentioned in this issue - https://github.com/pgjdbc/pgjdbc/issues/1495#issuecomment-500781059, it can be done by passing the options property. But if i execute the SHOW command immediately after doing so, i dont see the session variable value being reflected.
Is this expected? if so, how can i setup the session variables when initializing the backend server connection?

Thanks!

Hello,

These are the connection parameters we currently support in CockroachDB.

After you initialize your backend server connection, you should be able to set session variables with this.

Addtionally, you can set apply cluster-wide settings that will persist regardless of the connection. See this.

Let me know if that helps.

Thanks for the response @mattvardi - I have been using the SET statement once a new connection is established. Was just curious, if it can be done using the options param as mentioned in that link.

No problem at all.

Let me know if you have any other questions.