Home Answers Viewqa Java-Beginners ERRor in executing DB program

 
 


B.sucharitha
ERRor in executing DB program
1 Answer(s)      2 years and 3 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**
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 Pages:
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
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
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 connecting to oracle db
(WindowEvent we) { System.exit(0); } }); } } I GOT ERROR FOR THIS PROGRAM ERROR:java.lang.ClassNotFoundException
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
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
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
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
JAVA DB connenting Office access..
JAVA DB connenting Office access..  hai friends....iam shackir.. i did 1 program to connect OfficeAccess...in this program everything except... HELP ME" ERROR IS : 3 SQl error in insertValues methord java.sql.SQLException
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
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
Insert Image In DB through Servlet - JSP-Servlet
Insert Image In DB through Servlet  Dear Sir, My previous Query that: I want to add the Image In databse using servlet. I have a program Its fine... a deploy time error in RED Color. Please review...   Hi friend
Insert Image in DB through Servlet - JSP-Servlet
Insert Image in DB through Servlet  Dear Sir, My previous Query that: I want to add the Image In databse using servlet. I have a program Its fine... a deploy time error in RED Color. Please review... Answers Hi friend, To insert
Insert Image In DB through Servlet - JSP-Servlet
Insert Image In DB through Servlet  Dear Sir, My previous Query that: I want to add the Image In databse using servlet. I have a program Its fine... a deploy time error in RED Color. Please review... Answers Hi friend, To insert
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
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
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
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
problem with executing JSF file(Build failed)
problem with executing JSF file(Build failed)  *while executing below...) { // System.out.println("ERRor in Logbeanpage@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@s... org.apache.catalina.core.StandardContext start SEVERE: Error listenerStart Jun 28, 2011 12:55:44 PM
error - JDBC
error  i wrote the program using dbms type 4 driver.it is comipled,i got a errors d:temp> java DBConnect db Connect Example...(Class.java:141) at DBConnect.main(DBConnect.java:13) and my program
JSP,DB,SERVLET
JSP,DB,SERVLET  I have a jsp page called page1.jsp with 3 text fields name,phone ,city.i populated these datas into a database table through servlet...) { request.setAttribute("Error", e.getMessage()); rd
error
"+it); } } this is my program i am getting an error saying cannot find symbol class string
error
is"+sum); } } this is my program i need to print the series (1+2/12)+(1+2
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
db
db
TextPad Editor + JDK
installed the Java JDK. 3. Entering, compiling, and executing your Java program in TextPad Type or paste your Java program source code into the large... with this process until it compiles correctly. Run the program by choosing
jdbc compilation error - JDBC
jdbc compilation error  java.lang.Exception: Problem in call_select when i am executing the program i am getting the above error. how can i resolve it?  Hi friend, plz specify in detail and send me code
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
RFT 8.1.1.3 Error
RFT 8.1.1.3 Error  While executing RFT 8.1.1.3 from command mode I am getting the following error message, I have enabled JRE 1.6 and Browser enablement test is pass. Error message is "exception_message = C:\Program Files\IBM\SDP
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
View Photo From Db MySql
View Photo From Db MySql  Good Morning Sir, Please help me, I make a small code but i have a error. I want to make viewer photo from database...); } } catch (Exception e) { JOptionPane.showMessageDialog(null,"error "+e
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
retrieving from db - JSP-Servlet
the following errors wen i am running the prg. the error is as follows. I can't figure out why i am getting the error. anyone help! org.apache.jasper.JasperException
trap error - Java Beginners
trap error  Hello. Am trying to trap this error that appears when i..."); //Executing the sql statement to write details in the client table // String sql...){ out.println(e.getMessage()); } } } i can insert to db
URGENT: Export Table in Oracle db to CSV file
URGENT: Export Table in Oracle db to CSV file  Hi, Could you basically help me by providing a program in Java. I want a program to connect and export a table in the oracle database to a folder in my local harddrive. Thankyou
compilation error - Java Beginners
compilation error  sir what is the error inthis code after executing the below code i got java.lang.NoSuchMethodError: main Exception...;i  Hi friend, Some points to be remember to run the Program : 1)Save
Hibernate Performing the usual DB operations
HIBERNATE-BASICS Hibernate Performing the usual DB operations... the usual DB operations. Hybernate2 can be downloaded from http... program with 4 buttons for add, modify, delete and find operations. We can call
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
Insert Image in DB through Servlet - JSP-Servlet
Insert Image in DB through Servlet  Dear Sir, You write me: copy... Ohterwise send ur mailid Thanks' Rajanikant But Sir, Its show a error. Error You want to download the following file: http://rapidshare.com
program
("query"); System.out.println(qry); // DB accessing
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
How to create d db for upload files using bolb i m followin dat upload file in db tutorial
How to create d db for upload files using bolb i m followin dat upload file in db tutorial  Hi, I have tried dis example, I have made d DB luk lik wht u have posted, still der is some problem,My program creates class file
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.