Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    private static String url = "jdbc:oracle:thin:@localhost:1521:javaDemo";

    private static String username = "java";

    private static String password = "";

    public static void main(String[] args) throws Exception {
        Class.forName("oracle.jdbc.driver.OracleDriver");
        Connection conn = DriverManager.getConnection(url, username, password);

        DatabaseMetaData metadata = conn.getMetaData();
        ResultSet result = metadata.getProcedures(null, "JAVA", "%");
        while (result.next()) {
            System.out.println(result.getString("PROCEDURE_CAT") + " - " + result.getString("PROCEDURE_SCHEM")
                    + " - " + result.getString("PROCEDURE_NAME"));
        }
    }
}