ERRor in executing DB program

ERRor in executing DB program

While executing following code an Error was generated.can any one help me for this.

LiveDB liveDBObj = DataSourceFactory.getLiveDBInstance();
PreparedStatement pstmt=null;
String qry="";
qry="insert into inst(id,name) values (?,?)";
                pstmt = liveDBObj.getPreparedStatement(qry);
pstmt.setDouble(1,2.0);
 pstmt.setString(2,"name1");
int i=pstmt.executeUpdate(qry);


----------
**ERROR:java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?,?)' at line 1**
View Answers

March 1, 2011 at 12:38 PM

There is a syntax problem.

Have a look at the following link:

JDBC PreparedStatement Example









Related Tutorials/Questions & Answers:
ERRor in executing DB program
ERRor in executing DB program  While executing following code an Error was generated.can any one help me for this. LiveDB liveDBObj...=pstmt.executeUpdate(qry); ---------- **ERROR:java.sql.SQLException: You have
while executing a java program
while executing a java program  while iam executing a simple java program after i type "java simple.java" there was a an error occuring.the error is "exception in thread "main" java.lang.noclassdeffounderror:simple" what thus
Advertisements
executing java program with 2 classes
executing java program with 2 classes  how to run a program of java containing more than one class....ex of program is given below.... class C...); } }   Executing java program with 2 classes save the file with D.java
java programe executing error - Java Beginners
java programe executing error  i am creating one package to one class, but the compilation is succeed but how to execute the class  Hi Friend, If you have following java class: package newp; class Hello
Zend Db error - WebSevices
Zend Db error  Hello friends, How i get the values from the database using zend framework Any one know the code. Help me
db error - Java Beginners
db error  Hi, how to insert text area content into database...://192.168.10.126/"; String db = "roseindia"; String driver = "com.mysql.jdbc.Driver...(driver); con = DriverManager.getConnection(url+db, user, pass
Program Error - WebSevices
Program Error  Hello Friends, Write the simple php program Using Zend framework with Database connection .Anyone know the code..._on' => new Zend_Db_Expr('CURDATE()'), 'bug_description' => 'Something
why the program is showing error?
why the program is showing error?  <%@page import="java.sql.*"%>...; It is showing the error: An error occurred at line: 33 in the jsp file...=Integer.parseInt(rs1.getString(10)); 36: i=i+k; An error occurred at line
Program error - WebSevices
Program error  Hello, Any one know the sample program for Login page using zend framework. Then how i connect my databse file to zend framework. Anyone help me
Program error - WebSevices
Program error  Hello friends, Username Required Password Required.... In which library file i include the top of my program.... Any one help me
Program error - WebSevices
Program error  Dear all, How i insert checkbox values into my database without using array In PHP . Anyone know the code
Program error - WebSevices
Program error  Dear all, How i insert checkbox values into my database without using array. Anyone know the code.   Hi friend, Code to help in solve the probelm : Insert CheckBox
what error in this program plese correct it
what error in this program plese correct it  import java.io.*; class y { public static void main (String args[]) { Data inputStream dis = new Data inputstream(System.in); float l,b,a; Systyem.out.println("enter the lengh"); l
Exception Handling-Error Messages in Program
Exception Handling-Error Messages in Program  Sorry about the first code block: import java.util.*; class GradeException extends Exception{ public GradeException(String s){ System.out.println(s); } } ----jGRASP exec: javac -g C
Exception Handling-Error Messages in Program
Exception Handling-Error Messages in Program  Hi Friend, I am having... with this. Here is the code with the error messages as Follows: import...[]) throws Exception{ This is where I begin to see problems with error messages
I/O Program output error
I/O Program output error  Hello All, I am working on a program... of the program in that it reads the text file and analyzes it, however I need it to take... java.util.TreeSet; /** * * @author zubeda.a.hemani */ //This program reads
ModuleNotFoundError: No module named 'executing'
program is throwing following error: ModuleNotFoundError: No module named...;executing' error? Thanks   Hi, In your python environment you... python library, ModuleNotFoundError: No module named 'executing' error
ModuleNotFoundError: No module named 'executing'
program is throwing following error: ModuleNotFoundError: No module named...;executing' error? Thanks   Hi, In your python environment you... python library, ModuleNotFoundError: No module named 'executing' error
this code gives addition of 2 numbers in j2me..but the code is not executing ..can u pls find out the error...??
this code gives addition of 2 numbers in j2me..but the code is not executing ..can u pls find out the error...??  import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class add1 extends MIDlet implements
sample jsp-servlet-service-db program
sample jsp-servlet-service-db program  <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>...; <% Connection conn=null; Statement stmt=null; try { DB obj=new DB
i got an error while compile this program manually.
i got an error while compile this program manually.  import javax.servlet.http.*; import org.apache.struts.action.*; public class ActionOne{ public...,struts jar files and i got an error in saveErrors() error Heading cannot find
Java Program Complication error - Java Beginners
Java Program Complication error  Hi there, I have this program I had to write called ThreeArrayLists.java, but I keep getting this error "use of unchecked or unsafe operations" This is the criteria for the program
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... the GUI as it is more reliable and efficent - the current program that i am working... that the program recquires a main() method in order to be runned - here is the following code
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... the GUI as it is more reliable and efficent - the current program that i am working... that the program recquires a main() method in order to be runned - here is the following code
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... the GUI as it is more reliable and efficent - the current program that i am working... that the program recquires a main() method in order to be runned - here is the following code
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... the GUI as it is more reliable and efficent - the current program that i am working... that the program recquires a main() method in order to be runned - here is the following code
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... the GUI as it is more reliable and efficent - the current program that i am working... that the program recquires a main() method in order to be runned - here is the following code
Till Slip Program Error Free - No Main Method
Till Slip Program Error Free - No Main Method  Hi there i am a java... the GUI as it is more reliable and efficent - the current program that i am working... that the program recquires a main() method in order to be runned - here is the following code
Error in Custom tag program - JSP-Servlet
Error in Custom tag program  Dear Sir,This is my problem concern to custom tag.Please review.. Browser show: Browser show: Parsing of JSP... to an error in /Home.jsp line 1
executing Hibernate application
executing Hibernate application  when i am executing the hibernate application the following error occured. log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). /hibernate.cfg.xml not found log4j
How to eliminate error," Could not find the main class: filecopy.FileCopy. Program will exit." ?
How to eliminate error," Could not find the main class: filecopy.FileCopy. Program will exit." ?  run: java.lang.NoClassDefFoundError: filecopy... class: filecopy.FileCopy. Program will exit. Exception in thread "main" Java
error in program when trying to load image in java - Java Beginners
error in program when trying to load image in java  Hi, I'm trying... errors but my program still won't run. I keep getting this type of message and I don't know what it means. ProductInventoryVGUI Uncaught error fetching image
Error 500-Server are not find the jar file in the program of upload the file - JSP-Servlet
Error 500-Server are not find the jar file in the program of upload the file  Hello Sir, your response: Hi friend, The 500 Internal Server Error is a "server-side" error, meaning the problem is not with your PC or Internet
program created and compilation error of connection rightly created n tested
program created and compilation error of connection rightly created n... error for connection on which other programs are running smoothly...:( import... ("there was some error in establishing connection : "+e); } sep
Problem in executing query....
Problem in executing query....  Suppose there is a textbox or a text... it is showing error because of the '.I understand where the problem is.If... gives it.How can I solve the error....   The given code
error
error  i have 404 error in my program plz tell me yhe solution about
error
error  i have 404 error in my program plz tell me yhe solution about
error
error  I am running a program insert into statement in sql using.../ServletUserEnquiryForm.shtml getting an error given below SQLException caught: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error please suggest
error
error  while iam compiling iam getting expected error
Error-
Error-   Hello, I would like to know about XSD file. I try to print XML file but I am getting error SAXException-- says Content is not allowed in prolog. Please help me
error
"+it); } } this is my program i am getting an error saying cannot find symbol class stringADS
Error
Error  I have created ajax with php for state and city. When I change state then city will not come in dropdown list and it give me error as 'Unknown Runtime Error'. This error come only in IE browser, but in other brower
error
error  java.lang.unsupportedclassversionerror:bad major version at offset 6 how to solve this????   Hi, Please check the version of framework used and also the JDK version.ADS_TO_REPLACE_1 This type error also comes
error
error
error
error  When I deploye the example I have this message cannot Deploy HelloWorld Deployment Error for module: HelloWorld: Error occurred during deployment: Exception while deploying the app [HelloWorld
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error
is"+sum); } } this is my program i need to print the series (1+2/12)+(1+2
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern

Ads