Java Code Examples for java.sql.DatabaseMetaData#isCatalogAtStart()

The following examples show how to use java.sql.DatabaseMetaData#isCatalogAtStart() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GetDatabaseInfoTests.java    From sqlhelper with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * catalog.schema.table
 *
 * @param dbMetaData
 * @throws SQLException
 */
void showCatalogs(DatabaseMetaData dbMetaData) throws SQLException {
    ResultSet catalogRs = dbMetaData.getCatalogs();
    List<String> catalogs = Collects.emptyArrayList();
    while (catalogRs.next()) {
        String catalog = catalogRs.getString("TABLE_CAT");
        catalogs.add(catalog);
    }

    String catalogSeparator = dbMetaData.getCatalogSeparator();
    String catalogTerm = dbMetaData.getCatalogTerm();
    boolean catalogAtStart = dbMetaData.isCatalogAtStart();
    int maxCatalogLength = dbMetaData.getMaxCatalogNameLength();

    System.out.println("maxCatalogNameLength: " + maxCatalogLength);
    System.out.println("catalogSeparator: " + catalogSeparator); // .
    System.out.println("catalogTerm: " + catalogTerm); //catalog
    System.out.println("catalogs: " + catalogs.toString());
    System.out.println("catalog at start ? :" + catalogAtStart);
}
 
Example 2
Source File: QualifiedObjectNameFormatterStandardImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public QualifiedObjectNameFormatterStandardImpl(
		NameQualifierSupport nameQualifierSupport,
		DatabaseMetaData databaseMetaData) throws SQLException {
	this(
			nameQualifierSupport,
			databaseMetaData.getCatalogSeparator(),
			!databaseMetaData.isCatalogAtStart()
	);
}