mattn / go-oci8

Oracle driver for Go using database/sql
https://mattn.kaoriya.net/
MIT License
630 stars 212 forks source link

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

Closed chakrapani123 closed 5 years ago

chakrapani123 commented 5 years ago

hello,

i am making updates to oracle version 12.2.0.1 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

MichaelS11 commented 5 years ago

Connection errors do happen. Not sure what you are asking or what the problem you are wanting help with.

The best way to get help is to have a small code snippet and ALL SQL involved that is easily repeatable by someone else so the error can be reproduced.

MichaelS11 commented 5 years ago

@chakrapani123 Everything alright now? Close this?

chakrapani123 commented 5 years ago

Yes . Please

thanks Chakri

On Fri, Jan 11, 2019 at 5:56 AM MichaelS11 notifications@github.com wrote:

@chakrapani123 https://github.com/chakrapani123 Everything alright now? Close this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mattn/go-oci8/issues/315#issuecomment-453480733, or mute the thread https://github.com/notifications/unsubscribe-auth/AQJYG6pMpmL4Z3cBGm0jbKwzpxuu-GxGks5vCG3kgaJpZM4ZpzIT .

MichaelS11 commented 5 years ago

@mattn Please close this.