Beispiel #1
0
// Ping makes a round trip call to the server to confirm that the connection and
// server are active.
func (conn *Connection) Ping() error {
	if !conn.IsConnected() {
		return nil
	}
	return conn.environment.CheckStatus(C.OCIPing(conn.handle, conn.environment.errorHandle,
		C.OCI_DEFAULT), "Ping")

}
Beispiel #2
0
func (c *OCI8Conn) ping(ctx context.Context) error {
	rv := C.OCIPing(
		(*C.OCISvcCtx)(c.svc),
		(*C.OCIError)(c.err),
		C.OCI_DEFAULT)
	if rv != C.OCI_SUCCESS {
		return errors.New("ping failed")
	}
	return nil
}
Beispiel #3
0
// Ping returns nil when an Oracle server is contacted; otherwise, an error.
func (ses *Ses) Ping() (err error) {
	ses.mu.Lock()
	defer ses.mu.Unlock()
	ses.log(_drv.cfg.Log.Ses.Ping)
	err = ses.checkClosed()
	if err != nil {
		return errE(err)
	}
	r := C.OCIPing(
		ses.ocisvcctx,      //OCISvcCtx     *svchp,
		ses.srv.env.ocierr, //OCIError      *errhp,
		C.OCI_DEFAULT)      //ub4           mode );
	if r == C.OCI_ERROR {
		return errE(ses.srv.env.ociError())
	}
	return nil
}
Beispiel #4
0
// Makes a lightweight call to the server. A successful result indicates the server is active.  A block indicates the connection may be in use by
// another thread. A failure indicates a communication error.
func (conn *connection) ping() error {
	if C.OCIPing((*C.OCIServer)(conn.svr), (*C.OCIError)(conn.err), C.OCI_DEFAULT) != C.OCI_SUCCESS {
		return ociGetError(conn.err)
	}
	return nil
}