Share on Google+Share on Google+

Nishant P Thite
SQL Exception
0 Answer(s)      5 years ago
Posted in : JDBC

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.*" %>
    <[email protected] 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>

Ads

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 [email protected]
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
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: class NumberFormatExceptionEx{ public static void...); } 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, SQL, which stands for Structured Query Language, is a special-purpose language used to define, access, and manipulate data. SQL is non procedural, meaning that it describes
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
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
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
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
Tutorials   
Java Spring Hibernate Struts Training how to retrieve text and images from mysql database and show on html page using jsp servlet How to install Neo4j on Ubuntu 15.10? please help me in these prog MYSQL - mysql copy table to another table example by creating new table solution for mapping hibernate and pojos from net beans through database Connect GWT application with Oracle inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store inventory System of Medical Store This code have created jTable that connected with a database.every cell of last column have a button.But this button doesn't work properly.Where is the error java program Java Database Program jdbc Database connection class in a live project ..?? What is JDBC architecture? Unable to Create DSN for excel to ms access importing data and edit that data Database Scrolling Buttons how to use foreign key in java How to delete content of a log file from linux terminal? JSP-Oracle connectivity Student Management System Java code for Saving Marathi (Indian local language ) in Mysql and retrieving the same crud operations with foreign key constraint. I really need help with this assignment question Please help me out Please Backup Failed Mysqldump Got Errno 28 On Write Upgrade MySQL 5.1 to 5.5 in cpanel mysqldump all databases com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'jpa.sequence' doesn't exist persistence xml class element persistence.xml for MySQL MySQL JDBC Driver pom dependency code Blob column jdk6 and oracle 8i connexion oracle 8i et jdk6 java [ cannot retrive date from sql ] why?? Order Entry System How to threow timeout exception when DB is not responding How to threow timeout exception when DB is not responding This is the employee form to add data to mysql database but I got error of NullPointerException, Is this write code please give me feedback as soon as possible make a method which takes user name & pwd as parameter & validate them against the database. If the corresponding user exist return true otherwise false. prabhakar validating credentials and displaying error message in login .jsp if not valid JDBC jdbc jdbc code register servlet vibhu connectiondetails from vibhu

Ads

 
Advertisement null

Ads