sijms / go-ora

Pure go oracle client
MIT License
786 stars 174 forks source link

Is there a way to init session parameters always whenever connection created #457

Closed freeNestor closed 10 months ago

freeNestor commented 10 months ago

I want to init session parameters like ' ALTER SESSION SET key=value' and keep this when connection pool reconnect, so is there a way to achieve this? I known use db.Exec() can execute this sql, but if pool reconnect, this will reset session.

DrHayt commented 10 months ago

What parameter are you trying to set? Is it already an option in the connect string?

Take a look at: https://github.com/sijms/go-ora/blob/47c72957312fce73efac1a4cb51d322a651880b1/v2/connection_string.go#L405

freeNestor commented 10 months ago

What parameter are you trying to set? Is it already an option in the connect string?

I want to set events and cursor_sharing etc. Example: ALTER SESSION SET EVENTS '10503 trace name context forever, level 4000' ALTER SESSION SET cursor_sharing=force

like godror can achieve this:

image
sijms commented 10 months ago

sorry for late replay ok good idea I will add it in next release

freeNestor commented 10 months ago

Thanks very much, I'll wait for it.

sijms commented 10 months ago

fixed in v2.7.20