Error in MySQL Procedure Using JAVA Code

Error in MySQL Procedure Using JAVA Code

The following Java code (using Connector/J to create a stored procedure on MySQL 5.0) does not execute successfully. Identify the cause and available solutions.

statement.execute("DELIMITER //\nCREATE PROCEDURE abdt (std INT)\nBEGIN\nSELECT attbegin, attend FROM abdt WHERE student_id = std;\n\nEND;\n//\nDELIMITER ;");

View Answers

November 25, 2010 at 12:59 PM

Hi Friend,

You can use the following way:

String query="";
    query = "CREATE PROCEDURE process_something (IN input_id BIGINT)\n";
    query+= "BEGIN\n";
    query+= "DECLARE num_rows, cnt, last_id INT DEFAULT 0;\n";
    query+= "DECLARE indx_found INT DEFAULT 0;\n";
    query+= _mainStoreProcedureBody;
    query+= "END\n";
    Connection con= session.connection();
    Statement st= con.createStatement();
    st.executeUpdate(query);

Thanks


November 25, 2010 at 1:01 PM

Hello Friend,

Please visit the following link:

http://www.roseindia.net/mysql/mysql5/stored-procedures-and-functions.shtml

Thanks


November 25, 2010 at 1:01 PM

Hello Friend,

Please visit the following link:

http://www.roseindia.net/mysql/mysql5/stored-procedures-and-functions.shtml

Thanks


November 25, 2010 at 1:31 PM

Thanks a lot :)









Related Tutorials/Questions & Answers:
Error in MySQL Procedure Using JAVA Code
Error in MySQL Procedure Using JAVA Code  The following Java code (using Connector/J to create a stored procedure on MySQL 5.0) does not execute...("DELIMITER //\nCREATE PROCEDURE abdt (std INT)\nBEGIN\nSELECT attbegin, attend FROM
SHOWING ERROR CODE 1064 WHILE TRYING TO EXECUTE PROCEDURE
SHOWING ERROR CODE 1064 WHILE TRYING TO EXECUTE PROCEDURE  I AM TRYING A SP BUT IT IS NOT SAVING AND WORKING.DOES THE STORED PROCEDURE WORK PARTLY...)affected) (0 ms taken) Error Code : 1064 You have an error in your SQL syntax
Advertisements
remote procedure call using java - JSP-Servlet
remote procedure call using java  what is the romote procedure call and related coding in java?  Hi Friend, The RPC (Remote Procedure Call) is a mechanism that enables a remote procedure call from a client
Insert Data in Table Using Stored Procedure
CallableStatement to execute a stored procedure into java code. The following syntax... data into a table using stored procedure. Steps: 1.Create database... is the video tutorial of Creating and calling the Stored Procedure in MySQL Database
please let me get code how to insert a data to mysql using setter and getter method by using java
please let me get code how to insert a data to mysql using setter and getter method by using java  please let me get code how to insert a data to mysql using setter and getter method by using java pelease let me have the code
please let me get code how to insert a data to mysql using setter and getter method by using java
please let me get code how to insert a data to mysql using setter and getter method by using java  please let me get code how to insert a data to mysql using setter and getter method by using java pelease let me have the code
Error in a code. - Java Beginners
Error in a code.  This is the question I posted yesterday: "I'm.... I'm confused about where and what i should put into the overall code. Also I can't quite figure out how to write the code for the GUI. Could anyone please help
Processing stored procedure in MySQL - SQL
Processing stored procedure in MySQL  Dear All java with mysql developer..... i need to convert my SQL procedure to MySQL database... here is my Stored procedure in SQL.... create or replace procedure INVNAMES (bno
How to convert Mssql Procedure into Mysql Procedure.
How to convert Mssql Procedure into Mysql Procedure.  Hello Sir, I have a mssql procedure and i need it to be converted to mysql ... Below is my mssql procedure code.. WITH CTE AS ( SELECT ROW
How to convert Mssql Procedure into Mysql Procedure.
How to convert Mssql Procedure into Mysql Procedure.  Hello Sir, I have a mssql procedure and i need it to be converted to mysql ... Below is my mssql procedure code.. WITH CTE AS ( SELECT ROW
servelet connectivity with oracle using procedure
servelet connectivity with oracle using procedure   kindly elaborate how servlet code connect to oracle br using procedure
procedure with code - JavaMail
procedure with code  hi thank u for sending a suitable link. but in that no info about sent item folder creation. i want to place a SENT MAIL FOLDER like inbox. so all the mails that r send r srored in sent mails folder. pls
Java Code Color Function Error
Java Code Color Function Error  Java Code Color Function Error
Java code error - Java Beginners
Java code error  Hi, I am using a MooreQuery to look for neighbors in a grid: MooreQuery query = new MooreQuery(grid, this,(int) (2*myHomeRangeRadius), (int) (2*myHomeRangeRadius)); if(query != null){ for (Object
error in java code - Java Beginners
error in java code  Hi Can u say how to communication between systems in a network.   Hi friend, A method for controlling an operation.../java/network/index.shtml Thanks
Mysql Alter Procedure
Mysql Alter Procedure     ... that is executed under one name. Mysql Alter Procedure is used to modify... The Tutorial illustrate an example from 'Mysql Alter Procedure'. To grasp Example
java runtime error: JDBC code - Java Beginners
java runtime error: JDBC code  Hi i want to insert data into mysql database in my local system. I installed mysql5.0 and using mm.mysql-2.0.4-bin.jar and also set in the class path. the code is compilled and giving runtime error
Mysql Declare Procedure
Mysql Declare Procedure        Mysql Declare Procedure is used to define a local variable within a procedure. The local variable are used within the procedure. Understanding
java code using swings
java code using swings  code that should be able to enter data of student details using all swings into the access database using jdbc connectivity
jsp code error - Java Beginners
jsp code error  Hi, I have a problem with following code... part. Is it possible to display a message box or alert box in jsp code??. plz help...; Hi friend , Try this code: /*out.println("Login Failed
Java error code
Java error code       Java Error code are the set of error that occurs... a sample of code that makes you to understand the java error code in a better way
Mysql Alter Procedure
Mysql Alter Procedure     ... that is executed under one name. Mysql Alter Procedure is used to modify and redefine... The Tutorial illustrate an example from 'Mysql Alter Procedure'. To grasp Example, we
java code for print true if even and false if odd and print error if any float value with out using conditional and looping statement
java code for print true if even and false if odd and print error if any float value with out using conditional and looping statement  hi class...%2!=0); System.out.println(error
passing xml created using DocumentBuilderFactory as input to oracle stored procedure using java JDBC
procedure using java JDBC  I want to send the xml as input parameter... and it is to be send using JDBC. Stored procedure in oracle database will contains two... is my java code... import java.io.; import javax.xml.parsers.; import
website creation using java and mysql - Java Beginners
website creation using java and mysql  i am going to create a website for some company using java and mySql... i dont know the procedure to create a website.can anybody give me the steps what i have to follow
Code error
) read.close(); } } } While using this it shows error as: run...Code error  package trail; import...(ClassLoader.java:247) ... 17 more Java Result: 1 BUILD SUCCESSFUL (total time: 9
Insert a row in 'Mysql' table using JSP Code
Insert a row in 'Mysql' table using JSP Code In this section, we will discuss about how to insert data in Mysql database using JSP code. Query... between your Tomcat server & Mysql database Table. Code to insert row in Mysql
error in code - Java Server Faces Questions
error in code  hi friends i have a problem in execution of JSF it is displaying the error like "Cannot find FacesContext" i am not understanding plz check the error and give me the answer i am sending the code of web.xml
need complete jsp code for transactions using mysql - WebSevices
need complete jsp code for transactions using mysql  iam doing online banking project.i want the code to transfer funds from one account to another... to lasya or lasya to prathika. I need complete jsp code for transactions using
Change root password of MYSQL using Java
Change root password of MYSQL using Java In this tutorial, you will learn how to change the root password of MYSQL database using java code. For every...(); } } } Description of Code: Changing the root password of a MySQL database
java code using while loop
java code using while loop  
java code for PartialSearch using Map????
java code for PartialSearch using Map????  java code for Partial Search using Map
java code compling error - Java Beginners
java code compling error  i have face below problem,when compiling... this problem?  Hi Friend, Your code downcasts from Object to something else instead of using genericity. Use generic collections. For instance, you
java Compilation error:jsp code - JSP-Servlet
java Compilation error:jsp code   I am getting an Generated Servlet error: String literal is not properly closed by a double-quote. here is my code: <% { Dbclass2 d= new Dbclass2
ERROR with my JAVA code - Java Beginners
ERROR with my JAVA code  The error came up in my main method... it wasnt there until i finished my actionListener coding so I dont know how to fix this....it is really stressing me out!! HELP!!! import java.awt.*; import
java code for registration and login pages, mysql as a bankend.
java code for registration and login pages, mysql as a bankend.  please send me the java code for registration and login pages and to store the data in mysql
JSF code Error - Java Server Faces Questions
JSF code Error  Hii Friends, When Iam working on JSF..,What jars are have to add in Applicaton? Thanks and Regards By Sreedhar
Error in using java beans - JSP-Servlet
Error in using java beans  I am getting the following error when I run the jsp code. type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request
Code Error - WebSevices
Code Error  How to insert checkbox values to mysql using php  Hi friend, Code to help in solving the problem : Insert CheckBox Thanks
Error in connecting to the mySQL database in TOMCAT using more than one PC (database connection pooling)
Error in connecting to the mySQL database in TOMCAT using more than one PC...="com.mysql.jdbc.Driver" url="jdbc:mysql://10.9.58.8:3306/alcs_htht"/> </Context>...-file-list> </web-app> and connected with the following code public
creating and executing stored procedure using hibernate
creating and executing stored procedure using hibernate  I have to execute following query using hibernate DECLARE @i_STARTDATETIME DATETIME DECLARE @i_ENDDATETIME DATETIME DECLARE @o_ERRORCODE INT DECLARE @o_ERRORDESCRIPTION
Snippet Code Error
Snippet Code Error  The following is a snippet of code from a Java application which uses Connector/J to query a MySQL database. Identify possible...("jdbc:mysql://repserver.intranet:4987/active?user=rbradstreet"); Statement s
procedure
procedure   step by step procedure to build servlet or jsp in eclipse
downloading a file directly from mysql using java
downloading a file directly from mysql using java  Hi, I am trying to come up with a code to download a file that is on a mysql database (in form of a blob) without using url. Can anyone tell me how it can be done because I am
HOW TO SAVE XML INTO MYSQL AND RETRIEVE IT USING JAVA
HOW TO SAVE XML INTO MYSQL AND RETRIEVE IT USING JAVA  H ello, i have an xml code, i need to save it into mysql 5.5 server database using java. i... xml code <Details> <title>Name</title> <addr>
procedure
procedure  write a procedure to update salary to 20% based on employee number
code for multiplication of matrix in java using methods
code for multiplication of matrix in java using methods  code for multiplication of matrix in java using methods
parsing xml file using java code
parsing xml file using java code  parsing a xml file using java code
Error with LogIn with mysql database
Error with LogIn with mysql database  Hi, I have followed steps from your tutorial titled SpringMVClogin with database. I am not using Jetty, as I... is org.hibernate.cfg.beanvalidation.IntegrationException: Error activating Bean Validation integration" My Code
error in code - JDBC
error in code  hi friends i had one problem when i am running the application of jdbc code it is getting that Exception in thread "main" java.lang.NoSuchMethodError: main plz send me the solution for that error   

Ads