Home » Java » java – Connecting to an online database that can be accessed via different systems-Exceptionshub

java – Connecting to an online database that can be accessed via different systems-Exceptionshub

Posted by: admin February 25, 2020 Leave a comment

Questions:

Hi guys am trying create a library management system but I want to host my database in an online server and not an offline method having the database files in different system but I dont know how to achieve this

How to&Answers:

You may purchase or search for a free db hosting provider like

1. freemysqlhosting

Register to your preferred online hosting site then create a db and your tables.

Then you may connect to your DB from anywhere using a connection string. You can connect even from localhost.

//Your connection
$conn = new mysqli( 'server_url', 'username', 'password', 'database_name'); 

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $con->connect_error);
}

The hosting providers will provide you with the information that you would require for connection.

Server: xxxx
Db_Name: xxxx
Username: xxxx
Password: xxxx
Port number: 3306

Once you get the details you can login to phpmyadmin online phpmyadmin.co and create your tables