Home Struts Struts-hibernate Setting up MySQL Database and Tables
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Setting up MySQL Database and Tables

Advertisement
I am assuming that you have running instance of MySQL Database and you know how to work with the MySQL database.

Setting up MySQL Database and Tables

     

I am assuming that you have running instance of MySQL Database and you know how to work with the MySQL database. To access the database you should have valid user name and password. 

Let's now start by creating the database for our struts- hibernate integration tutorial. Our application is very very simple and it searches for the keywords typed by user in the table. The database will contain one table 'tutorials' for holding the tutorials links and descriptions. Here is the complete sql script for setting up the database.

 

 

 

 CREATE DATABASE `struts-hibernate` ;

CREATE TABLE `tutorials` (

`id` INT NOT NULL AUTO_INCREMENT ,
`shortdesc` VARCHAR( 50 ) NOT NULL ,
`longdesc` VARCHAR( 250 ) NOT NULL ,
`pageurl` VARCHAR( 100 ) NOT NULL ,
PRIMARY KEY ( `id` )
) TYPE = MYISAM ;

The above table holds the short description, long description and url of the tutorials. The field 'id' is the unique identifier for records in the articles table.

Here are the details of the each of the fields in the table:

id: Unique key for the table

shortdesc: This fields stores the short description of the tutorial.

longdesc: This field stores the full description about the tutorial

pageurl: This field is stores the url of the tutorial

Run the following query to populate table with tutorials data:

INSERT INTO `tutorials` VALUES (1, 'JSP Tutorials, Hibernate and struts Tutorials', 'This site contains many quality Java, JSP Tutorials, Hibernate Tutorials, Struts Tutorials, JSF Tutorials, RMI, MySQL Tutorials, Spring Tutorials, source codes and links to other java resources. We have large number of links to the tutorials on java', 'http://roseindia.net/');


INSERT INTO `tutorials` VALUES (2, 'JSP Tutorial', 'Java Server Pages or JSP for short is Sun''s solution for developing dynamic web sites. JSP provide excellent server side scripting support for creating database driven web applications.', 'http://www.roseindia.net/jsp/jsp.shtml');


INSERT INTO `tutorials` VALUES (3, 'Struts Tutorials - Jakarta Struts Tutorial', 'This complete reference of Jakarta Struts shows you how to develop Struts applications using ant and deploy on the JBoss Application Server. Ant script is provided with the example code. Many advance topics like Tiles, Struts Validation Framework, Ja', 'http://www.roseindia.net/struts/index.shtml');


INSERT INTO `tutorials` VALUES (4, 'The Complete Spring Tutorial', 'Spring is grate framework for development of Enterprise grade applications. Spring is a light-weight framework for the development of enterprise-ready applications. Spring can be used to configure declarative transaction management, remote access to', 'http://www.roseindia.net/spring/index.shtml');


INSERT INTO `tutorials` VALUES (5, 'Java Server Faces (JSF) Tutorial', 'JavaServer Faces or JSF is grate technology for the development of user interfaces for web applications. The Java Server Faces specification is defined by JSR 127 of the Java Community Process.', 'http://www.roseindia.net/jsf/');


INSERT INTO `tutorials` VALUES (6, 'Jboss 3.0 Tutorial', ' This lesson shows you how to build you web application and install on the Jboss 3.0 application server. After the completion of this lesson you will be able to compile, assemble and deploy your J2EE application on Jboss 3.0 application server.', 'http://www.roseindia.net/jboss/index.shtml');

In the above steps we have setup our database. In the next section we will write java stuffs to integrate struts and hibernate.

 

     

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: January 30, 2008

Related Tutorials

Ask Questions?    Discuss: Setting up MySQL Database and Tables   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com