Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML
 
 
Search All Tutorials

 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 
Struts
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

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.

 

                         

Facing Programming Problem?
Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

19 comments so far (post your own) View All Comments Latest 10 Comments:

please give me suggestion for how can i use mssql server instead of hsqldb.

Posted by shobhit on Tuesday, 05.13.08 @ 10:08am | #59661



Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Posted by xichde on Monday, 04.28.08 @ 16:53pm | #58061

Its very helpful for instance guidance.
i came to know so many examples through this site.
I don't know how to thank's to this sites.

Posted by N. Siva Kumar on Monday, 04.28.08 @ 13:53pm | #58051

pls send me the hibernate tutorial to do my project in struts that requires integration with hibernate.
Although i have not learned Hibernate before thus i am finding it difficult to implemnt.

Posted by ashish on Monday, 04.28.08 @ 13:05pm | #58048

How To Connect Mysql Database With Struts Project?i want to know the answer for this question..can u send answer to my mail as early as possiblee..

thank you sir..

Posted by vamsi on Thursday, 04.24.08 @ 09:14am | #57766

how can i connect one table with two database in a hibernate code

Posted by rajesh on Thursday, 03.20.08 @ 12:42pm | #53448

i want java notes

Posted by prasad on Thursday, 03.20.08 @ 03:22am | #53411

i want to know how do we use database in struts project .

Posted by sumit jaswani on Monday, 02.4.08 @ 11:27am | #47169

i want entire struts 2 notes with source codes pls send me. to do my project sucessfully..

Posted by pratheepan on Wednesday, 01.30.08 @ 13:30pm | #46579

struts project needed

Posted by jalaljalal on Sunday, 12.16.07 @ 14:14pm | #42604

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Hot Web Programming Job

Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2007. All rights reserved.