Jdbc Qns and Ans

0 views
Skip to first unread message

Sreejith

unread,
Oct 17, 2008, 7:56:28 AM10/17/08
to iiitmk-webtec-group
Hi Friends,
We all saw how we could connect to a local database.
Its by using the mysql database url as

("jdbc:mysql:///database_name","user_name", "password");
OR
("jdbc:mysql://localhost/database_name","user_name", "password");

But inorder to connect to a remote database we have do a number of
steps.

* Edit the /etc/mysql/my.cnf file to change the bind address from
127.0.0.1 to the IP Address of the machine.
* Run the following sql command to grant privileges to user to use the
database from anywhere in the network.
GRANT ALL PRIVILEGES ON *.* TO user_name@"%" IDENTIFIED BY
'password';
or for a particular host it is
GRANT ALL PRIVILEGES ON *.* TO user_name@"Host_name" IDENTIFIED BY
'Password';
* The url to be used is
("jdbc:mysql://IP_ADDRESS/database_name","user_name","password");

Regards,
Sreejith
Reply all
Reply to author
Forward
0 new messages