go-goracle/goracle

Connection setting for goracle to connect to Oracle database

Rajeena0503 opened this issue · 1 comments

@tgulacsi , we are using goracle to connect to Oracle database 12.2 . We are receiving an error randomly "OCISessionGet() could not find a free session in the specified timeout period".

We are setting set max open connection as 50, max idle connection time as 10, Connection Max lifetime as time.minute x 10. What are the recommendations for connection string?

Please use github.com/godror/godror. goracle has been abandoned for naming (legal) issues.

Such errors surface when you don't release something that should be Close()'d : Rows from Query, a Conn from db.Conn, a Tx from db.Begin, and so on.

Close() everything ASAP.
Use the 'Context versions and cancel the context ASAP.

Either allocate a connection (*sql.DB.Conn) or transaction (*sql.Tx) and use it as long as you can.

Lower the max open connections and shorten the time till the error appears for locating it.
Print sql.DB.Stats() regularly to see the state of the Go connection pool - it that does not release connections, then the underlying session pool will fill.