Page 1 of 1

MySQL JDBC - Could not establish connection

Posted: Sun Sep 13, 2020 8:50 pm
by kevin-ncbc
Thank you so much for your time and expertise. After days of trying to connect to MySQL, I continue to get "java.sql.SQLException: Could not establish connection."

Using OxygenXML latest ver on MS Windows 10 with local standalone install of MySQL 8.0.21 at localhost:3306/[dbname]

Other tools e.g., Workbench, Navicat, connect to MySQL

To connect via OxygenXML: Downloaded latest MySQL driver via: http://dev.mysql.com/downloads/connector/j/. (also tried adding to path, using 5.1 version, etc.)

Followed instructions to create Generic JDBC datasource with path to mysql-connector-java-8.0.21.jar; driver class com.mysql.jdbc.driver (also tried other classes)

Followed instructions to create Connection (with jdbc:mysql//localhost:3306/[mydbname] (also tried every possible combination I can think of).

Please help ... thank you for your help! Could the problem be related to having a local installation? I first tried MySQL via wampserver. Didn't work. Then deleted wampserver and just installed standalone MySQL via MySQL installer.

Kevin

Re: MySQL JDBC - Could not establish connection

Posted: Mon Sep 14, 2020 1:45 pm
by adrian_sorop
Hello Kevin,

Using "<oXygen/> XML Editor 22.1, build 2020072902" and "MySQL Server 8.0" on Windows 10 I was able to connect a database from localhost.
The connector used was "mysql-connector-java-8.0.21.jar" and driver class "com.mysql.jdbc.Driver".

In your case I think the connection URL is not correct. It looks like it's missing ":" symbol between mysql and //localhost.
The connection URL should be: jdbc:mysql://localhost:3306/[mydbname].

Give it a try and let me know if this was the issue.

Have a nice day,
Adrian S

Re: MySQL JDBC - Could not establish connection

Posted: Sun Oct 18, 2020 11:18 pm
by kevin-ncbc
Hi Adrian ... just now got back to this ... your answer was right on! THANK YOU!! Kevin