[英]ORA-01017: invalid username/password; logon denied when connection
I get the given below error, when I connect localhost
(docker - oracle-12.2.0.1) using Go.当我使用 Go 连接localhost
(docker - oracle-12.2.0.1)时,出现以下错误。 Same connection is working fine when I connect by table plus
.当我通过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错误1
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错误2
ORA-01017: invalid username/password; logon denied
The username and password must be same as was specified in a GRANT CONNECT statement.用户名和密码必须与 GRANT CONNECT 语句中指定的相同。 And if you are entering the username and password together the format should be like this: username/password
.如果你同时输入用户名和密码,格式应该是这样的: 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还要确认golang oracle 数据库驱动
db, err := sql.Open("goracle", username+"/"+password+"@"+host+"/"+database)
if err != nil {
fmt.Println("... DB Setup Failed")
fmt.Println(err)
return
}
defer db.Close()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.