系统组在配置中间件时需要数据库连接信息,但是只有在程序运行后,才能确认提供的信息是否可用,做了一个小程序,可以提前测试数据库的连通性
如下是小工具使用方式
# ./oratest --help
Usage of ./oratest:
-P int
oracle database port (default 1521)
-d string
oracle database name (default "orcl")
-h string
oracle database host (default "dbhost")
-p string
oracle password (default "tiger")
-u string
oracle username (default "scott")
密码错误
# ./oratest -u test -p tes -h 192.168.62.12 -d paydb
ORA-01017: invalid username/password; logon denied
IP错误
# ./oratest -u test -p test -h 192.168.62.11 -d paydb
dial tcp 192.168.62.11:1521: connect: no route to host
库名错误
# ./oratest -u test -p test -h 192.168.62.12 -d payd
connection refused by the server
连接信息配置正确,返回Hello World!!
# ./oratest -u test -p test -h 192.168.62.12 -d paydb
Hello World!!
链接:https://pan.baidu.com/s/1mvSw6s83R4qXk9T6Obtb5g
提取码:bseb