Databases

Ads
 

Databases

how to add data dynamically into the database table?? i used back end is mysql....

View Answers

May 2, 2011 at 10:41 AM

1)form.jsp:

<html>
<form method="post" action="insertdata.jsp">
<table>
<tr><td>Name:</td><td><input type="text" name="name"></td></tr>
<tr><td>Address:</td><td><input type="text" name="address"></td></tr>
<tr><td>Contact No:</td><td><input type="text" name="contact"></td></tr>
<tr><td>Email:</td><td><input type="text" name="email"></td></tr>
<tr><td></td><td><input type="submit" value="Submit"></td></tr>
</table>
</form>
</html>

2)insertdata.jsp:

<%@page import="java.sql.*"%>
<%
String name=request.getParameter("name");
String address=request.getParameter("address");
int contact=Integer.parseInt(request.getParameter("contact"));
String email=request.getParameter("email");

        try{
        Class.forName("com.mysql.jdbc.Driver");
        Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
        Statement st=con.createStatement();
        int i=st.executeUpdate("insert into employee(name,address,contactNo,email) values('"+name+"','"+address+"',"+contact+",'"+email+"')");
        out.println("Data is successfully inserted into database.");
        con.close();
        }
        catch(Exception e){
        System.out.println(e);
        }
        %>

Ads









Related Tutorials/Questions & Answers:
Switch databases
Switch databases  How do you inter-change between relational databases without code changes
Databases
Advertisements
databases
databases
databases
databases
databases
Databases supported by Jdeveloper?
Databases supported by Jdeveloper?  I want to know what databases are supported by jdeveloper ?and any light database for jdeveloper
ModuleNotFoundError: No module named 'databases'
ModuleNotFoundError: No module named 'databases'  Hi, My Python... 'databases' How to remove the ModuleNotFoundError: No module named 'databases' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'databases'
ModuleNotFoundError: No module named 'databases'  Hi, My Python... 'databases' How to remove the ModuleNotFoundError: No module named 'databases' error? Thanks   Hi, In your python environment you
How to list databases in PostgreSQL
How to list databases in PostgreSQL  Hi, I want to connect to Postgresql database and see all the databases stored in the database. How to list databases in PostgreSQL?   Hi, You can do all these with the psql prompt
mysqldump all databases
mysqldump all databases  How to take the backup of complete data including all the databases in the MySQL Server? Is there one command to take...-databases > all_databases.sql Thanks
JanusGraph Supported Databases
JanusGraph Supported Databases  Hi, I want to choose the backend for JanusGraph to store my graphs. Which all databases are supported by JanusGraph... processing engine which supports many back-end databases. Here is the list of database
Merge databases in SQL SErver 2005
Merge databases in SQL SErver 2005  Please help me to merge databases in SQL server 2005
ModuleNotFoundError: No module named 'imbalanced-databases'
ModuleNotFoundError: No module named 'imbalanced-databases'  Hi...: No module named 'imbalanced-databases' How to remove the ModuleNotFoundError: No module named 'imbalanced-databases' error? Thanks   Hi
ModuleNotFoundError: No module named 'pymedphys-databases'
ModuleNotFoundError: No module named 'pymedphys-databases'  Hi, My... named 'pymedphys-databases' How to remove the ModuleNotFoundError: No module named 'pymedphys-databases' error? Thanks   Hi
Version of cocoon>cocoon-databases dependency
List of Version of cocoon>cocoon-databases dependency
Upgrading databases between MySQL 5.0 to MySQL 5.5
Upgrading databases between MySQL 5.0 to MySQL 5.5  Upgrading databases between MySQL 5.0 to MySQL 5.5
ModuleNotFoundError: No module named 'roundcube_merge_databases'
ModuleNotFoundError: No module named 'roundcube_merge_databases'  Hi...: No module named 'roundcube_merge_databases' How to remove the ModuleNotFoundError: No module named 'roundcube_merge_databases' error? Thanks  
is it possible to connect the multiple databases from the hibernate application
is it possible to connect the multiple databases from the hibernate application  is it possible to connect the multiple databases from the hibernate application,if it is possible then tell me with step wise manner
Maven Dependency cocoon-databases >> 2.1.3
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-databases version2.1.3 in your project
Maven Dependency cocoon-databases >> 2.1.6
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-databases version2.1.6 in your project
Maven Dependency cocoon-databases >> 2.1.4
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-databases version2.1.4 in your project
Maven Dependency cocoon-databases >> 2.1.5.1
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-databases version2.1.5.1 in your project
Maven Dependency cocoon-databases >> 2.1.7
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-databases version2.1.7 in your project
Maven Dependency cocoon-databases >> 2.1.8
You should include the dependency code given in this page to add Maven Dependency of cocoon >> cocoon-databases version2.1.8 in your project
Hibernate 4 Supported Databases List
Hibernate 4 Supported Databases List In this tutorial you will learn that how many databases are supported by Hibernate. You must be looking for the list... be configured to work with other databases. This feature of Hibernate is handled
need help....how to connect and disconnect multiple databases(databases created in mysql) using java and my sql
need help....how to connect and disconnect multiple databases(databases created in mysql) using java and my sql  i am working on a project... to know that how to query multiple databases(databases created in my mysql) so
connecting databases
conflicting databases
conflicting databases

Ads