Package org.aksw.commons.util.jdbc
Class JdbcUtils
- java.lang.Object
-
- org.aksw.commons.util.jdbc.JdbcUtils
-
public class JdbcUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description JdbcUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,Relation>fetchColumns(Connection conn)static Map<String,Relation>fetchColumns(Connection conn, String schema, String table)static Map<String,Relation>fetchColumns(DatabaseMetaData meta, String catalog)static Map<String,Relation>fetchColumns(DatabaseMetaData meta, String catalog, String schema, Iterable<String> tables)static Map<String,Relation>fetchColumns(DatabaseMetaData meta, String catalog, String schema, String table)static com.google.common.collect.Multimap<String,ForeignKey>fetchForeignKeys(Connection conn)static com.google.common.collect.Multimap<String,ForeignKey>fetchForeignKeys(DatabaseMetaData meta, String catalog)static com.google.common.collect.Multimap<String,ForeignKey>fetchForeignKeys(DatabaseMetaData meta, String catalog, String schema, Iterable<String> tables)static com.google.common.collect.Multimap<String,ForeignKey>fetchForeignKeys(DatabaseMetaData meta, String catalog, String schema, String table)static com.google.common.collect.Multimap<String,Index>fetchIndexes(DatabaseMetaData meta, String catalog, String schemaName, Iterable<String> tableNames, boolean unique)static com.google.common.collect.Multimap<String,Index>fetchIndexes(DatabaseMetaData meta, String catalog, String schemaName, String tableName, boolean unique)static com.google.common.collect.Multimap<String,Index>fetchIndexesUnsafe(DatabaseMetaData meta, String catalog, String schemaName, String tableName, boolean unique)static Map<String,PrimaryKey>fetchPrimaryKeys(Connection conn)static Map<String,PrimaryKey>fetchPrimaryKeys(DatabaseMetaData meta, String catalog)static Map<String,PrimaryKey>fetchPrimaryKeys(DatabaseMetaData meta, String catalog, String schema, Iterable<String> tables)static Map<String,PrimaryKey>fetchPrimaryKeys(DatabaseMetaData meta, String catalog, String schema, String table)static Set<String>fetchRelationNames(Connection conn)static Set<String>fetchRelationNames(DatabaseMetaData meta, String catalog)For each table retrieve all columns and their foreign key relations Retrieving foreign keys: http://www.java2s.com/Code/Java/Database-SQL-JDBC/GetForeignKeys.htm
-
-
-
Method Detail
-
fetchForeignKeys
public static com.google.common.collect.Multimap<String,ForeignKey> fetchForeignKeys(Connection conn) throws SQLException
- Throws:
SQLException
-
fetchForeignKeys
public static com.google.common.collect.Multimap<String,ForeignKey> fetchForeignKeys(DatabaseMetaData meta, String catalog) throws SQLException
- Throws:
SQLException
-
fetchForeignKeys
public static com.google.common.collect.Multimap<String,ForeignKey> fetchForeignKeys(DatabaseMetaData meta, String catalog, String schema, Iterable<String> tables) throws SQLException
- Throws:
SQLException
-
fetchForeignKeys
public static com.google.common.collect.Multimap<String,ForeignKey> fetchForeignKeys(DatabaseMetaData meta, String catalog, String schema, String table) throws SQLException
- Throws:
SQLException
-
fetchPrimaryKeys
public static Map<String,PrimaryKey> fetchPrimaryKeys(Connection conn) throws SQLException
- Throws:
SQLException
-
fetchPrimaryKeys
public static Map<String,PrimaryKey> fetchPrimaryKeys(DatabaseMetaData meta, String catalog) throws SQLException
- Throws:
SQLException
-
fetchPrimaryKeys
public static Map<String,PrimaryKey> fetchPrimaryKeys(DatabaseMetaData meta, String catalog, String schema, Iterable<String> tables) throws SQLException
- Throws:
SQLException
-
fetchPrimaryKeys
public static Map<String,PrimaryKey> fetchPrimaryKeys(DatabaseMetaData meta, String catalog, String schema, String table) throws SQLException
- Throws:
SQLException
-
fetchRelationNames
public static Set<String> fetchRelationNames(Connection conn) throws SQLException
- Throws:
SQLException
-
fetchRelationNames
public static Set<String> fetchRelationNames(DatabaseMetaData meta, String catalog) throws SQLException
For each table retrieve all columns and their foreign key relations Retrieving foreign keys: http://www.java2s.com/Code/Java/Database-SQL-JDBC/GetForeignKeys.htm- Parameters:
conn-- Throws:
SQLException
-
fetchColumns
public static Map<String,Relation> fetchColumns(Connection conn) throws SQLException
- Throws:
SQLException
-
fetchColumns
public static Map<String,Relation> fetchColumns(Connection conn, String schema, String table) throws SQLException
- Throws:
SQLException
-
fetchColumns
public static Map<String,Relation> fetchColumns(DatabaseMetaData meta, String catalog) throws SQLException
- Throws:
SQLException
-
fetchColumns
public static Map<String,Relation> fetchColumns(DatabaseMetaData meta, String catalog, String schema, Iterable<String> tables) throws SQLException
- Throws:
SQLException
-
fetchColumns
public static Map<String,Relation> fetchColumns(DatabaseMetaData meta, String catalog, String schema, String table) throws SQLException
- Throws:
SQLException
-
fetchIndexes
public static com.google.common.collect.Multimap<String,Index> fetchIndexes(DatabaseMetaData meta, String catalog, String schemaName, Iterable<String> tableNames, boolean unique) throws SQLException
- Throws:
SQLException
-
fetchIndexes
public static com.google.common.collect.Multimap<String,Index> fetchIndexes(DatabaseMetaData meta, String catalog, String schemaName, String tableName, boolean unique) throws SQLException
- Throws:
SQLException
-
fetchIndexesUnsafe
public static com.google.common.collect.Multimap<String,Index> fetchIndexesUnsafe(DatabaseMetaData meta, String catalog, String schemaName, String tableName, boolean unique) throws SQLException
- Throws:
SQLException
-
-