DatabaseMetaData.getIndexInfo()

Hi,
I am trying to read the schema from 9i server using DatabaseMetaData. When the method getIndexInfo is been used, it returns Type "tableIndexStatistic". How can i get the particular column name when the type is tableIndexStatistic ?.
Biju.

I have the same problem when using DatabaseMetaData.getColumns.
When I call that method on several tables I get "java.sql.SQLException: ORA-01031: insufficient privileges" and eventually "java.sql.SQLException: ORA-01000: maximum open cursors exceeded".
How can I know in advanced using JDBC for which tables I can get the metadata?
Thanks.

Similar Messages

  • Call driver methods DatabaseMetaData#getIndexInfo()

    Hi
    got errors when I call driver methods DatabaseMetaData#getIndexInfo(), getExportedKeys(), getImportedKeys, getTypes(), etc Says something that tables like sysodbctypes, sysodbcindexes, sysodbcforeignkeys are missing.
    Any advice?
    Thanks

    Hello,
    Which transaction/report are you facing this issue?
    Regards,
    Eduardo Rezende

  • GetIndexInfo on Oracle

    I tried to use the DatabaseMetaData.getIndexInfo() method on an oracle database. First when I tried to use this from a user which only had access to read the database I get an SQLException:ORA 01031: insufficient privileges. When I tried it from the user that owned the table it took a very long time, the table has about a million rows. Our DBA said it was analysing the table. It eventually finished and provided the expected result. Rerunning it caused another analyse to be run.
    Does anyone know how to prevent the analyse from running. I tried reading all_ind_columns and that works fine, I'd hoped to use getIndexInfo as all_ind_columns is Oracle specific.
    The only reference I found on Google for this problem was Hibernate Schema Update - getIndexInfo having the same problem as my code. The recommendations to set Create Index and Alter Table permissions are unacceptable in this application and that doesn't fix the poor performance.
    Thanks, there are D$s to go around.

    Have you tried using
         try {
            rs1=DMD.getPrimaryKeys(null,null,tbl);                    // CAUTION: in SAPDB, a key can be defined as UNIQUE or PRIMARY KEY in the CREATE statement
            while (rs1.next()) PrimaryKeys.add(rs1.getString(4));
         } catch (Throwable t1) {                              // probably doesn't support it (e.g., MS-Access) or no Primary Key is defined (e.g., SAPDB)
            System.out.println("DatabaseMetaData.getPrimaryKeys() not supported?");
         }where DMD is your DatabaseMetaData!
    ;o)
    V.V.

  • Schematool createDB can't generate the ddl

    Hi,
    I am trying to run the schematool to generate the ddl to re-create the
    current DB - according to the doc, I should run :
    schematool -a createDB -f sql.txt
    However, when I run it (after put some CLASSPATH setting before the java
    execute), it gives me following exception (Note: the first line is the
    output of "echo $CLASSPATH"):
    [tyang@zetus UMA]$ ./schematool -a createDB -f tmp.ddl
    /usr/java/jsdk/ext/JMF-2.1.1e/lib/jmf.jar:/usr/java/jsdk/ext/JMF-2.1.1e/lib/sound.jar:.:lib/commons-beanutils.jar:lib/commons-collections.jar:lib/commons-dbcp.jar:lib/commons-digester.jar:lib/commons-lang.jar:lib/commons-logging.jar:lib/commons-pool.jar:lib/cwlicense.jar:lib/db2java.jar:lib/db2j.jar:lib/jakarta-regexp.jar:lib/jaxen-full.jar:lib/jca1.0.jar:lib/jcommon-0.8.8.jar:lib/jdo-1.0.1.jar:lib/jdom.jar:lib/jfreechart-0.9.13.jar:lib/jndi.jar:lib/jta-spec1_0_1.jar:lib/kodo-jdo.jar:lib/kodo-jdo-runtime.jar:lib/license.jar:lib/log4j-1.2.8.jar:lib/msbase.jar:lib/mssqlserver.jar:lib/msutil.jar:lib/ojdbc14.jar:lib/pg72jdbc2.jar:lib/saxpath.jar:lib/servlet.jar:lib/sqlline.jar:lib/tjdo.jar:lib/xalan.jar:lib/xercesImpl.jar:lib/xml-apis.jar:build/classes:build/jdometa-dtd
    Exception in thread "main" java.lang.NullPointerException
    at org.postgresql.jdbc2.ResultSet.getBytes(ResultSet.java:321)
    at
    org.postgresql.jdbc2.DatabaseMetaData.getIndexInfo(DatabaseMetaData.java:2942)
    at
    com.solarmetric.jdbc.DelegatingDatabaseMetaData.getIndexInfo(DelegatingDatabaseMetaData.java:253)
    at
    com.solarmetric.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingDatabaseMetaData.getIndexInfo(LoggingConnectionDecorator.java:321)
    at
    com.solarmetric.jdbc.DelegatingDatabaseMetaData.getIndexInfo(DelegatingDatabaseMetaData.java:253)
    at kodo.jdbc.sql.DBDictionary.getIndexInfo(DBDictionary.java:2921)
    at
    kodo.jdbc.schema.SchemaGenerator.generateIndexes(SchemaGenerator.java:568)
    at
    kodo.jdbc.schema.SchemaGenerator.generateIndexes(SchemaGenerator.java:577)
    at
    kodo.jdbc.schema.SchemaGenerator.generateIndexes(SchemaGenerator.java:357)
    at
    kodo.jdbc.schema.SchemaGenerator.generateSchemas(SchemaGenerator.java:188)
    at
    kodo.jdbc.schema.SchemaGenerator.generateSchemas(SchemaGenerator.java:168)
    at
    kodo.jdbc.schema.SchemaTool.getDBSchemaGroup(SchemaTool.java:1062)
    at kodo.jdbc.schema.SchemaTool.createDB(SchemaTool.java:293)
    at kodo.jdbc.schema.SchemaTool.run(SchemaTool.java:1383)
    at kodo.jdbc.schema.SchemaTool.run(SchemaTool.java:1317)
    at kodo.jdbc.schema.SchemaTool.main(SchemaTool.java:1267)
    Any clue ?
    Thanks,
    Tao

    It does appear to be a driver bug, and it looks like it is fixed in
    recent versions of the Postgres JDBC driver. See:
    http://archives.postgresql.org/pgsql-jdbc/2002-02/msg00179.php
    In article <brsrnl$4q0$[email protected]>, Abe White wrote:
    >
    Exception in thread "main" java.lang.NullPointerException
    at org.postgresql.jdbc2.ResultSet.getBytes(ResultSet.java:321)
    at
    org.postgresql.jdbc2.DatabaseMetaData.getIndexInfo(DatabaseMetaData.java:2942)
    As you can see, this is a postgres error, so it's difficult to know what
    is going on. Are you using Postgre's own 7.2 driver?--
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • Somebody knows  "java.sql.DatabaseMetaData"  ??

    Hello !!
    I'm implementing the java.sql.DatabaseMetaData interface and I need to know if somebody already used it ...
    Here's my question: there's a method called "getIndexInfo(parameters)" ...
        DriverManager.registerDriver( new com.progress.sql.jdbc.JdbcProgressDriver() );
        Connection       con     = DriverManager.getConnection (parameters);
        DatabaseMetaData dbmd    = con.getMetaData();
        ResultSet        rsIndex = dbmd.getIndexInfo( null, db_schema, table_name, false, false );This method gets a description of a table's indices and statistics ( J2SE v1.3.1 ) ... One of the statistics that I can get is the TYPE (index type). I want to know what's the difference between them :
    tableIndexStatistic <<
    tableIndexClustered <<
    tableIndexHashed <<
    tableIndexOther <<
    Somebody can help me ??

    I want to know what's the difference
    between them :
    tableIndexStatistic <<
    tableIndexClustered <<
    tableIndexHashed <<
    tableIndexOther <<
    Somebody can help me ??What do you mean "the difference"? They are different ways of indexing a table. A general book on Oracle should cover the first three, a book on SQL Server might as well (and will definitely cover some.)

  • Oracle JDBC Driver 10.2.0.1.0 DataBaseMetaData Incorrect For Unary FKs

    Friends,
    My firm (which is not a MetaLink subscriber) has discovered a bug in the Oracle 10g JDBC Driver (10.2.0.1.0). The bug affects unary associations, namely cases in which the foreign key of a table points to that very table's primary key.
    In such cases, method DatabaseMetaData.getExportedKeys (which is designed to return all foreign keys that reference a specified table) fails to return the foreign key reference. The method works correctly as long as the foreign key "points to" a different table. Example:
    ResultSet lResultSetForeignKeys = aDatabaseMetaData.getExportedKeys(<foo>)
    while (lResultSetForeignKeys.next())
    // NOTHING RETURNED
    In this case, the ResultSet contains no elements.
    We discovered this problem testing the same logic against a cross-section of commercial databases. All other DBMS drivers produce the correct result except for the Oracle drivers.
    If some brave soul would convert this into a MetaLink TAR we'd sure appreaciate it, and if possible we'd love to be in the loop regarding the progress on this issue. My e-mail ID is [email protected], and I'm working on behalf of Corticon Technologies, Inc.
    Sincerely,
    David Lynch
    General Manager, SOTA

    My understanding is that to be a MetaLink subscriber you have to be an Oracle customer or subscribe for Oracle support services. Since Oracle is only one of the many databases we support, and because our sole objective with Oracle is compatibility testing, it's unlikely that we will become subscribers unless it's essentially free.
    Oracle is tangential (not core) to our own offerings, so we don't have a pressing need for support. Is there some avenue for people in our shoes?

  • DatabaseMetadata.getProcedure - MS SQL REMARK location?

    Hey all,
    Using the DatabaseMetaData.getProcedures() method to retrieve sprocs. I would like very much to use the procedure REMARK column, but I do not understand where to place this information in MS SQL 2005 for each sproc. Does anyone know please?
    I saw some documentation in DB2 for a comment field, which I assume would return in the procedure REMARK field. If someone could verify DB2 location, as well as any other databases (Oracle, MySQL, Postgres, etc). MS SQL 2005 is my primary focus however.
    edit: prefer to use JTDS (1.2.2 or higher), but if can also/only be accomplished with SQLJDBC.jar, please identify.
    Edited by: binarymonk_01 on Jul 9, 2008 6:16 AM

    Also If I change to NAT from the public IP to the NLB IP to use either one of the phsyical IPs of the NLB cluster (192.168.0.50 or 51) it works fine when using the public IP.  So it's definatly an issue when NATing the VIP of NLB cluster.
    Chris

  • DatabaseMetaData.getProcedureColumns not returning correct type

    Here's the situation.
    I have an object type.
    CREATE TYPE ttest AS OBJECT (
    elem1 VARCHAR2(1),
    elem2 NUMBER(20),
    I have an Table Type of the Object Type.
    CREATE TYPE tabtest AS TABLE of ttest;
    I'm using the Table Type as input to a package function.
    function test (arrTabTest IN tabtest) return number;
    When using the DatabaseMetaData, the getProcedureColumns tells me that the parameter is of type "TABLE".
    How do I determine what the real Table Type is (ie. "tabtest")?
    Thanks
    Gary R. Kline
    Chief Technology Architect
    BVN Solutions, Inc.

    Hi Justin, thank you for responding.
    for both the ODBC and oo4o example I am using the SQL statement below:
    varSQL = "SELECT * FROM food"
    The food table has two filed, a main of type varchar2 and a quantity of type number.
    Both the main and the quantity are coming back to my ASP application as string type.
    Thank You for the help.
    Samir

  • Getting AUTO_INCREMENT info from DatabaseMetaData

    Hi all,
    I am experimenting with DatabaseMetaData on a MySQL database. Does anyone know how to get the information that a column of a table is autoincremented.
    The DatabaseMetaData.getColumns(...) method does not seem to return this info.
    Suppose a table created by
    CREATE TABLE book
    (book_id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY,
    title VARCHAR(255))
    The DatabaseMetaData returns all information of this table except that book_id is AUTO_INCREMENT.
    Or am I missing something?
    cu
    Achim

    You can use what the DatabaseMetaData.getColumns(...) return. Because the method DatabaseMetaData.getColumns(...) return a ResultSet object.
    From the ResultSet you can know if the colunm is autoincrement or not.
    Use the ResultSet.getMetaData() method that return a ResultSetMetaData object, then use the ResultSetMetaData.isAutoIncrement(int column) method that Indicates whether the column is automatically numbered.Good luck

  • DatabaseMetaData.getAttributes throwing 'unsupported feature' exception

    Hi, maybe someone can help me with this.
    For a given schema, I'm trying to find the definition of a user-defined type. However, the getAttributes method of DatabaseMetaData throws an exception, claiming that the feature is unsupported.
    This is the code:
    Connection connection = null; ResultSet resultSet = null; try { connection = DriverManager.getConnection( URL, USERNAME, PASSWORD ); DatabaseMetaData dbMD = connection.getMetaData(); System.out.printf( "%s %d.%d%n", dbMD.getDatabaseProductName(), dbMD.getDatabaseMajorVersion(), dbMD.getDatabaseMinorVersion() ); resultSet = dbMD.getAttributes( null, null, "BATCH_T", "%" ); // this is line 32 // code to print the ResultSet } finally { if( resultSet != null ) resultSet.close(); if( connection != null ) connection.close(); }
    And this is the output:
    Oracle 10.2 Exception in thread "main" java.sql.SQLException: Unsupported feature         at oracle.jdbc.OracleDatabaseMetaData.getAttributes(OracleDatabaseMetaData.java:10980)         at udttest.Main.main(Main.java:32)
    The driver is the very latest one from the Oracle site, ojdbc6.jar, version 11.2.0.2.0. According to the JavaDocs of OracleDatabaseMetaData, the getAttributes method has been there since 9.0.2. So does this means that the method has merely been present, and always throws this exception?
    Alternatively, is there another way of programmatically retrieve information about a user-defined type?
    Thanks,
    - Peter

    Severity One wrote:
    jschell wrote:
    Severity One wrote:
    Yes, but the question was not how PL/SQL could know about how a Java object looks like, but how Java can know how a PL/SQL object looks like.You said the following.
    +"One issue we have at work is to pass to or receive from a PL/SQL stored procedure a Java object."+
    What I read from that is that you wish to get/send a "java object" to PL/SQL.
    Thus PL/SQL would in fact need to know what a "java object" is.No, you forgot to read the context: I wanted to know how Java could figure out how an Oracle user-defined type looked like, not the other way around. This business of "PL/SQL knowing about a Java object" is something you invented, that you keep harking on, and which I never said. So could you please drop it?
    I read what you posted, not your mind.
    Well, I could think of having the business logic for an application in PL/SQL, and using Java to create an API or web > > > Specifically, it's about an SMS sending application, which is interacting with just one table in Oracle and an SMS-C. Want to send an SMS? Insert it into the table. Want to receive one? Read it from the table. Any application that wants to send any number of SMS's, would therefore interact with this database, and a lot of things can be done purely in Oracle, without the need of having a separate application requiring the attention of support staff.Which I can implement completely and easily without using PL/SQL user defined types.Really? There are a lot of optional parameters when sending an SMS. It's not just sender, recipient and text content. So if I want to send, say an identical message to 10,000 recipients, or I want to send 10,000 individual messages; in both cases, with certain parameters for such things like time-outs, SMS-C port, protocol ID, data coding, delivery report options, priority, and all the other things that SMPP allows you to define, how would you pass those in a manner that doesn't lead to dozens of stored procedures, or very long parameter lists?
    Standard normal form in relational databases - an option table.
    And I doubt a valid format for delivery would work with 10,000 recipients stored in a single UDF verus a receiptant table.
    Not to mention of course that the fact that there might be one case for a UDF doesn't mean that the usage is a good idea for most applications. Or even that one application that uses a single UDF will need more than one of them.
    Restating what I said "...doesn't mean that it *normally* a good idea to use it."
    To clarify your confusion about that statement it means that there will in fact be some cases where it is acceptable but most cases it is not.
    Or do you prefer calling stored procedures with endless parameter lists? Or to have a whole bunch of insert and update statements called from Java?No idea what you are talking about. See the above example about sending SMS messages.
    Option table.
    First what you mention above is a standard idiom in all programming languages and used extensively since interactions between programming languages and relational database began.What, whole loads of stored procedures, or doing all the updates and inserts from Java? We've come to the conclusion that the inability to validate an SQL statement in Java source code is a bugger, and that it's better to do this sort of thing in a stored procedure. Also, using arrays means a significant performance improvement, and an array of objects/user-defined types is the next thing that comes to mind.
    That will not be a consideration in most applications. And for those applications where there is a proven performance bottleneck at the database layer most applications would be better served with one or more of the following
    1. Redoing the architecture/design
    2. Using a caching mechanism.
    3. Even look at redoing the requirements.
    Secondly I have no idea what you mean by "endles parameter lists". I do not have that problem. If you do then I can only suggest that you should look at problems with your design rather than than attempting to solve it with your implementation.If you have a lot of parameters, like with sending SMS messages, some of which are optional whilst others are not, and when many of these parameters are identical between different insert statements, you have two options:
    * use very long parameter lists.
    * use user-defined types; for example, an array with 'recipient + messages' types, and a single 'all other options' type.
    Or an option table.
    Perhaps not, but I didn't take off at a tangent. Anyway, one way of preventing binding is by having one of the frameworks figure out on its own what the other is doing. The whole reflection and annotation thing in Java lets you do that. Unfortunately, the getAttributes() method does not.
    First as you yourself noted it is irrelevant.No, that's something you claimed. When you ask for an example, don't brush them off as being irrelevant.
    My mistake then.
    Second dynamic interface code is NOT a mechanism that reduces coupling. The fact that it is dynamic does not alter the dependency.It reduced coupling between source code, which is what it's all about. I can always fix a library; it's a lot easier than changing dozens of applications.
    No it doesn't. Coupling is coupling. The manner of calling the methods doesn't alter the semantics that require that the method is called in the first place.
    That is similar to claiming that something like perl/javascript is less "coupled" because the language is interpreted versus C++ where the method calls are compiled. Which of course is not true.
    I can store data in a database, any database, in any number of ways. None of which would require a Oracle user defined type.True, but I'm using Oracle for more than just storing data. PL/SQL is extremely powerful for certain operations, and it'd be silly not to employ that power.Which has nothing to do with what I said.Quite frankly, I'm at a loss what point exactly you're trying to make. Passing data between Java and Oracle user-defined types and arrays is a total pain, so as a programmer I'm trying to find a way to do this in a standard way, something that can be put in a library. I agree that it a complex issue.
    It however is not something that most applications need however since most do not need UDFs.
    And so I have written such a library: small, database-agnostic (should work with any JDBC data source, although I haven't tested it yet), but with annotations to mark what UDT a class maps to, and to what field within the UDT each field of the class maps to. It's the annotation bit I was wondering whether it could be avoided. Obviously, because Oracle doesn't support the getAttributes method, it would no longer be database-agnostic. Which is not really a problem, because we only use Oracle, unless a vendor supports only some other database.
    Not sure what that means since most other databases do not support UDFs.
    That fact that a feature exists is not by itself a reason to use it. Java has 'strictfp' but I have never had a single business need that required that I use it. As such if I saw someone attempting to use it or stating that it must be used then I would insist that the provide specific details driven from the business needs that required its usage.The fact that you cannot think of a use or a business need, does not mean one does not exist. I suggest you re-read my first post, since that is not what I said.

  • HOw to get  DatabaseMetaData using JPA

    hi;
    I am using ejb3 , jpa for database connectivity .is there any way to get the metadata about the database in JPA.
    ie:- in JDBC we can use DatabaseMetaData for getting this. HOw can we get the Database Meta Data by using JPA.
    Regards
    Irshad

    In addition to Gurvinder references, go over the productCatalog.xml or customCatalog.xml file to know the properties in each item-descriptor of ProductCatalog.
    In your requirement skuid is same as repositoryId.
    If you are using in jsp then use SKULookUp droplet to get the sku repositoryItem.
    If you need it in java code then use catalogTools.findSKU(String skuid).
    Peace
    Shaik

  • Create table statement from DatabaseMetaData

    Hi Experts,
    Do you know if it's possible to retrieve a create table statement based on a DatabaseMetaData ? (without looping through columnName / Type)
    The idea is to get the DatabaseMetaData from one db server, and execute the Create Table statements on a different db server.
    One obvious solution would be to loop through each table's column name/type and construct the create table statement manually, but I'd like to know whether this can be automated.
    Thanks in advnace,
    Sid

    Bigger databases provide a way to access most schema information from the database itself. That doesn't mean that the jdbc meta information is sufficient nor the best way to do that.
    There are existing tools that allow for migrations as well. Especially if the migration is a one to one mapping.

  • DatabaseMetaData.getTypeInfo ()=NULL when use JDBC Driver 9.2.0.5

    Why DatabaseMetaData.getTypeInfo () is NULL when use JDBC Driver 9.2.0.5 to connect Oracle 9.0.1.1.1 database?
    In the following links
    http://www.oracle.com/technology/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm#02_02
    the segment "Which JDBC drivers support which versions of Oracle Database?" tells us that JDBC Driver 9.2.0.5 can support Oracle 9.0.1.1.1 database.
    thanks!

    ERROR --- java.sql.SQLException: ORA-01722: &#26080;&#25928;&#25968;&#23383;

  • Problem with DatabaseMetaData.getCrossReference()

    Hi, All,
    I got a problem with DatabaseMetaData.getCrossReference(...). Let me simplify it to the following senario:
    I have two tables in RDBMS: table A with colums A1, A2, A3, A4 and table B with columns B1, B2. Table B has a composite primary key (B1, B2). And I have two references:
    1. (A1, A4) references (B1, B2)
    2. (A3, A2) references (B1, B2)
    In this cases, it seems to me that there is no way in JDBC to detect these relations. All the api's of getCrossReference(), getImportedKeys() and getExportedKeys() are not working!!!
    I appreciate your help!
    Thanks
    Tao
    2003/06/19

    Could somebody help me out?
    Thanks in advance!
    Tao

  • Querying character column sizes using DatabaseMetadata

    Hi,
    In a UTF-8 database, I've created two testing tables, one that uses byte length semantics (BLS) for its CHAR and VARCHAR2 columns, and one using character length semantics (CLS). If I use the standard JDBC DatabaseMetdata.getColumns() query, the size of the CLS columns is reported as 4 times that of the BLS columns. I don't believe this is the desired behaviour for the JDBC drivers.
    Regardless, does anyone know a way to accurately determine (preferably using standard JDBC methods) the size of a CHAR or VARCHAR column in characters across different database configurations? I need this to compare column lengths in a ASCII and UTF8 database.
    I'm using the standalone JDBC drivers v9.2.0.3 for JDK1.4 (odjbc.jar) running aginst Oracle 9.2.0.0.
    The following code, which contains some DDL to create sample tables, can be used to dump the column metadata returned by Oracle's database drivers.
    import java.sql.*;
    import java.util.*;
    The following script can be used to create two test tables, the first with
    byte-size columns, and the second with character-size columns.
    CREATE TABLE TMP
    TMP_ID NUMBER(12) NOT NULL PRIMARY KEY,
    TMP_CHAR CHAR(200 BYTE),
    TMP_VCHAR VARCHAR2(100 BYTE)
    CREATE TABLE TMP2
    TMP_ID NUMBER(12) NOT NULL PRIMARY KEY,
    TMP_CHAR CHAR(200 CHAR),
    TMP_VCHAR VARCHAR2(100 CHAR)
    public class DatabaseMetadata
    private static final String COLUMN_NAMES[] = {
    "TABLE_CAT",
    "TABLE_SCHEM",
    "TABLE_NAME",
    "COLUMN_NAME",
    "DATA_TYPE",
    "TYPE_NAME",
    "COLUMN_SIZE",
    "BUFFER_LENGTH",
    "DECIMAL_DIGITS",
    "NUM_PREC_RADIX",
    "NULLABLE",
    "REMARKS",
    "COLUMN_DEF",
    "SQL_DATA_TYPE",
    "SQL_DATETIME_SUB",
    "CHAR_OCTET_LENGTH",
    "ORDINAL_POSITION",
    "IS_NULLABLE"
    private static final int COLUMN_WIDTHS[] = {
    10, // "TABLE_CAT",
    11, // "TABLE_SCHEM",
    10, // "TABLE_NAME",
    11, // "COLUMN_NAME",
    10, // "DATA_TYPE",
    10, // "TYPE_NAME",
    11, // "COLUMN_SIZE",
    13, // "BUFFER_LENGTH",
    13, // "DECIMAL_DIGITS",
    13, // "NUM_PREC_RADIX",
    10, // "NULLABLE",
    10, // "REMARKS",
    10, // "COLUMN_DEF",
    10, // "SQL_DATA_TYPE",
    10, // "SQL_DATETIME_SUB",
    10, // "CHAR_OCTET_LENGTH",
    10, // "ORDINAL_POSITION",
    10, // "IS_NULLABLE"
    private static final char WHITESPACE[] =
    .toCharArray();
    private static final String HYPHENS =
    private static String formatRow(String row[])
    StringBuffer buffer = new StringBuffer(128);
    for (int j=0;j<row.length;j++)
    if (j > 0)
    buffer.append(" | ");
    String text = row[j];
    int width = COLUMN_WIDTHS[j];
    if (text == null)
    buffer.append(WHITESPACE, 0, width);
    else if (text.length() > width)
    buffer.append(text.substring(0, width));
    else
    buffer.append(text).append(WHITESPACE, 0, width - text.length());
    } // j
    return buffer.toString();
    } // private static String formatRow(String[])
    private static void printColumnMetadata(
    DatabaseMetaData metadata, String tableName)
    throws SQLException
    System.out.println("\n" + tableName + "\n");
    System.out.println(formatRow(COLUMN_NAMES));
    String hyphens[] = new String[18];
    Arrays.fill(hyphens, HYPHENS);
    System.out.println(formatRow(hyphens));
    ResultSet results = metadata.getColumns(null, null, tableName, "%");
    String columnMetadata[] = new String[18];
    while (results.next())
    for (int i=0;i<18;i++)
    Object result = results.getObject(i+1);
    columnMetadata[i] = result == null ? "NULL" : result.toString();
    } // i
    System.out.println(formatRow(columnMetadata));
    results.close();
    } // private static void printColumnMetadata(DatabaseMetaData, String)
    public static void main(String argv[])
    throws Exception
    Driver driver = (Driver)Class.forName(
    "oracle.jdbc.driver.OracleDriver").newInstance();
    DriverManager.registerDriver(driver);
    Connection connection = DriverManager.getConnection(
    argv[0], argv[1], argv[2]);
    // ((oracle.jdbc.OracleConnection)connection).setRemarksReporting(true);
    try
    DatabaseMetaData metadata = connection.getMetaData();
    printColumnMetadata(metadata, "TMP");
    printColumnMetadata(metadata, "TMP2");
    catch (SQLException e)
    e.printStackTrace();
    connection.close();
    } // public class DatabaseMetadata

    It appears that this forum uses "[" "i" "]" to denote italics internally, so these characters are missing where the code sample becomes italic, between 'columnMetadata' and '='.

Maybe you are looking for