Skip to the content.

better-metadata

Provides wrapper classes and enums for Java’s DatabaseMetadata class.

Usage

Java

// configure your url, username, password...
Connection conn = DriverManager.getConnection(url, user, password);
DatabaseMetaData metadata = conn.getMetaData();

// to use without default catalog and schema filters
Database wrapper = new Database(metadata);

// or set defaults to work with a specific catalog/schema,
// replacing "catalogName" and "schemaName" with values appropriate to your database
Database wrapper = new Database(metadata,"catalogName", "schemaName");

// use wrapper as needed

// Database does no connection management, so you'll need to close it
// when finished
conn.close();

Kotlin

// configure your url, username, password...
val conn = DriverManager.getConnection(url, username, password)
val metadata = conn.metaData
// to use without default catalog and schema filters
val wrapper = new Database(metadata)

// or set defaults to work with a specific catalog/schema,
// replacing "catalogName" and "schemaName" with values appropriate to your database
val wrapper = new Database(metadata,"catalogName", "schemaName")
        
// use wrapper as needed

// Database does no connection management, so you'll need to close it
// when finished
conn.close()

Options

There is a type alias that allow nullable ints for columns such as DECIMAL_DIGITS where the DatabaseMetaData documentation indicates that nulls are returned. See the TypeDefinitions file for details.

Documentation

Java style

Kotlin style