This lesson assumes you have understanding on how JDBC application works. Formerly starting with database entrance through a servlet, make sure you have good JDBC environment setup along with a database.
To start with basic idea, let us make a simple table and create few records in that table as follows −
To create the Employees table in TEST database, use the following steps −
Open a Command Prompt and change to the installation directory as follows –
Login to database as follows
Create the table Employee in TEST database as follows –
Finally you create few records in Employee table as follows –
Here is an example which shows how to access TEST database using Servlet.
Now let us compile above servlet and create following entries in web.xml
Currently call this servlet using URL http://localhost:8080/DatabaseAccess which would show resulting answer −
Java Servlets Related Interview Questions
|XML Interview Questions||J2EE Interview Questions|
|JDBC Interview Questions||JSP Interview Questions|
|EJB(Enterprise JavaBeans) Interview Questions||Remote Method Invocation Interview Questions|
|JNDI (Java Naming and Directory Interface) Interview Questions||Java Bean Utils Interview Questions|
|Apache Tomcat Interview Questions||GlassFish Interview Questions|
|Website Builder Interview Questions||Xml Publisher Interview Questions|
Java Servlets Tutorial
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.