I get the given below error, when I connect localhost
(docker - oracle-12.2.0.1) using Go. Same connection is working fine when I connect by table plus
. Please suggest me to resolve this issue.
Code
conn, err := sql.Open("oracle", "oracle://SYS:Oradoc_db1@localhost/ORCLPDB1.localdomain")
if err != nil {
fmt.Println("Can't open the driver", err)
return
}
Error1
ORA-28009: connection as SYS should be as SYSDBA or SYSOPER
Code
conn, err := sql.Open("oracle", "oracle://SYSDBA:Oradoc_db1@localhost/ORCLPDB1.localdomain")
if err != nil {
fmt.Println("Can't open the driver", err)
return
}
Error2
ORA-01017: invalid username/password; logon denied
The username and password must be same as was specified in a GRANT CONNECT statement. And if you are entering the username and password together the format should be like this: username/password
. Also check if they are case sensitive or not.
try this format:
db, err := sql.Open("oracle", "<your username>/<your password>@service_name")
if err != nil {
fmt.Println(err)
return
}
defer db.Close()
OR
Also confirm golang oracle database driver
db, err := sql.Open("goracle", username+"/"+password+"@"+host+"/"+database)
if err != nil {
fmt.Println("... DB Setup Failed")
fmt.Println(err)
return
}
defer db.Close()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.