question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not support JDBC getCatalog

See original GitHub issue

sharding-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:closed
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
zhaojinchao95commented, Feb 12, 2020

We have no plan to do this. I can label the requirement as volunteer wanted for several days. If someone interesting about it, please reply here.

I am interested in

0reactions
terrymanucommented, Apr 3, 2020

Maybe we should close this issue until other person interesting about this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found