Closed rheilek closed 3 months ago
hi @rheilek sorry for late the issue will not be restricted to session parameters also you will face same issue with user defined type (UDT) I use the driver to pass data between connections in connection pool
so if you want to use multiple database you should use separate driver for each one, I explain this here
thanks, I hadn't seen that, sorry
If the go program connect to more than one database/schema and using
go_ora.AddSessionParam
the last call toAddSessionParam
overwrites other values.for example:
db1 := db.Open("db1.example.com"
)go_ora.AddSessionParam(db1, "CURRENT_SCHEMA", "WS")
db2 := db.Open("db2.example.com")
AddSessionParam(db2, "CURRENT_SCHEMA", "TEST")
db1.Exec(..)
-> ORA-01435: user does not exist - because TEST was used atinitConnection
The cause of this is the global hashmap in
OracleDriver
used inAddSessionParam
.Because of implementing
database/sql
maybe the ConnectString might be the right place to do something like this. If you agree i can create a pull request. OtherwiseAddSessionParam
should be removed from api and every developer must implement his own initialization. Or do you see another approach?