SQL Exception

SQL Exception

I want stores data in to the databse table but it can't be stores it shows an error about sql exception.

blackberry.html

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <title>Blackberry & Datacard Asset</title>
    <head>
    <link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />  


    <!--[if lte IE 7]>
    <link rel="stylesheet" href="css/ie.css" type="text/css" charset="utf-8" />
    <![endif]-->
    </head>


    <body>
        <div id="header">


            <a href="index.html" id="logo"><img src="images/EATON-Logo.gif" alt="LOGO" /></a>

        <div id="navigation">   

            <ul>        
            <li class="first"><a href="index.html">Home</a></li>
            <li class="selected"><a href="Asset.html">Asset Allocation</a></li>
            <li><a href="services.html">Contact</a></li>
            <li><a href="solutions.html">About</a></li>             

            </ul>       
        </div>


        <div id="search">       

            <form action="">
            <input type="text" value="Search" class="txtfield" onblur="javascript:if(this.value==''){this.value=this.defaultValue;}"onfocus="javascript:if(this.value==this.defaultValue){this.value='';}" />

            <input type="submit" value="" class="button" />
            </form>     
        </div>  
</div> 




<!-- /#header -->   
        <div id="contents"> 
        <div class="background">
        <h3></h3>
<div id="contents"> 
<div class="background">
<h3></h3>
<p>
<a href="blackberry.html">BlackBerry & DataCards</a>. 
</p>        

<center>
<form name="form" action="bb.jsp" method="get">

<table cellpadding=12 cellspacing=6 border="1" bgcolor="#efefef" align="center">
    <th bgcolor="#efefef" colspan=8>
    <font size=5>BlackBerry & DataCards Asset</font> <br>
    <font size=2 color="red"><sup>*</sup> Required Fields</font></th>

<tr bgcolor="#efefef">
        <td valign=top>EID<b><sup>*</sup></b></td>
        <td><input type="text" name="eid" value="" size=10
            maxlength=10> <br>
        </td>
    </tr>

<tr bgcolor="#efefef">
        <td valign=top>UserName<b><sup>*</sup></b></td>
        <td><input type="text" name="usernm" value="" size=25
            maxlength=10> <br>
        </td>
    </tr>

<tr bgcolor="#efefef">
        <td valign=top>WS NUmber<b><sup>*</sup></b></td>
        <td><input type="text" name="wsno" value="" size=25
            maxlength=10> <br>
        </td>
    </tr>


<tr bgcolor="#efefef">
        <td valign=top>Device<b><sup>*</sup></b></td>
        <td><select name="device" id="course" style="width: 158px;">
            <option value="Select">---- Select ----</option>
            <option value = "Blackberry">BlackBerry</option>
            <option value = "DataCards">DataCard</option>
            </select> <br>
        </td>
    </tr>


<tr bgcolor="#efefef">
        <td valign=top>Model<b><sup>*</sup></b></td>
        <td><input type="text" name="model" value="" size=10
            maxlength=10> <br>
        </td>
    </tr>


<tr bgcolor="#efefef">
        <td valign=top>Service Provider<b><sup>*</sup></b></td>
        <td><input type="text" name="service" value="" size=20
            maxlength=10> <br>
        </td>
    </tr>

<tr bgcolor="#efefef">
        <td valign=top>IMEI Number<b><sup>*</sup></b></td>
        <td><input type="text" name="imei" value="" size=15
            maxlength=10> <br>
        </td>
    </tr>

<tr bgcolor="#efefef">
        <td valign=top>MEID Number<b><sup>*</sup></b></td>
        <td><input type="text" name="meid" value="" size=10
            maxlength=10> <br>
        </td>
    </tr>

<tr bgcolor="#efefef">
        <td valign=top><br>
        <input type="submit" name="add" value="AddNew" size=25></td>
        <td valign=top><br>
        <input type="reset" name="button" value="reset" size=25>
        <br>
        </td>
    </tr>



</table>
</form>
</center>


<h3></h3>
<p>

<a href="laptop.html">Laptop & Desktop</a> 

</p>        

<h3></h3>           
<p> <a href=""> HeadPhone</a> </p>
<p>     
<b></b>             
 <a href="">Phone</a>.<br/><br/>                 
</p>        

</div>  </div> 

</div>
</body>
</html>

**

bb.jsp
------

**
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%@page import="java.sql.SQLException;"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<%
    String eid = request.getParameter("eid");
    String usernm = request.getParameter("usernm");
    String wsno = request.getParameter("wsno");

    String model = request.getParameter("model");
    String service = request.getParameter("service");
    String imei = request.getParameter("imei");
    String meid = request.getParameter("meid");



    Connection con = null;
    PreparedStatement pstatement = null;

    int updateQuery = 0;



            try
            {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");  
            con = DriverManager.getConnection("jdbc:odbc:asset");
            String Qry = "INSERT INTO blackberry&datacards(User_id,User_name,WS_no,Model,Service_Provider,IMEI,MEID) value(?,?,?,?,?,?,?))";
            pstatement = con.prepareStatement(Qry);


            pstatement.setString(1,eid);
            pstatement.setString(2,usernm);
            pstatement.setString(3,wsno);

            pstatement.setString(5,model);
            pstatement.setString(6,service);
            pstatement.setString(7,imei);
            pstatement.setString(8,meid);
            updateQuery = pstatement.executeUpdate();

                    if(updateQuery != 0)
                        {%>
                        <br>
                   <TABLE style="background-color: #E3E4FA;" 
                   WIDTH="30%" border="1">
                      <tr><th>Data is inserted successfully in database.</th></tr>
                   </table>
                    <%  
                    }
            }
            catch(Exception e)
                {
                out.println("Failed to success");
                }
                pstatement.close();
                con.close();
%>
</html>
View Answers









Related Tutorials/Questions & Answers:
SQL Exception
SQL Exception  I want stores data in to the databse table but it can't be stores it shows an error about sql exception. blackberry.html <...(Exception e) { out.println("Failed to success
Java sql Exception
Java sql Exception  difference between sql exception class and sql warning class
Advertisements
SQL exception, Exhausted ResultSet
SQL exception, Exhausted ResultSet  javax.servlet.ServletException: java.sql.SQLException: Exhausted Resultset iam getting this error messege whenever i run my code. what would be the possible reasons
sql exception - JSP-Servlet
sql exception  Dear sir , I am working in a web-based project, In my system it is working fine but at client side getting the following exception so how to resolve this help me... java.sql.SQLException: ORA-28231
jdbc sql exception.
jdbc sql exception.  import java.sql.*; import java.io.*; class InsertEx { public static void main(String args[])throws Exception { Class.forName... Employee salary 9000 Enter Employee address hyd Exception in thread "main
jdbc odbc sql server exception
jdbc odbc sql server exception  Hi, I am trying to use sql server with java jdbc odbc but I am getting this exception java.sql.SQLException: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near '@P1
Enhanced SQL Exception Handling
Enhanced SQL Exception Handling       5. Enhanced SQL Exception Handling: A lot of improvement has been done regarding Exception handling in the following fields: Iterable SQL Exception
This Query is no working in sql developer it is giving Ora-0933 exception SQL command not properly ended exception
This Query is no working in sql developer it is giving Ora-0933 exception SQL command not properly ended exception  SELECT * from employees ORDER BY first_name limit 0,10;   Hi Friend, Please clarify your problem!ADS
exception
exception  wHEN RUNTIME EXCEPTION CLASS IS SUB OF EXCEPTION CLASS HOW CAN'T HANDLE UNCHECKED EXCEPTION
exception
exception  chek in and check out exception in java   Please visit the following link: Checked and Unchecked Exception
exception
arguments are not equalto two,throw a user defined exception "invalid parameter exception" ,otherwise display the two parameters.   Here is an example... is not equal to two then invalid parameter exception is thrown ,otherwise display the two
exception
exception  what is the use of catch block even though we have predefined exception object
exception
defined checked exception ââ?¬Å?InvalidCharcterFoundExceptionââ?¬Â? and creater a block of codes that will handle the exception
exception
exception  example for numberformat exception   Hi Friend, Try the following code:ADS_TO_REPLACE_1 class NumberFormatExceptionEx...); } catch(Exception e){ System.out.println(e
Exception
Exception  whis is the Arithmetic Exception in java? or define Arithmetic Exception with exp?   Arithmetic Exception occurs, when you divide a number by zero. Example public class TryCatch { public static void main
Exception
Exception  public class FooException extends Exception { public..."); } public void calculate() throws FooException, Exception { try { int.... ex.printStackTrace(); System.exit(1); } catch(Exception ex
Exception
Exception   I was creating a table dynamically but it shows exception i.e shown down Suplier created0 Suplier created0 Suplier created0 Product created0 Product created0 Product created0 Product created0 could not fetch initial
exception
user defined unchecked exception  can we create user defined unchecked exceptions? if so what is the exact use of it in real time?   Please visit the following links: http://www.roseindia.net/java/java-exception/user
exception
exception  Identify the reason for SQLException exception, which is encountered when the developer tries to run the following code snippet to insert..."); ps.executeUpdate(); } catch(Exception e
JDBC4.0-SQL Exception Handling Enhancements
categories of SQLException introduced in JDBC 4.0: SQL non-transient exception SQL transient exception Non-Transient Exception: This exception is thrown when...JDBC4.0-SQL Exception Handling Enhancements Exception handling is an important
sql
difference between sql and oracle  what is the difference between sql and oracle
sql
sql  how to get first row in sql with using where condition in sql? how to get last row in sql with using where condition in sql
sql
sql  I want interview sql questions   Please visit the following link: SQL Tutorials
Sql
Sql  how to find maximum of a101,a102,a103 from a table in sql
SQL
SQL  hii What is sql?   hello,ADS_TO_REPLACE_1 SQL, which stands for Structured Query Language, is a special-purpose language used to define, access, and manipulate data. SQL is non procedural, meaning
sql
sql  returning value from a store procedure in sql with example   Please visit the following links: http://www.roseindia.net/mysql/mysql5/stored-procedures-and-functions.shtml http://www.roseindia.net/sql/create
exception handling
exception handling  explain about exception handling
SQL
SQL  In my computer i have microsoft sql 2008.how can i set that in the cmd.i want to use that in cmd.what is the default username and password
SQl
SQl  . Given two tables: table1(player, groundname, numcenturies); table2(ground_name, country); Write and SQL query for the following: " Select all the players from table1 who has
Exception handling
Exception handling  how to resolve file not found error exception
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
exception handling
exception handling  what is the information of exception handling?   Have a look at the following link: Java Exception Handling
Exception Java
Exception Java  Hi, What are the Exception Java? Thanks   Hi, Read it at Java Exception. Thanks
SQL
SQL   1)How to Store 1000 records in Oracle object. 2)Write a query for calculate highest, 3rd Highest & 10th highest salary from emp teble. 3)What is Sequence. 4)How to use rowid in Sql. 5)What is Views. 6)How
exception handling
exception handling   Give the exception hierarchy of Java.   Please visit the following links: http://www.roseindia.net/java/java-exception/exception-java.shtml http://www.roseindia.net/java/exceptions/exception
SQL
SQL  how to get ( 15 march 2011) and (15/03/2011) output using SQL   Use the following queries to get the data from database in the given format. For (15 march 2011) format: SELECT DATE_FORMAT(dob, '%d %M %Y') FROM
SQL
SQL  how to get ( 15 march 2011) and (15/03/2011) output using SQL   Use the following queries to get the data from database in the given format. For (15 march 2011) format: SELECT DATE_FORMAT(dob, '%d %M %Y') FROM
java exception
java exception   define an exception called no match exception tat z... { public static void main(String[] args) throws Exception { String z="Hello"; if(!z.equals("India")){ throw new Exception
Exception Handling
Exception Handling  create an exception class, which thros an exception if operand is non-numeric in claculating modules. ( Use command line arguments
Java exception
Java exception  What happens if an exception is not caught
Java exception
Java exception  Can an exception be rethrown
custom exception
custom exception  What is user defined exception

Ads