Not support JDBC getCatalog
See original GitHub issuesharding-jdbc: 4.0.0
@Resource
private DataSource shardingDataSource;
public String generateTableSchema(String tableName) {
Connection connection = null;
try {
connection = shardingDataSource.getConnection();
DatabaseMetaData meta = connection.getMetaData();
ResultSet columns = meta.getColumns(connection.getCatalog(), "%", tableName, "%");
while (columns.next()) {
String columnName = columns.getString("COLUMN_NAME");
String isAutoIncrement = columns.getString("IS_AUTOINCREMENT");
int digits = columns.getInt("DECIMAL_DIGITS");
int dataType = columns.getInt("DATA_TYPE");
String remarks = columns.getString("REMARKS");
String datatype = columns.getString("DATA_TYPE");
String columnsize = columns.getString("COLUMN_SIZE");
String decimaldigits = columns.getString("DECIMAL_DIGITS");
String isNullable = columns.getString("IS_NULLABLE");
//Printing results
System.out.println(columnName + "---" + datatype + "---" + columnsize + "---" + decimaldigits + "---" + isNullable + "---" + isAutoIncrement);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return null;
}
exception:
Caused by: java.sql.SQLFeatureNotSupportedException: getCatalog
at org.apache.shardingsphere.shardingjdbc.jdbc.unsupported.AbstractUnsupportedOperationConnection.getCatalog(AbstractUnsupportedOperationConnection.java:91)
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Not support JDBC getCatalog · Issue #4014 - GitHub
In an abstract Database model, a db instance contains several catalogs, each catalog contains several schema, every schema have many tables/ ...
Read more >getCatalog Method (SQLServerConnection) - JDBC
Returns the current catalog property of the SQLServerConnection object, or null if it is not set. The catalog property is set explicitly ...
Read more >getCatalog() - Raima Documentation
Retrieves this Connection object's current catalog name. The JDBC Driver for Raima Database Manager does not support catalogs, so null is always returned....
Read more >connection.getCatalog() returns null for Oracle - Stack Overflow
jdbc.driver.OracleDriver to connect an Oracle database, connection.getCatalog() returns null. For MySql database, it returns the database name.
Read more >Connection (Java Platform SE 7 ) - Oracle Help Center
SQLFeatureNotSupportedException - if the JDBC driver does not support this method or this method is not supported for the specified result set type,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I am interested in
Maybe we should close this issue until other person interesting about this.