翻了翻google和stackoverflow,发现了很多关于建立数据库连接失败.检查连接字符串、用户名和密码"的问题.但是,我找不到任何人发现潜在错误是什么.
Looking through google and stackoverflow, I found a number of questions asking about "Failed to establish a database connection. Check connection string, username and password." However, I cannot find anyone that has found what the underlying error is.
我正在尝试使用数据库连接编写我的第一个谷歌脚本;我有一个 mysql 和 oracle jdbc getConnection,两者都会产生这个错误.我已经检查,双重和三次检查连接信息无济于事.我知道数据库是可以访问的(可以通过其他客户端从几台不同的机器进入,比如 linux 机器上的 php,家庭和工作中各种 Windows PC 上的 sql 开发人员).我如何确定真正的错误是什么?呈现给我的错误过于笼统和抽象.
I am trying to write my first google script with a database connection; I have a mysql and oracle jdbc getConnection, both of which spawn this error. I have checked, double- and triple-check the connection information to no avail. I know the databases are accessible (can get in through other clients from several different machines like php on a linux box, sql developer on various windows PCs at home and work). How do I determine what the real error is? The error as presented to me is way too generic and abstract.
环境:在 Google 电子表格中使用脚本(因此继承了 google 建立的任何环境).我正在尝试使用 Google API jdbc 并且对环境变量没有进一步的了解.
Environment: Using a script in a Google Spreadsheet (thus inheriting whatever environment is established by google). I am attempting to use the Google API jdbc and have no further knowledge of the environment variables.
使用以下语法:
var url = "jdbc:mysql://mysql.cb-pta.com:3306/u4lottery";
var conn = Jdbc.getConnection(url, user, password);
再次验证用户和密码.
有一个已知错误会导致使用主机名的 jdbc 连接出现问题.尝试改用 IP 地址.
There is a known bug which causes problems with jdbc connections using hostnames. Try using an Ip address instead.
奇怪,但确实如此......我因为这个错误而损失了将近 2 天......
Bizarre, but true.. I lost almost 2 days with this bug....
这是错误报告的链接....
这篇关于“无法建立数据库连接"背后的根本错误是什么?检查连接字符串、用户名和密码."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!