Getting the Stored Procedure Names in a Database - Java JDBC

Java examples for JDBC:Stored Procedure

Description

Getting the Stored Procedure Names in a Database

Demo Code

import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;

public class Main {
  public void m() throws Exception {
    Connection connection = null;
    // Get database metadata
    DatabaseMetaData dbmd = connection.getMetaData();

    // Get all stored procedures in any schema and catalog
    ResultSet resultSet = dbmd.getProcedures(null, null, "%");

    // Get stored procedure names from the result set
    while (resultSet.next()) {
      String procName = resultSet.getString(3);
    }/*from w  w w. j  a v a2s  .c o m*/
  }
}

Related Tutorials