You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 23, 2018. It is now read-only.
Hi, I am using oracle times ten database and my code is as follow:
func main() {
godrv.SetAutoCommit(false)
db, err := sql.Open("goracle", os.Getenv("ORACLE_DSN"))
if err != nil {
log.Println(err)
os.Exit(1)
}
db.SetMaxOpenConns(128)
db.SetMaxIdleConns(64)
// 10 go routine insert
runtime.GOMAXPROCS(4)
var wg sync.WaitGroup
log.Println(time.Now())
var numInsert = 2500
for i := 0; i < 4; i++ {
wg.Add(1)
go func() {
tx, err := db.Begin()
exit(err)
stmt, err := tx.Prepare("INSERT INTO users VALUES(?)")
defer stmt.Close()
for i := 0; i < numInsert; i++ {
_, err = stmt.Exec(time.Now().UnixNano())
exit(err)
}
err = tx.Commit()
exit(err)
wg.Done()
}()
}
wg.Wait()
log.Println(time.Now())
}
If I set numInsert to 250, it will not raise any error. But while it's set to 2500 or more, the error is like this:
I am not sure if it's due to my misuse of goracle or any other error. I think the code is simple as it is. BTW, if I start more than 4 go routines to insert data into database, it raised the same error which really confused me. Would you help?
Hi, I am using oracle times ten database and my code is as follow:
If I set numInsert to 250, it will not raise any error. But while it's set to 2500 or more, the error is like this:
I am not sure if it's due to my misuse of goracle or any other error. I think the code is simple as it is. BTW, if I start more than 4 go routines to insert data into database, it raised the same error which really confused me. Would you help?