Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Spring Framework | Web Services | BioInformatics | Java Server Faces | Jboss 3.0 tutorial | Hibernate 3.0 | XML

Tutorial Categories: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML

Fresher Job


Search Host

Monthly Fee($)
Disk Space (MB)
Register With us for Newsletter!
Visit Forum! Post Questions!
Jobs At RoseIndia.net!

Have tutorials?
Add your tutorial to our Java Resource and get tons of hits.

We offer free hosting for your tutorials. and exposure for thousands of readers. drop a mail
[email protected]


Java Server Pages


Java Beans



Java Servlets



Java Code Examples

Interview Questions

Join For Newsletter

Powered by groups.yahoo.com
Visit Group! Post Questions!

Web Promotion

Web Submission

Submit Sites

Manual Submission?

Web Promotion Guide

Hosting Companies

Web Hosting Guide

Web Hosting


Beginner Guide to Linux Server


Persistence Framework

Web Frameworks

Free EAI Tools

Web Servers

Aspect Oriented Programming

Free Proxy Servers


Adware & Spyware Remover

Open Source Softwares

JSP Storing Data, Datatype vale in SQL
<p>Storing Data, Datatype vale in SQL </p>
Storing Data, Datatype vale in SQL <br /><br />&lt;html&gt;<br /><br />&lt;head&gt;<br />&lt;title&gt;Current Date Insert value in database&lt;/title&gt;<br />&lt;/head&gt;<br /><br />&lt;body&gt;<br /><br />&lt;table border=&quot;1&quot; width=&quot;50%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;<br /> &lt;tr&gt;<br /> &lt;td width=&quot;100%&quot;&gt;<br /> &lt;h1&gt;&lt;center&gt;Current Date Insert value in Database&lt;/center&gt;&lt;/h1&gt;<br /> &lt;form method=&quot;POST&quot; action=&quot;InsertAction.jsp&quot;&gt;<br /> <br /> &lt;table border=&quot;1&quot; width=&quot;100%&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;<br /> &lt;tr&gt;<br /> &lt;td width=&quot;50%&quot; valign=&quot;right&quot;&gt;&lt;b&gt;Name:&lt;/b&gt;&lt;/td&gt;<br /> &lt;td width=&quot;50%&quot;&gt;&lt;input type=&quot;text&quot; name=&quot;username&quot; size=&quot;30&quot;&gt;&lt;/td&gt;<br /> &lt;/tr&gt;<br /> &lt;tr&gt;<br /> &lt;td width=&quot;50%&quot; valign=&quot;right&quot;&gt;&lt;b&gt;Job-Position:&lt;/b&gt;&lt;/td&gt;<br /> &lt;td width=&quot;50%&quot;&gt;&lt;input type=&quot;text&quot; name=&quot;jobposition&quot; size=&quot;30&quot;&gt;&lt;/td&gt;<br /> &lt;/tr&gt;<br /> &lt;tr&gt;<br /> &lt;td width=&quot;50%&quot; valign=&quot;right&quot;&gt;&amp;nbsp;&lt;/td&gt;<br /> &lt;td width=&quot;50%&quot; valign=&quot;right&quot;&gt;&amp;nbsp;&lt;/td&gt;<br /> &lt;/tr&gt;<br /> &lt;/table&gt;<br /> &lt;p&gt;&lt;input type=&quot;submit&quot; value=&quot;Submit&quot; name=&quot;B1&quot;&gt;<br /> &lt;input type=&quot;reset&quot; value=&quot;Reset&quot; name=&quot;B2&quot;&gt;&lt;/p&gt;<br /> &lt;/form&gt;<br /> &lt;/td&gt;<br /> &lt;/tr&gt;<br />&lt;/table&gt;<br />&lt;/body&gt;<br />&lt;/html&gt;<br /><br /><br /><br /><br />Actionpage<br /><br />InsertAction.jsp<br /><br /><br />&lt;%@ page language=&quot;java&quot; import=&quot;java.sql.*,java.util.*,java.text.*&quot; %&gt;<br /><br />&lt;%<br /><br />Connection con = null;<br /> String url = &quot;jdbc:<a href="mysql://localhost:3306/&quot"; target="_blank">mysql://localhost:3306/&quot</a>;;<br /> String db = &quot;register&quot;;<br /> String driver = &quot;com.mysql.jdbc.Driver&quot;;<br /> java.util.Date date;<br /> String s=null;<br /> try{<br /> Class.forName(driver);<br /> con = DriverManager.getConnection(url+db,&quot;root&quot;,&quot;root&quot;);<br /> try{<br /> Statement st = con.createStatement();<br /> String username=request.getParameter(&quot;username&quot;);<br /> String jobposition=request.getParameter(&quot;jobposition&quot;);<br /> DateFormat dformat = new SimpleDateFormat(&quot;yyyy-MM-dd&quot;);<br /><br /> try{<br /> date = new java.util.Date(); <br /> s = dformat.format(date);<br /> System.out.println(&quot;Today = &quot; + s);<br /> }<br /> catch(Exception e){<br /> e.getMessage();<br /> }<br /> int val = st.executeUpdate(&quot;insert user_details values('&quot;+username+&quot;','&quot;+jobposition+&quot;','&quot;+s+&quot;')&quot;);<br /> con.close();<br /> out.println(&quot;success&quot;);<br /> }<br /> catch (SQLException ex){<br /> System.out.println(&quot;SQL statement is not executed!&quot;);<br /> }<br /> }<br /> catch (Exception e){<br /> e.printStackTrace();<br /> }<br /><br />%&gt;<br />
Thank you for ur help
More Questions
Post Answers
Ask Question Facing Programming Problem?
Useful Links
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  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

Send your comments, Suggestions or Queries regarding this site at [email protected]

Copyright 2007. All rights reserved.