Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stmt.exeC Env.ociError ORA-03135: connection lost contact\nProcess ID: 61366\nSession ID: 2867 Serial number: 6006 #262

Open
chakrapani123 opened this issue Jan 4, 2019 · 3 comments

Comments

@chakrapani123
Copy link

chakrapani123 commented Jan 4, 2019

hello,

i am making updates to oracle version 12.2.0.1 & ORA.V4 and using the following code snippet..

func (o *Oracle) UnReserveCdb(cdbname string) (unreserved bool, err error) {

fmt.Println(cdbname)
udb := o.Db
utx, err := udb.Begin()
if err != nil {
fmt.Println("error", err)
}
ures, err := utx.Exec("update testdb.DATABASE_INFO set CDB_CONSUMED = 'YES' , CDB_AVAILABLE = 'NO' where CDB_NAME = :1", cdbname)
if err != nil {
fmt.Println("error in exec: ", err)
utx.Rollback()
return unreserved, err
}
if err := utx.Commit(); err != nil {
fmt.Println("error", err)
}
urowCnt, err := ures.RowsAffected()
if err != nil {
fmt.Println("error", err)
}
fmt.Println("rows changed ", urowCnt)

if urowCnt > 0 {
return true, err
} else {
return false, err
}
}

type Oracle struct {
Driver string
ConnectString string
Db *sql.DB
logger log.Logger
}

func NewOracleConnection(cfg config.Config, log log.Logger) (Connection, error) {
var err error
o := &Oracle{
Driver: cfg.DB.Driver,
ConnectString: cfg.DB.ConnectString,
logger: log,
}
o.Db, err = sql.Open(o.Driver, o.ConnectString)
if err != nil {
log.Log("event", "connecting to database", "err", err.Error())
}
return o, err
}

thanks
Chakri

@tgulacsi
Copy link
Collaborator

tgulacsi commented Jan 4, 2019

Just use gopkg.in/goracle.v2, that's maintained!

BTW, you haven't stated what's your problem with the given code...

@chakrapani123
Copy link
Author

sorry..might have jumped the gun on this one..when i do an update and commit post update

ures, err := utx.Exec("update testdb.DATABASE_INFO set CDB_CONSUMED = 'YES' , CDB_AVAILABLE = 'NO' where CDB_NAME = :1", cdbname)
if err != nil {
fmt.Println("error in exec: ", err)
utx.Rollback()
return unreserved, err
}
if err := utx.Commit(); err != nil {
fmt.Println("error", err)
}

i get this error

Stmt.exeC Env.ociError ORA-03135: connection lost

select statements work fine its just updates throw this error

thanks
CHakri

@tgulacsi
Copy link
Collaborator

tgulacsi commented Jan 4, 2019

Sorry, no idea - this should work.

Can you try gopkg.in/goracle.v2 ?
Just blank import it (import _ "gopkg.in/goracle.v2") instead of gopkg.in/rana/ora.v4 and use

db, err := sql.Open("goracle", "...")
...

and when you run your test, set the "DPI_DEBUG_LEVEL" environment variable to something bigger than 0. This will print a lot of debug information. Then the ODPI-C folks may be able to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants