This section gives you brief description of MySQL
connection string. For the connection in mysql, we need some information about
database like server network address, user id, password and name of
Server: The network address to connect with MySQL.
The default is localhost (127.0.0.1).
Port: MySQL port number for connections. Default is 3306.
Uid: MySQL user account id to connect with MySQL.
Pwd: MySQL user password to connect with MySQL.
Database: Name of the database to work upon.
The above information is used to make a connection string
while connecting with the database. In the application below, we have connected
to the MySQL database and retrieved the employee names from the database using
JDBC. Here are some steps to follow while writing JDBC program:
Database Table: employee
CREATE TABLE `employee1` (
Here is the code of java program that retrieves all the employee data from database and displays on the console:
Getting All Rows from
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: MySQL Connection String
Post your Comment