On 08 Feb 2013 15:36, James H. H. Lampert wrote:
Two things, really.

First of all, can anybody direct me to any examples or tutorials on
how to find out what a file's primary key is, via JDBC?


A ResultSet from the method getPrimaryKeys(String catalog, String schema, String table) which "Retrieves a description of the given table's primary key columns." As defined by interface DatabaseMetaData.

"... Connection conn = ...
ResultSet rs = null;
DatabaseMetaData meta = conn.getMetaData();
// ... if you pass a table name in lowercase characters, it will not work. ...
rs = meta.getPrimaryKeys(null, null, "survey");

And second, my understanding is that the SQL spec states that if you
don't specify anything about record sequencing in an SQL SELECT,
there is no guarantee that the result set will have the records in a
predictable sequence: is that correct?

Correct. Without an ORDER BY clause the collation of rows in a set are undefined and thus the order is unpredictable.

An attribute of the connection should be available for Sort Sequence (SRTSEQ) so that the collation is defined as desired for when an ORDER BY is specified.

This thread ...

Return to Archive home page | Return to MIDRANGE.COM home page