jdbc connection


jdbc connection

How to Submit data????

View Answers

May 21, 2013 at 8:24 PM

    view jsp

<%@page import="java.sql.Statement"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.Connection"%>
<%@page import="java.sql.ResultSet"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    <center> <h1>View Your Location</h1>
        <form action="view" method="POST">
            <b> Enter Your Ignite Id:</b><input type="text" name="id" placeholder="IgniteId"><br><br>
            <input type="submit" value="SUBMIT" name="submit"><br><br><br>
            <table border="2">

                    try {

                        ResultSet rs = (ResultSet) request.getAttribute("data");
                        while (rs.next()) {
                    <td><input type="text" value="<%=rs.getString("name")%>"</td>
                    <td><input type="text" value="<%=rs.getString("home")%>"</td>
                    <td><input type="text" value="<%=rs.getString("location")%>"</td>
                <%                        }
                    } catch (Exception e) {


        </form> </center> </body>

    view serverlet

PrintWriter out = response.getWriter();
        String Id = request.getParameter("id");

        try {
            Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://", "root", "root");
            String id=request.getParameter("id");
        String query = "select * from posting where ignite_id='"+id+"'";
        Statement s = null;
            s = (Statement) con.createStatement();
            ResultSet rs = null;
             rs = s.executeQuery(query);
              request.setAttribute("data", rs);
        RequestDispatcher rd = request.getRequestDispatcher("view.jsp");
        rd.forward(request, response);              

      } catch (Exception e) {
        } finally {


    submit jsp
<center>  <form action="hit" method="POST">

                <b> iGnite Id:</b><input type="text" name="id" placeholder="Ignite Id"><br><br>
                <b>Your Name:</b><input type="text" name="name" placeholder="Name"><br><br>
               <b> Home Town:</b><input type="text" name="home" placeholder="Home"><br><br>
                <b>Location:</b><input type="text" name="location" placeholder="Location"><br><br>
                <b>Gender</b><input type="radio" name="sex" value="male">Male
                            <input type="radio" name="sex" value="female">Female<br><br>

                <b>Choice</b><input type="checkbox" name="choice" value="Kolkata">Kolkata
                            <input type="checkbox" name="choice" value="Chennai">Chennai
                            <input type="checkbox" name="choice" value="Mumbai">Mumbai
                            <input type="checkbox" name="choice" value="Delhi">Delhi<br>
                            <input type="submit" name="submit" value="Submit">

            <center><a href="view.jsp"><h1>VIEW</h1></a></center>


    submit serverlet
PrintWriter out=response.getWriter();
        String Id=request.getParameter("id");
        String Name=request.getParameter("name");
        String Home=request.getParameter("home");
        String Location=request.getParameter("location");
        String Gender=request.getParameter("sex");
        String Choice=request.getParameter("choice");

         Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://", "root", "root");
        String sql="INSERT INTO posting (ignite_id,name,home,location,gender,choice) 

      PreparedStatement ps=(PreparedStatement) con.prepareStatement(sql);

        catch(Exception e)
            out.print("Submit Successfully");



Related Tutorials/Questions & Answers:
jdbc connection
"); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql:// connection  How to Submit data????   <%-- view... { Class.forName("com.mysql.jdbc.Driver"); Connection con = (Connection
JDBC connection
JDBC connection  ![alt text][1]I got exception in Connecting to a MySQL Database in Java. The exception is ClassNotFoundException:com.mysql.jdbc.Driver wat is the problem
jdbc connection issues
jdbc connection issues  Hello. kindly pls help in this issue...i have created 11 jsp form wit some attributs in it also created 11 tables... tables with only one jdbc connection program...if possiable pls post a sample code
Java-Connection Pool - JDBC
Java-Connection Pool  How can I create a connection pool. My database... is Weblogic 8. Which is the best approach to create a connection pool? ...{ public static void main(String[] args){ Connection con = null; String url
JDBC Connection and Registration
JDBC Connection and Registration   How to create a JDBC connection..... :-)   JDBC MS Access Database Connectivity: Follow these steps: 1)Go... your java with jdbc code.. It will create table in MS access database. Here
problem in jdbc connection
problem in jdbc connection  when i am trying to insert into apache derby databse using java in netbeans an exceprion is thrown at run time like this:- java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver....what
JDBC connection
JDBC connection       The JDBC... we illustrates you JDBC url connection. The current Tutorial helps you to understand JDBC connection. The code explains you   how
JDBC Connection code to connect servlet with oracle.
JDBC Connection code to connect servlet with oracle.  JDBC Connection code to connect servlet with oracle
JDBC-Odbc Connection
JDBC-ODBC Connection       JDBC-ODBC Connection is a JDBC driver that translates the operation... in explaining JDBC Odbc Connection in Java. The code explains you a how creation
A JDBC Connection Pooling Concept
; } JDBC Connection Pooling JDBC Connection pooling is similar to any other object pooling. Connection pooling is very useful for any application which uses... into the pool.  An example of JDBC connection pooling is given below. to run
JDBC ODBC Connection In Java
JDBC ODBC Connection In Java In this section we will read about the various aspects of JDBC ODBC such as, JDBC-ODBC bridge, JDBC ODBC connection, how... is sun.jdbc.odbc.JdbcOdbcDriver. JDBC ODBC Connection To Connect the JDBC and ODBC
REQ for connection b/w jdbc and oracle database
REQ for connection b/w jdbc and oracle database    REQ for connection b/w jdbc and oracle database    The Java classes to connect... (OCI or Thin) through the JDBC connection URL. Here are some connection URL
Jdbc Mysql Connection Url
JDBC Mysql Connection Url      ... JDBC Mysql Connection. In this program, the code explain the JDBC url and string connection that helps you in connecting between url and database. For this we
Problem to get connection from DAO class to JDBC
Problem to get connection from DAO class to JDBC  package controller... ConnectionProvider { private static Connection con=null; //static Connection..."); }catch(Exception e){} } public static Connection getCon(){ return con
JDBC connection timeout
JDBC connection timeout       The Tutorial describe you a JDBC Connection timeout. In this program, we... The code include a class JDBC Connection Timeout, inside the main method we include
connection   how to make multiple database connection using jdbc
JDBC Connection Example
; } JDBC Connection Example JDBC Connection is an interface of java.sql.*;  package. An connection object represents a connection with specific database. A single application can have more than one Connection object with a single
JDBC Connection code to connect servlet with SQL Server 2008
JDBC Connection code to connect servlet with SQL Server 2008  Please... support for JDBC 4.0. i try Avery thing but i m not success so please ans me . My connection code is static Connection con; static Statement st; static
Jdbc Get Connection
JDBC Get Connection       The JDBC Get Connection is the mean of establishing... to understand a code from JDBC Get Connection. The code describe you connection
Jdbc Mysql Connection String
JDBC Mysql Connection String   ... public final String connection = "jdbc:mysql://localhost:3306/komal"...(connection, user, password); System.out.println("Jdbc Mysql Connection String
the connection with the available port on the host machine: import java.net.... the connection was not established. Predict the output of the preceding code. Explain why the connection cannot be established
JDBC  in class.forname which driver name we are writing for the connection from jdbc to sqlserver 2008
online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.
online quiz program coding using jsp, jdbc odbc connection with ms. access.. Thank you.  please provide online quiz program coding using jsp, jdbc...").newInstance(); Connection connection = DriverManager.getConnection("jdbc:mysql
jdbc  i had written jdbc connection in method and i need to get connection in another class?   import java.sql.*; class DatabaseConnection{ public static Connection getConnection() throws Exception { String
Correctly Open and Close database connection
; } Completely Open and Close A Database Connection Database Connection... and close database connections properly. If any database connection is open... , temporary tables all are are engaged. To release the connection object it is very
jdbc define batch updates  define batch updates?exp   JDBC... to the database in a single request using connection object. The advantage of batch... links: http://www.roseindia.net/jdbc/Jdbc-batch-update.shtml http
the connection between java and mysql using JDBC and saves the data into the database...!"); Connection con = null; String url = "jdbc:mysql://localhost:3306/"; String db...JDBC code to save a data in the database  I need a code to save
JDBC save a data in the database  I need a code to save a data in the database can anyone help?   The given code set up the connection between java and mysql using JDBC and saves the data into the database. import
using jdbc connection   import java.sql.*; public class CreateTable { public static void main(String[] args) throws Exception { Connection conn = DriverManager.getConnection("jdbc:odbc:student"); Class.forName
DataBase Connection
DataBase Connection  How to connect java and Oracle 10g? Tell me Jdbc connection
(); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost... information, visit the following link: JDBC Tutorials