Results 1 to 3 of 3
  1. #1
    KTR
    KTR is offline Member
    Join Date
    Jan 2009
    Posts
    2
    Rep Power
    0

    Default calling stored procedure through java

    How to call stored procedure with arguments in mysql through java

  2. #2
    prabitha is offline Member
    Join Date
    Nov 2008
    Posts
    2
    Rep Power
    0

    Default

    Its very easy.
    Just try this sample code.
    try
    {

    String var="var";
    Connection c=(Connection) new DBConnection().getConnection();
    CallableStatement cstmt=(CallableStatement) c.prepareCall("{call databsename`.`procedure_name`('"+var+"')}");
    cstmt.execute();

    cstmt.close(); c.close();

    }

    catch(Exception ex)
    {
    JOptionPane.showMessageDialog(null,"Message");
    ex.printStackTrace();
    }

  3. #3
    KTR
    KTR is offline Member
    Join Date
    Jan 2009
    Posts
    2
    Rep Power
    0

Similar Threads

  1. [SOLVED] Java equivalent to X11 Work Procedure
    By LongHitter in forum New To Java
    Replies: 0
    Last Post: 01-12-2009, 11:36 AM
  2. stored procedure
    By sankarigopi in forum JDBC
    Replies: 1
    Last Post: 11-13-2008, 04:53 PM
  3. How to get multiple rows from Stored Procedure
    By SRJ1957 in forum Advanced Java
    Replies: 0
    Last Post: 08-11-2008, 08:26 PM
  4. Calling SQL Server stored procedures
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-07-2008, 08:40 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •