rana / ora

An Oracle database driver in Go.
MIT License
271 stars 65 forks source link

Ping returns error ORA-01010: invalid OCI operation #224

Closed ainvaltin closed 7 years ago

ainvaltin commented 7 years ago

When calling db.Ping() it returns error

Ses.Ping Env.ociError ORA-01010: invalid OCI operation

go version go1.9.1 linux/amd64 oracle client lib 11.2 Server _O_VERSION Oracle9i Release 9.2.0.8.0 - 64bit Production JServer Release 9.2.0.8.0 - Production

I ques it's the (quite old) server which causes the error but it would be nice if it would be possible to change the driver so that it would work with this old version too. Other basic operations (using DML statements) seem to work...

tgulacsi commented 7 years ago

Why do you need the ping?

Do you know which version has appeared the Ping support in first?

cjbj commented 7 years ago

@tgulacsi you can treat ORA-1010 as a successful ping: https://github.com/php/php-src/blob/PHP-7.1.10/ext/oci8/oci8.c#L2091-L2094 (and yes, ODPI-C needs this change too)

tgulacsi commented 7 years ago

@cjbj that's what I've thought, too: checking Version of server for every Ping is a big unnecessary overhead, storing this info on the Srv object is a big unnecessary complexity overhead.

ainvaltin commented 7 years ago

I used ping as it seems to be recommended by the go's DB interface, see quote from the doc of the db.Open:

Open may just validate its arguments without creating a connection to the database. To verify that the data source name is valid, call Ping.