Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners ERRor in executing DB program

Have Programming Question? Ask it here!
 
 
 


B.sucharitha
ERRor in executing DB program
1 Answer(s)      3 years and 6 months ago
Posted in : Java Beginners


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**

Advertisement
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
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
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
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
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
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
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
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
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
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
Executing JAR file - Swing AWT
Executing JAR file  Hello Friends! I have successfully...:\>java -jar secl.jar then, the following error msg is shown... error msg dialog box is shown: Could not find the main class.Program
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
Aggregrate function Max() in db
and stuck with this problem. i have a table like Brand in mySql db where brandid(varchar) is generating automatically.. im having a Db connection class and a method... (SQLException sq) { System.out.println("error" + sq); return "error
DB Insert
DB Insert  How to insert XML data into a database column? Column data type is CLOB
db
db
db connectivity
db connectivity  hi i am beginner in objective c lang and having knowlwgde of basic syntax of this lang and need statements that can be used to connect to sqlite. please do send me the simple example code. i am using GNUstep
Executing Set of SQL statements in Java
Executing Set of SQL statements in Java  Hi, I am trying to execute a procedure which is stored in MS SQL server's database. I have configured... the code for saving the data in excel but the code for executing the query
DB connectivity - EJB
DB connectivity  DB connectivity
no data in db
no data in db  Using the example in "Networking/web-services-database.shtml" managed to do everything as shown above but there is no data in the database. the result is "record inserted". where can the error
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
Executing code upon folder/drive access
Executing code upon folder/drive access  I would be glad if someone could show me how to make your program in jar format execute when the folder that contains it is accessed or maybe a drive. Thank you.   Hi In case
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
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
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
getting db in action class
getting db in action class  hi, Am usin struts in ma application... n i need to interact with the db .. so i used.. getDataSource(request) but it gives me an error.. java.lang.NoSuchMethodError: LoginAction.getDataSource(Ljavax
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
executing multiple sql statements on the single button click...
executing multiple sql statements on the single button click...  how can i frame a code on the click of a button to insert data into a table as well as to retrieve records from the same table in another form
executing multiple sql statements on the single button click...
executing multiple sql statements on the single button click...  how can i frame a code on the click of a button to insert data into a table as well as to retrieve records from the same table in another form
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
Empty screen after executing servlet - Development process
Empty screen after executing servlet  Hi, After executing servlet am getting blank screen. Am using weblogic server and Eclipse editor. But jsp is working fine. Steps(what i did ) 1)Created servlet (In eclipse
Advertisements
 

 

 

DMCA.com