[CONJ-326] hostnames should not be resolved to ip addresses Created: 2016-07-27  Updated: 2017-01-05  Resolved: 2017-01-05

Status: Closed
Project: MariaDB Connector/J
Component/s: Other
Affects Version/s: 1.4.5
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Tom McCann Assignee: Diego Dupin
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

rhel6 java7



 Description   

Using this connection: jdbc:mysql://localhost/schema

I get connection refused. admin@localhost has access to the database I'm trying to connect to, but connector is trying to connect 127.0.0.1. Here's the output: ERROR: Unable to obtain Jdbc connection from DataSource (jdbc:mysql://localhost/schema) for user 'admin': Could not connect: Access denied for user 'admin'@'127.0.0.1' to database 'schema'.

This akin to trying to connect to an https web site using the ip address. I.e. your browser will warn you about a certificate mismatch if you try to connect to google.com via it's ip address: https://216.58.193.78

As a work-around I added a admin@127.0.0.1 mysql user, but it would be better if the connector followed the rules.



 Comments   
Comment by Diego Dupin [ 2017-01-05 ]

This kind of error is due to missing priviledge to access database 'schema'. A GRANT command would have solve this. (i.e. error "Access denied for user 'admin'@'127.0.0.1' to database 'schema'.").

This is not a DNS resolution issue (DNS Lookup are done has you indicate in this issue).

Sorry for late answer.

Generated at Thu Feb 08 03:14:51 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.