How to access mysql database from remote system having different ip series - java

My MySQL server is installed in X.X.60.X and accessing it through JDBC from X.X.80.X . I can connect it through MySQL workbench but when connect through the program it shows the following error message.
java.sql.SQLException: Access denied for user 'user'#'X.X.80.X' (using password: NO).
I have given all privileges to 'user'#'X.X.80.X in the server.

Is the password for user 'user' set in you MySQL server? If yes, check your programm, is's not using password:(using password: NO)

Related

How to point the database source to an IP instead of localhost on Glassfish 4.1

I am configuring my glassfish server so that a java web application fetches data from an IP (162.17.17.53) instead of localhost. When I try PING button on the JDBC Resiurce Pool, I get the below error:
Access denied for user 'user'#'162.17.17.54' (using password: YES) Error Code: 0. Please see server.log for more details.
NB: The machine I am doing the configurations on has the IP 162.17.17.54. Please assist

Cannot connect mysql workbench to remote database

I have a remote mysql database on mydomain.com power by goDaddy and have a database name "arsenal101" with several tables and I have assigned the user "arsenal101" with password "22216888" with full privilege to that database.
In my local MySQl workbench in Macbook, I try connecting my MySQL workbench to that remote database.
Here is the screenshot
The hostname I enter mydomain.com
The username is arsenal101
The password is 22216888
The default schema is blank.
After I pressed test connection, an error message showed up " Failed to Connect to MySQL at mydomain.com: 3306 with user arsenal101
access denied for user arsenal101#xxxxxxx (using password Yes)
You should check if GoDaddy allows you to do a remote connection to the database because a lot of hosting companies don't allow that. Their MySQL has to be configured to receive external connections.
According to here: https://in.godaddy.com/help/connect-remotely-to-databases-4978
If you want to connect remotely to a database, you must enable Direct Database Access when setting it up1 — you cannot enable it later.

Error in creating the connection. java.sql.sqlException

i am trying to create a database connection , but database is not in my localhost, so i provided the IP instead of localhost in
Connection con= DriverManager.getConnection(conStr,user,pass);
where
constr="jdbc:mysql://10.0.0.1/Sigma"
but its giving
java.sql.SQLException: Access denied for user 'root'#'15.3.0.4' (using password: NO)
but i login with the same user name and password
That's probably because the machine where you're running that code is has not that 15.3.0.4 IP, although you can connect from your machine which potentially has that IP.
You can try to create a 'root'#'%' user who will be granted to access regardless where you are connecting from.

Connecting to a MSSQL server using LDAP on Ubuntu Linux

I'm trying to connect to a MS SQL Server, using a linux client. I've tried both SQuirreL and DBeaver, but having no luck in either case. I've tried a few different drivers.
The connection string I am given looks something like this:
jdbc:oracle:thin:#ldap://<server>:<port>/<database>,cn=OracleContext,dc=<specific_dc>,dc=<specifc_dc>,dc=<specific_dc>
This seems to be an invalid URL, and I've tried various combinations of things (like using jdbc:sqlserver:// ... protocol, etc. It doesn't seem to like the #ldap in the connection string, and I've replaced the commas with semicolons. But, I'm new to connecting to SQL Server, much less using LDAP.
Any thoughts/help?
Thanks!
For those who are using DBeaver the way to connect to the SQL Server Database with an AD user is using the jTDS driver.
I am using DBeaver 6.0 in Debian 9. The user is an AD user.
In order to connect to the SQL Server from Linux Debian using DBeaver
1.- Select SQL Server jTDS driver
2.- Enter the connection information
3.- Go to Driver Properties tab and add the domain, user, password
Just as a note, in some post I found that they needed to change the property USENTLMV2 to TRUE but it worked for me either by putting the USERTLNMV2 in true or false.
A problem that I found was that when I was trying to connect to the database using my user and password the next error was thrown:
This error was thrown because of my user was about to expire. I tried with another AD user and it could connect.
cts:
datasource:
url: jdbc:jtds:sqlserver://dbserver:1433;database=DB;domain=yourdomain.com;useNTLMv2=true
driver-class-name: net.sourceforge.jtds.jdbc.Driver
username: username
password: password
hikari:
connection-test-query: SELECT 1
maximumPoolSize: 2
minimumIdle: 1

MySQL not able to connect from remote client

I have my MySQL server running on machine with IP address 181.2.3.5, and I have a database called affablebean running on it. I am able to connect via from same machine. But when I try to access it remotely to deploy java application but I am getting below error:
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: Access denied for user 'root'#'181.2.3.4' (using password: YES)
Both systems are on LAN. I tried below queries to grant privellages:
GRANT ALL ON *.* to 'root'#'%' IDENTIFIED BY 'sql123';
flush privileges;
also below thing:
GRANT ALL ON *.* to 'root'#'181.2.3.4' IDENTIFIED BY 'sql123';
flush privileges;
But still I am getting same error, I tried restarting mysql service but still it's not accepting connections.
Btw Server is running Windows XP and client is running on Windows 7. I also tried below query:
mysql> use mysql;
mysql> SELECT host FROM user WHERE user = 'root';
it returns my ip address correctly. But still same error. Can anyone guide me? I tried above solutions from various SO questions.
Note: Above IP address and user name are just a place holder to illustrate.
Edit: I am able to access from Workbench, but I am not able to access from Java program.
You have to specify the port name with your server IP.
Like hostIP:portNumber
Workbench and your java programs are like any other clients. So what you need to see if there are any settings difference in between these two clients, maybe wrong credentials.

Categories