mysql cpanel netbeans remote connection - java

hello guys i have seen similar threads concerning my question but couldn't solve my problem. i am trying to remotely connect to the mysql database hosted on cpanel through my netbeans. i have added my ip address as a host to be allowed remote access. the cpanel ip address was given as https:197.211.45.2:2087. the username given as 'root' and the password also given. in my netbeans i try connecting to the database using the stated parameters and the database name but it wouldnt just connect. i have also tried using the default mysql port it still wouldnt work. if there is anything wrong i have done please put me aright. thanksthe image.. i have attached a snapshot. thanks

It's seems that MySQL port is not added in server firewall and due to that you are getting this issues. Please add port 3306 in firewall and check again.

Under cPanel there is usually 'Remote MySQL' tool which allows you to enter the IP addresses that are allowed to connect into the host.

Related

How to connect to a oracle remote database from a java application?

I'm trying to make a java application that connects to a database that is not located on my pc. I'm not sure how to do this. If I create my own database with MySQL, where do i need to store the database in order to acces it from other computers. I want to know what do I need in order to do this. I checked the internet and saw a lot of examples using jdbc and connecting to a url with localhost or something like this. Thank you!
Local: the server address will be 'localhost' or '127.0.0.1'
You can install mysql on your computer and connect to it with the computer's ip (generally 192.168.1.??). You can install LAMP or MAMP to have mysql working easily on your network ('put online' option).
Internet: the server adresse is given by your host, replace the 'localhost' or '127.0.0.1' address on the jdbc parameters.

How to make any ip address connect to the remote MySQL server?

Reason for asking the question:
For my third year minor project I am making an instant messenger type of application. The MySQL server for which will reside on my college's server. I have made the application in java and I am using mySQL for the back-end database.
Problem/Question:
My problem is that when I will distribute the application to my fellow students, the mysql server will be transferred to the college's server(currently everything is on my home computer, since I am developing right now), but then what I am supposed to do so that to every application remotely will be able to access this db on my college server.
I will be more specific:
This the basic code I am using currently:
Connection o =
DriverManager.getConnection("jdbc:mysql://localhost/db","root","pass");
I know when i will finally deploy the mysql db onto the server the localhost shall be replaced by the server's ip address(in each of the applications), but today when I tried to do this, I always got the error that:
"null message from server host 'theremoteip' is not allowed to connect to this mysql server"
So i went to the mysql server and applied:
GRANT ALL PRIVILEGES
ON database.*
TO 'user'#'%'
IDENTIFIED BY '%';
then i got this error:
Access denied for user 'root'#'theremoteipaddress' (using password: YES)
So, i figured that in the 'mysql' database root user may be assigned to only certain host addresses, i may be wrong but i think this is the problem.
So, I humbly request all of the veterans present on this community to please help me, I am new to all of this and I apologize if this question has an obvious answer and I didn't knew it.
Thank you for reading and please help me.
Again, the question is how I can make all the remote applications that I distribute among students to connect to the MYSQL database.
Probably for security reasons, root is allowed to login only from the same machine on which mysql server is running(or from listed ip addresses). If you ssh to your server and open mysql from there you should be able to change the permissions for your user.

how to specify host using ip address instead of name to connect to postgres database using netbeans in a java project?

i want to add database to my netbeans java project using ip address.
my question is that when i specify hostname by name that is "localhost" followed my correct details in the new connection wizard in netbeans connection establishes succesfully. this is as shown below.
but when i specify host by specifying ip address of my own computer that is localhost connection doesn't get established. same is shown below
well my motive is not to put ip of localhost but of another pc for remote database sharing over internet. but i think the problem lies in the method of specifying host using ip. if i get it right database sharing might work between different hosts as well.
also any other methods of sharing postgres database over the internet are also welcome.
i am a newbie in java as well as netbeans so any help is appreciated.
Your sense of thinking that localhost is your IP-Address is itself wrong!You need to have a loop-back address which will direct your operations to itself and not as the case of your IP-Address shown in ipconfig command.
You need to specify this 127.0.0.1 as the IP-Address.
127.0.0.1 is the most-commonly used IPv4 loopback address.
Try this :- jdbc:postgresql://127.0.0.1:5432/nic_project_db
localhost means this computer. It is a hostname that the computer's
software and users may employ to access the computer's own network
services via its loopback network interface. Using the loopback
interface bypasses local network interface hardware. // Taken from Wikipedia.
For future reference to anyone that might have same question here is solution:
In the postgresql database folder open up the postgresql.conf file. Add the following line:
listen_addresses = '*'
Then open up the pg_hba.conf file and add the following line:
host all all 0.0.0.0/0 md5

How to access derby database in another system from current system?

I just want to access the database in another system from current system. In that second system, i had already created a derby database which is in built in netbeans. I tried to access that database by changing the ip address instead of localhost in "jdbc:derby://localhost:1527/course".
But it shows java.net.ConnectException: Error connecting to server 10.6.3.3 on port 1527 with message connection timed out. How can i resolve this.. Please help me
You can run derby on two ways : embedded or server.
so first step is you need to run derby on server mode.However by running derby on server mode still only localhost can have access to database.
To give access to other IP's you need to run server with option : -h "0.0.0.0"
On windows : /pathtoderby/bin/startNetworkServer.bat -h "0.0.0.0"
On linux : /pathtoderby/bin/startNetworkServe.ksh =h "0.0.0.0"
Note: the reason you should not allow network access is security as derby is single user and plain text. before over network access make sure to read this topics to make sure you give secure access :
http://db.apache.org/derby/papers/DerbyTut/ns_intro.html

Java Client Refusing to connect to Remote Server

I am very New with Hbase, its really different from RDBMS. I developed a simple application and trying to configure it to remote server 162.18.17.55. I am getting connection refusing error. I am unable to to forward to check where it went wrong, when i type zk_dump in Putty , then i got the respective server details, I can login into putty and tables into database, but when i use java client i am not able to connect to server. please can any one guide me this process and issue
When you are connecting to Zookeeper it returns HadoopMaster as host instead of the ip address since you put HadoopMaster in your core-site.xml file. Now you need to add HadoopMaster in your /etc/hosts file to be able to recognize the host address. Add this line to your host file
162.18.17.55 HadoopMaster

Categories