Meta tags:
author= Dinesh Rajput;
Headings (most frequently used words):
example, servlets, of, servlet, interface, database, access, create, table, fetching, result, httprequest, httpresponse, requestdispatcher, class, httpservlet, advantages, over, cgi, hello, world, in, share, this, related, posts, about, the, author, dinesh, rajput,
Text of the page (most frequently used words):
spring (53), out (26), tutorial (25), println (25), and (24), java (22), interview (20), the (20), #servlet (17), example (11), boot (10), database (10), web (9), table (9), theresult (9), microservices (8), design (8), core (8), servlets (8), jdbc (7), dinesh (7), share (7), from (7), security (6), aop (6), jax (6), hibernate (6), opens (6), new (6), window (6), import (6), getstring (6), close (6), null (6), default (6), mvc (5), this (5), access (5), cloud (4), soap (4), rest (4), patterns (4), batch (4), with (4), related (4), servletconfig (4), public (4), theconnection (4), config (4), font (4), big (4), are (4), create (4), varchar (4), 255 (4), service (3), struts (3), services (3), tutorials (3), hateoas (3), development (3), application (3), architecture (3), technologies (3), has (3), previous (3), list (3), class (3), httpservlet (3), next (3), void (3), res (3), html (3), align (3), center (3), thestatement (3), user (3), all (3), records (3), privacy (2), policy (2), who (2), training (2), linux (2), git (2), thymeleaf (2), mongo (2), ant (2), gradle (2), maven (2), build (2), tools (2), ajax (2), hadoop (2), mail (2), api (2), jstl (2), jsp (2), j2ee (2), computing (2), wsdl (2), questions (2), search (2), mobile (2), certification (2), monitoring (2), testing (2), react (2), learn (2), solve (2), common (2), problems (2), use (2), rajput (2), technical (2), author (2), pattern (2), different (2), his (2), latest (2), framework (2), company (2), developer (2), about (2), interface (2), advantages (2), over (2), cgi (2), requestdispatcher (2), posts (2), pinterest (2), telegram (2), whatsapp (2), linkedin (2), facebook (2), file (2), servletcontext (2), genericservlet (2), difference (2), between (2), javax (2), connection (2), throws (2), servletexception (2), req (2), text (2), head (2), title (2), body (2), color (2), users (2), age (2), gender (2), hobbies (2), jobtype (2), username (2), driver (2), mysql (2), data (2), root (2), statement (2), select (2), print (2), result (2), bigint (2), auto_increment (2), accessing (2), copyright, 2026, hands, performance, engineer, guide, continuous, let, full, stack, designing, applications, native, various, them, best, practices, chief, editor, website, dineshonjava, blog, dedicated, series, articles, been, enthusiast, since, 2008, pivotal, certified, professional, book, blogger, more, than, years, experience, aspects, expertise, lies, version, creating, apis, microservice, reactive, cassandra, mongodb, currently, working, technology, manager, leading, product, worked, tech, lead, bennett, coleman, ltd, was, first, paytm, passionate, loves, write, blogs, very, active, member, community, forums, when, comes, tops, hello, world, httpresponse, httprequest, uploading, using, filter, what, life, cycle, overview, index, util, enumeration, http, sql, net, servletdata, extends, private, init, httpservletrequest, httpservletresponse, ioexception, httpsession, session, getsession, true, setcontenttype, printwriter, getwriter, emai, bgcolor, blanchedalmond, 008000, topmargin, face, helvetica, fuchsia, style, background, white, border, cellpadding, cellspacing, width, try, loading, sun, odbc, forname, com, connect, emaildb, source, drivermanager, getconnection, localhost, 3306, dojdb, createstatement, resultset, executequery, fetch, while, string, href, set, catch, exception, getmessage, trapped, error, destroy, fetching, assuming, there, many, getting, printing, doing, logic, for, simplicity, program, but, will, better, separate, webservice, popular, not, primary, key, engine, innodb, charset, latin1, test, following, steps, through, article, shows, you, how, comments, january, 2014, home,
Text of the page (random words):
servlets database access example dinesh on java core java core java java 8 certification interview q a spring boot spring spring core spring aop spring mvc spring security microservices spring 4 spring 5 spring batch spring mobile spring hateoas hibernate hibernate search tutorials design patterns web services ws interview questions jax ws soap jax rs rest wsdl soap cloud computing struts 2 tutorial j2ee tutorial servlet tutorial jsp tutorial jstl tutorial jdbc tutorial jax b tutorial java mail api hadoop tutorial ajax tutorial build tools maven gradle ant mongo db thymeleaf git linux interview q a spring interview aop interview mvc interview spring boot interview microservices interview spring security interview web service interview training who i am privacy policy home servlet servlets database access example january 11 2014 no comments servlets database access example accessing database from servlets through jdbc accessing access database from servlet this article shows you how to access database from servlets create table to create the users table in test database use the following steps create table create table user id bigint 20 not null auto_increment age bigint 20 default null gender varchar 255 default null hobbies varchar 255 default null jobtype varchar 255 default null username varchar 255 default null primary key id engine innodb auto_increment 5 default charset latin1 popular tutorials spring tutorial spring mvc web tutorial spring boot tutorial spring security tutorial spring aop tutorial spring jdbc tutorial spring hateoas microservices with spring boot rest webservice core java hibernate tutorial spring batch we are assuming there are many records in this table in this example we are getting the data from the database in servlet and printing it we are doing all the database logic in servlet for simplicity of the program but it will be better to separate it from the servlet file example of fetching result import java io import java util enumeration import javax servlet import javax servlet http import java sql import java net public class servletdata extends httpservlet connection theconnection private servletconfig config public void init servletconfig config throws servletexception this config config public void service httpservletrequest req httpservletresponse res throws servletexception ioexception httpsession session req getsession true res setcontenttype text html printwriter out res getwriter out println html head title emai list title out println head out println body bgcolor blanchedalmond text 008000 topmargin 0 out println p align center font face helvetica font color fuchsia style background color white big big list of users big big font p out println p align center out println table align center border 1 cellpadding 1 cellspacing 1 width 75 out println tr out println td id td out println td age td out println td gender td out println td hobbies td out println td jobtype td out println td username td tr try loading sun s jdbc odbc driver class forname com mysql jdbc driver connect to emaildb data source theconnection drivermanager getconnection jdbc mysql localhost 3306 dojdb root root statement thestatement theconnection createstatement resultset theresult thestatement executequery select from user select all records from user table fetch all the records and print in table while theresult next out println out println tr out println td theresult getstring 1 td out println td theresult getstring 2 td string s theresult getstring 3 out println td a href s s a td out println td theresult getstring 4 td out println td theresult getstring 5 td out println td theresult getstring 6 td out println tr theresult close close the result set thestatement close close statement theconnection close close database connection catch exception e out println e getmessage print trapped error out println table p out println p p font body html public void destroy previous index next servlet related posts java servlets overview servlet life cycle servlet example difference between servletconfig and servletcontext difference between genericservlet and httpservlet what is web application advantages of servlets over cgi genericservlet example requestdispatcher example servletconfig servletcontext servlet filter example file uploading example using servlet previous next share this share on facebook opens in new window facebook share on x opens in new window x share on linkedin opens in new window linkedin share on whatsapp opens in new window whatsapp share on telegram opens in new window telegram share on pinterest opens in new window pinterest servlet related posts httprequest httpresponse servlet requestdispatcher interface class httpservlet advantages of servlets over cgi hello world example in servlet interface about the author dinesh rajput dinesh rajput is the chief editor of a website dineshonjava a technical blog dedicated to the spring and java technologies it has a series of articles related to java technologies dinesh has been a spring enthusiast since 2008 and is a pivotal certified spring professional an author of a book spring 5 design pattern and a blogger he has more than 10 years of experience with different aspects of spring and java design and development his core expertise lies in the latest version of spring framework spring boot spring security creating rest apis microservice architecture reactive pattern spring aop design patterns struts hibernate web services spring batch cassandra mongodb and web application design and architecture he is currently working as a technology manager at a leading product and web development company he worked as a developer and tech lead at the bennett coleman co ltd and was the first developer in his previous company paytm dinesh is passionate about the latest java technologies and loves to write technical blogs related to it he is a very active member of the java and spring community on different forums when it comes to the spring framework and java dinesh tops the list learn various design patterns and best practices and use them to solve common design problems learn spring boot 2 0 and spring cloud application microservices architecture to solve common cloud native problems designing applications with spring boot 2 2 and react js let us full stack development with spring boot and react js hands on microservices monitoring and testing a performance engineer s guide to the continuous testing and monitoring of microservices dinesh on java copyright 2026 core java core java java 8 certification interview q a spring boot spring spring core spring aop spring mvc spring security microservices spring 4 spring 5 spring batch spring mobile spring hateoas hibernate hibernate search tutorials design patterns web services ws interview questions jax ws soap jax rs rest wsdl soap cloud computing struts 2 tutorial j2ee tutorial servlet tutorial jsp tutorial jstl tutorial jdbc tutorial jax b tutorial java mail api hadoop tutorial ajax tutorial build tools maven gradle ant mongo db thymeleaf git linux interview q a spring interview aop interview mvc interview spring boot interview microservices interview spring security interview web service interview training who i am privacy policy
|