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

golang connect timesten 11.2 on centos 7 with goracle

chuongnx opened this issue · comments

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Your oracle client version
e.g. 12.2.0.1.0

Your goracle version
e.g. 2.16.3

Your go version
e.g. 1.12.0

Your gcc version
e.g. 4.8.3

Machine (please complete the following information):

  • OS: [e.g. win]
  • Architecture [e.g. x86_64]
  • Version: [e.g. 10]

Additional context
Add any other context about the problem here.

I am using goracle connect to timesten 11.2 on centos 7 with golang error

query: SELECT DBTIMEZONE FROM DUAL: dpiStmt_execute: ORA-00904: TT2211: Referenced column DBTIMEZONE not found -- file "saCanon.c", lineno 10702, procedure "sbPtTblScanOfColRef()"

My code:

package main

import (
"fmt"
"database/sql"
_ "gopkg.in/goracle.v2"
)

func main(){

db, err := sql.Open("goracle", "back/back@10.128.79.11:53397/TT_1122CS:timesten_client")
if err != nil {
    fmt.Println(err)
    return
}
defer db.Close()
 
 
rows,err := db.Query("select sysdate from dual")
if err != nil {
    fmt.Println("Error running query")
    fmt.Println(err)
    return
}
defer rows.Close()

var thedate string
for rows.Next() {

    rows.Scan(&thedate)
}
fmt.Printf("The date is: %s\n", thedate)

}

with this program run on window is successful(timesten client 11.2 golang 1.10.3)

Hi @tgulacsi,
Timesten is not support SELECT DBTIMEZONE FROM DUAL, why you are not remove this code:

   const qry = "SELECT DBTIMEZONE FROM DUAL"
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
defer cancel()
st, err := c.PrepareContext(ctx, qry)
if err != nil {
	return errors.Wrap(err, qry)
}
defer st.Close()

in file conn.go

are goracle only support oracle, not support timesten?

Thanks

Hi @chuongnx ,

Goracle supports Oracle, not TimesTen.
I try to make it work with TimesTen, but cannot make guarantees, as I don't have access to a TimesTen DB.

That's why I haven't removed that code - but I've changed it in c8b4954 to go on if DBTIMEZONE is not there.