Retrieving pseudo-columns - Java JDBC

Java examples for JDBC:ResultSet

Description

Retrieving pseudo-columns

Demo Code

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


public class Main {
  public void main() {
    try {/*from  ww w.j  a  va  2  s .  c o m*/
      Connection con = DriverManager.getConnection("jdbc:derby://localhost:1527/contact", "userName", "password");
      DatabaseMetaData metaData = con.getMetaData();
      ResultSet resultSet = metaData.getPseudoColumns("", "schemaName", "tableName", "");

      while (resultSet.next()) {
        System.out.println(resultSet.getString("TABLE_SCHEM ") + " - " + resultSet.getString("COLUMN_NAME "));
      }

    } catch (SQLException ex) {
      ex.printStackTrace();
    }

  }
}

Related Tutorials