Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error establishing source (relational) connection! #26

Open
damilolah opened this issue Sep 25, 2017 · 5 comments
Open

Error establishing source (relational) connection! #26

damilolah opened this issue Sep 25, 2017 · 5 comments

Comments

@damilolah
Copy link

Mysql example

db.url=jdbc:mysql://127.0.0.1:3306/clean_data
db.login=root
db.password=pass
db.driver=mysql-connector-java-5.1.18-bin.jar
#db.driver=lib/mysql-connector-java-5.1.28.jar
#db.driver=com.mysql.jdbc.Driver

I'm getting this in my status.log file;
Error establishing source (relational) connection! Please check your connection settings.

Please is something wrong with my connection settings above. Also, what is the correct input to db.driver.
Thanks.

@nkons
Copy link
Owner

nkons commented Sep 25, 2017

Hi, the correct input to db.driver for mysql is

db.driver=com.mysql.jdbc.Driver

@damilolah
Copy link
Author

Thanks for your reply.
My connection settings now look like this:

db.url=jdbc:mysql://localhost:3306/clean_data
db.login=root
db.password=passwd
db.driver=com.mysql.jdbc.Driver

I've corrected that but still I'm getting this in my status.log file;
Error establishing source (relational) connection! Please check your connection settings.

The database exist and I can query it but I wonder why connection cannot be established.

@ConstantinHildebrandt
Copy link

ConstantinHildebrandt commented Mar 25, 2019

Hey,

I am facing the exact same issue. Was there a solution in the meanwhile?

My r2rml.properties is:
db.url=jdbc:mysql://localhost:3306/sakila
db.login=root
db.password=123456
db.driver=com.mysql.jdbc.Driver

I can establish a connection via MySQL Workbench with the abovementioned login credentials and I can query the sakila database (e.g. table "actor"). However, I still get the error: "2019-03-25 13:16:52,567 ERROR [Database] Error establishing source (relational) connection! Please check your connection settings."

I am using a Win10 x86 device with mysql community version 5.5.

Thanks!

EDIT: I updated to MySQL Server 8.0.15 with Connector/J 8.0.15, still facing the same issue.

EDIT TO EDIT: When I use the source code and update the JDBC Connector to version 8.0.14 and use the following db info:

String user = "?user=root";
String password = "&password=123456";
String url = "jdbc:mysql://localhost/sakila";
String conf = &useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";

Then I can at least establish a connection to the DB, however, then I get the following error:

java.lang.StringIndexOutOfBoundsException: begin 7, end -1, length 7
at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
at java.base/java.lang.String.substring(String.java:1874)
at gr.seab.r2rml.entities.sql.SelectQuery.createSelectFields(SelectQuery.java:61)
at gr.seab.r2rml.entities.sql.SelectQuery.(SelectQuery.java:34)
at gr.seab.r2rml.beans.Parser.findLogicalTableMappings(Parser.java:501)
at gr.seab.r2rml.beans.Parser.parse(Parser.java:106)
at gr.seab.r2rml.beans.Main.main(Main.java:83)
Exception in thread "main" java.lang.NullPointerException
at gr.seab.r2rml.beans.Generator.createTriples(Generator.java:189)
at gr.seab.r2rml.beans.Main.main(Main.java:93)

@ConstantinHildebrandt
Copy link

So I solved the issue, but it requires changes to the source code in order to run with MySQL version > 5.5.

I did the following:

  • I installed the latest version of MySQL (8.0)
  • I changed the maven dependencies of "mysql-connector-java" to "8.0.15".
  • The latest driver is: "com.mysql.cj.jdbc.Driver", I changed that in the properties file

Lastly, I am not sure whether that is just specific to my MySQL instance, however, I had to change the strings that is used to establish the MySQL server connection to:

connection = DriverManager.getConnection(url + user + password + conf);

	String user = "?user=root";
	String password = "&password=1234";
	String url = "jdbc:mysql://localhost/sakila";
	String conf = "&useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC";

The java exception I got from above, was just because the sakila DB, which is used as MySQL example DB which is created by default on install, does not look as it is modelled in the R2RML mapping file. So by adjusting the example mapping to the actual example data, it works just fine.

Regards,
Constantin

@nkons
Copy link
Owner

nkons commented Mar 29, 2019

Hi,

Happy to hear this works now.

Thanks for posting your solution here. This is likely to be helpful to other Mysql users as well.

Best,
Nikos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants