Using MYSQL Database with JSP & Servlets.

Using MYSQL Database with JSP & Servlets.
Using MYSQL Database with JSP & Servlets.
MY SQL is a powerful RDBMS, which can handle large amount of data. And more interestingly it is free to use, except for some commercial use. you can download it

Using MYSQL Database with JSP & Servlets.

MYSQL is a powerful RDBMS, which can
handle large amount of data. And more interestingly it is free to use,
except for some commercial use. you can download it from www.mysql.com.
It is available for both Linux and NT platforms, but it is primarily
for Linux and Unix servers and is mostly used on Linux and Unix
platform.

This lesson is intended to
provide hands an experience with MYSQL database. We will use tomcat
web server to run over web application which acceres the MYSQL
database. Here I am using MYSQL & tomcat server both running an
Linux machine.

Downloading and installing
MYSQL Server.

Downloading MYSQL server
from www.mysql.com. Upload the
downloaded file on to your Linux server. go to the directory where you
uploaded the file. To install the file issue the Following command.

rpm-ivh mysql-server-3.23.361.1386.rpm.

This will install the MySQL server on your
Linux machine.

Testing the installation is
complete.Issue the following command after
the installation is complete.

MYSQL

And you will see the mysql prompt
(mysql>) appears ,this means that you sucessfully installed mysql
on your Linux server.

After creating database it is required to
connect to the database to create tables for our tutorial. To connect
to a database "use <database name>" command is used.
Type the following command to connect to mysqltutorial
database.

mysql> use mysqltutorial;
Database changed
mysql>

In MySQL all the database commands are
followed by a semi-colon(;).

Now we will create a table in the
database 'test' for storing the names of countries. "Create
table <table name>" command is used to create the
table. Issue the following command on mysql promopt:

In the above example we have created a table
named "test" to store country name, but the name "test" is not good. So we will change the name of table
to "country". We will use "rename" command
to rename the table. Type the following command to rename the table:

To view structure of database "desc
<table name>" is used. To view structure of countryname
issue the following command:

mysql> desc countryname;

Above command renames the table. To insert
some records in the database insert into table (fields..) values
(values..) command is used. Issue the following command to enter the
country name in the database.

Above command enters a record in the countryname
table. To view records from the countryname table issue the
following command:

mysql> select * from countryname;

In this section you learned how to work with
MySQL database server, create database, create tables in database,
rename table and insert and select the records from database table.
In the next lesson we will learn how to connect to the database from
JSP page.

camilus wokpul
August 20, 2011
educational research
Iwant a clear understanding in programs using mysql

Jon Kinsting
October 27, 2011
Slight error with select command results
The returned values for the command... 'SELECT * FROM countryname' contain an error. Specifically, the 'srno' value for 'USA' should be '2' (not 1).

sashanka halder
December 29, 2011
mysql data base code in jsp
How to update in jsp code by using mysql database.