MySQL JDBC - Could not establish connection

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
kevin-ncbc
Posts: 3
Joined: Sun Jan 15, 2012 11:05 pm

MySQL JDBC - Could not establish connection

Post by kevin-ncbc » Sun Sep 13, 2020 8:50 pm

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

adrian_sorop
Posts: 9
Joined: Wed Jun 22, 2016 2:48 pm

Re: MySQL JDBC - Could not establish connection

Post by adrian_sorop » Mon Sep 14, 2020 1:45 pm

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
Adrian Sorop
<oXygen/> XML Editor
http://www.oxygenxml.com

kevin-ncbc
Posts: 3
Joined: Sun Jan 15, 2012 11:05 pm

Re: MySQL JDBC - Could not establish connection

Post by kevin-ncbc » Sun Oct 18, 2020 11:18 pm

Hi Adrian ... just now got back to this ... your answer was right on! THANK YOU!! Kevin

Post Reply