I am attempting to open a connection from a Google Apps Spreadsheet without success, using example code from the Google Apps Developers reference (https://developers.google.com/apps-script/jdbc)
function insert() {
var conn = Jdbc.getConnection("jdbc:mysql://localhost:3306/test", "a", "a");
ERROR: Failed to establish a database connection. Check connection string, username and password. (line 56)
I have tried replacing "localhost" with my specific IP address.
I am able to connect successfully to my database using Access, ODBC and the above credentials so I know it's a JDBC / Google-apps-script issue.
CLASSPATH points to the correct jar file as shown by:
C:>echo %CLASSPATH%
.;C:Program FilesJavamysql-connector-java-5.1.22mysql-connector-java-5.1.22-
bin.jar
I am not sure if I have to do anything else, either within my script or google-doc-spreadsheet, or within Windows to set things up correctly.
I understand from one thing I read, that it is not necessary to install the JDBC driver as such but I would appreciate confirmation of same.
I have spent a long time searching the internet for solutions but to no avail.
I am having trouble diagnosing where the problem lies and would greatly appreciate any thoughts anyone may have in that regard.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…