freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Tom Coleman <tcoleman AT autowares.com>
- To: freetds AT franklin.oit.unc.edu
- Cc: maraya-michael AT dol.gov
- Subject: [jdbc] Catalogs in SQL Server 6.5/7.0/2000
- Date: Wed, 26 Jul 100 10:01:06 -0400 (EDT)
Catalogs in the JDBC scheme of things are pretty fundamental.
The significance of the term "Catalog" can vary with the DB implementation.
Sybase equates the term "Catalog" with 'database'.
You can try the following code as a test:
L
import java.sql.*;
public class Catalogs {
public static void main(String args[]) {
String url =
"jdbc:sybase:Tds:xxx:nnnn/testdb?USE_METATATA=true";
Connection con;
try {
Class.forName("com.sybase.jdbc.SybDriver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
}
try {
con = DriverManager.getConnection(url,
"xxxxxxx", "xxxxxxxx");
DatabaseMetaData dbmd = con.getMetaData();
String dbmsName = dbmd.getDatabaseProductName();
String CatalogTerm = dbmd.getCatalogTerm();
System.out.print("The preferred term for catalogs ");
System.out.println("as used in this database is: " +
CatalogTerm);
ResultSet rs = dbmd.getCatalogs();
System.out.print("The following catalogs are ");
System.out.println("available in " + dbmsName + ":
");
while (rs.next()) {
String catalogName =
rs.getString("TABLE_CAT");
System.out.println(" " + catalogName);
}
rs.close();
con.close();
} catch(SQLException ex) {
System.err.print("SQLException: ");
System.err.println(ex.getMessage());
}
}
}
-
[jdbc] Catalogs in SQL Server 6.5/7.0/2000,
Maraya Michael, 07/25/2000
- <Possible follow-up(s)>
- [jdbc] Catalogs in SQL Server 6.5/7.0/2000, Tom Coleman, 07/26/2000
Archive powered by MHonArc 2.6.24.