How does mysql-java call the MySQL stored procedure?

Source: Internet
Author: User
! The following figure shows the upload (img.ask.csdn.netupload201605301464607016_994959.png) error when calling the stored procedure in Java. the stored procedure has two int parameters, which can be run in the database. the running result is java. SQL. SQLException: Parameterindexoutofrange (0 & lt; 1 ). the code is as follows. I don't know how to change it. ask a netizen to help publicArrayListgetzhdltj (StringTime, StringD mysqljava stored procedure

An error is reported when Java calls a stored procedure. the stored procedure has two int-type parameters and can run the stored procedure in the database. the running result is as follows: java. SQL. SQLException: Parameter index out of range (0 <1 ).
The code is as follows. I don't know how to change it. please help me.

Public ArrayList getzhdltj (String Time, String Dzbm)
{
// Define some variables
ResultSet rs = null;
Connection ct = null;
PreparedStatement csmt = null;
Statement ps = null;
ArrayList al = new ArrayList ();
Try
{
Ct = (new ConnectDB (). ConnDB ();
Int Dzbmint = Integer. parseInt (Dzbm );
Int Timeint = Integer. parseInt (Time );
// Ct. setAutoCommit (false );
Csmt = ct. prepareCall ("{PRO _ integrated power statistics (IN_YEAR, IN_STATIONID )}");
Csmt. setInt (0, Timeint );
Csmt. setInt (1, Dzbmint );

Csmt.exe cute (); ct. commit (); rs1_csmt.exe cuteQuery (); while (rs. next () {Wnbqgl nbqgl = new Wnbqgl (); // nbqgl. setMaxdl (rs. getDouble (2);/* monthly scheduled power generation */nbqgl. setYjfdl (rs. getDouble (1); nbqgl. setEjfdl (rs. getDouble (2); nbqgl. setSjfdl (rs. getDouble (3); nbqgl. setSijfdl (rs. getDouble (4); nbqgl. setWjfdl (rs. getDouble (5); nbqgl. setLjfdl (rs. getDouble (6); nbqgl. setQjfdl (rs. getDouble (7); nbqgl. setBjfdl (rs. getDouble (8); nbqgl. setJjfdl (rs. getDouble (9); nbqgl. setShijfdl (rs. getDouble (10); nbqgl. setSyjfdl (rs. getDouble (11); nbqgl. setSejfdl (rs. getDouble (12 ));

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.