Retrieving pseudo-columns : Database « JDK 7 « Java






Retrieving pseudo-columns



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

public class Test {
  public static void main(String[] args) throws Exception {
    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 "));
    }

  }
}

 








Related examples in the same category

1.Using the RowSetFactory class
2.Java 7 database enhancements:Get auto generated key
3.Controlling the type value of the OUT parameter
4.Get parent logger