go-goracle / goracle

Go database/sql driver for connecting to Oracle Database, using the ODPI-C library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

got error ora-24496 when tried to connect oracle database

sontaya1988 opened this issue · comments

func initDB() {
params := goracle.ConnectionParams{
Username: "some_username",
Password: "some_password",
SID: "host:port/db",
MinSessions: 10,
MaxSessions: 10,
PoolIncrement: 0,
ConnClass: "POCGORACLE",
}

var err error
db, err = sql.Open("goracle", params.StringWithPassword())
if err != nil {
	log.Fatal(err)
}

db.SetMaxIdleConns(10)
db.SetMaxOpenConns(10)

}

Go version 1.12.5

Goracle driver 2.16.3

oracle database 12.2.0.1 RAC

What if you se PoolIncrement to 1?

I tried to edit increment to 1 and delete setmaxconn parameter
some connection i got new error is acquirePoolConnection: ORA-24399: invalid number of connections specified

currently my config is
minsession 10
maxsession 10
increment 1
maxidleconn 10
maxopencon 10
I still got same error some connection "ORA-24399"

What's the matter with

params := goracle.ConnectionParams{
Username: "some_username",
Password: "some_password",
SID: "host:port/db",
ConnClass: "POCGORACLE",
}

?

params := goracle.ConnectionParams{
Username: "system",
Password: "welcome1",
SID: "nxt-scan:1521/vendor",
ConnClass: "POCGORACLE",
}

So, has this been solved?

commented

Hi, I have the same problem on Mac.
Windows works perfectly.

acquirePoolConnection: ORA-24496: Message 24496 not found; product=RDBMS; facility=ORA

goracle: v2.19.0

" ORA-24496: OCISessionGet() timed out waiting for a free connection"

What about not messing with the timeouts, and simply providing the login, password, host, port an service name only?

commented

Hi, thank you for your answer.
I don't set timeouts. This is how I connect.

con, err := sql.Open(s.Driver, user + "/" + pass + "@" + host + ":" + port + "/" + db)
con.SetMaxOpenConns(50)
con.SetMaxIdleConns(10)

Ok, sorry.

"Message 24496 not found" means your Oracle (Instant Client) installation is incomplete - either it misses the message files, or just cannot find them.

Anyway, ORA-24496 means the connection timed out waiting for a free connection - is it on the first execution?
If yes, then maybe something occupies all the available sessions; if it is not, then maybe you does not close each Rows and Stmt and Conn, and it eats all the available sessions.

commented

Hi, it happens during on first execution.
What is a bit confusing is that it happens only on OSX. Windows 10 works perfectly.
I will check Instant Client Installation.
Thank you very much.