You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/01/18 05:19:46 UTC
[GitHub] [incubator-shardingsphere] shalousun opened a new issue #4014: Not
support JDBC getCatalog
shalousun opened a new issue #4014: Not support JDBC getCatalog
URL: https://github.com/apache/incubator-shardingsphere/issues/4014
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)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] zjcnb edited a comment on issue #4014:
Not support JDBC getCatalog
Posted by GitBox <gi...@apache.org>.
zjcnb edited a comment on issue #4014: Not support JDBC getCatalog
URL: https://github.com/apache/incubator-shardingsphere/issues/4014#issuecomment-585164417
> 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
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] kimmking commented on issue #4014: Not
support JDBC getCatalog
Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #4014: Not support JDBC getCatalog
URL: https://github.com/apache/incubator-shardingsphere/issues/4014#issuecomment-575965787
@shalousun Actually, mysql&oracle doesn’t support catalog.
In a abstract Database model, a db instance contains several catalogs, each catalog contains several schema, every schema have many tables/views and other objects.Then we used to use Database in a specified case instead of the two concepts: catalog&schema. In mysql jdbc driver, the method connection.getCatalog will return databaseName string.
We can use null or databaseName(mysql)/userName(oracle) instead of catalog in many methods like your above codes.
Further more, sharding jdbc/proxy can wrap and route a logic database to more than one database, so we can't decide which db name should be returned to caller. So, then you will know as a result, sharding jdbc/proxy can't support the feature till now.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] kimmking commented on issue #4014: Not
support JDBC getCatalog
Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #4014: Not support JDBC getCatalog
URL: https://github.com/apache/incubator-shardingsphere/issues/4014#issuecomment-585288850
> > 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
Logic schema can be as the result of getSchema()/getCatalog() method in mysql,
But pg&oracle, it's different.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] ssxlulu commented on issue #4014: Not
support JDBC getCatalog
Posted by GitBox <gi...@apache.org>.
ssxlulu commented on issue #4014: Not support JDBC getCatalog
URL: https://github.com/apache/incubator-shardingsphere/issues/4014#issuecomment-575956699
Yes, we haven't support the feature now.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] terrymanu commented on issue #4014: Not
support JDBC getCatalog
Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #4014: Not support JDBC getCatalog
URL: https://github.com/apache/incubator-shardingsphere/issues/4014#issuecomment-576515529
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.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] kimmking edited a comment on issue
#4014: Not support JDBC getCatalog
Posted by GitBox <gi...@apache.org>.
kimmking edited a comment on issue #4014: Not support JDBC getCatalog
URL: https://github.com/apache/incubator-shardingsphere/issues/4014#issuecomment-575965787
@shalousun Actually, mysql&oracle doesn’t support catalog.
In an abstract Database model, a db instance contains several catalogs, each catalog contains several schema, every schema have many tables/views and other objects.Then we used to use Database in a specified case instead of the two concepts: catalog&schema. In mysql jdbc driver, the method connection.getCatalog will return databaseName string.
We can use null or databaseName(mysql)/userName(oracle) instead of catalog in many methods like your above codes.
Further more, sharding jdbc/proxy can wrap and route a logic database to more than one database, so we can't decide which db name should be returned to caller. So, then you will know as a result, sharding jdbc/proxy can't support the feature till now.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] terrymanu commented on issue #4014: Not
support JDBC getCatalog
Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #4014: Not support JDBC getCatalog
URL: https://github.com/apache/incubator-shardingsphere/issues/4014#issuecomment-608368890
Maybe we should close this issue until other person interesting about this.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] kimmking commented on issue #4014: Not
support JDBC getCatalog
Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #4014: Not support JDBC getCatalog
URL: https://github.com/apache/incubator-shardingsphere/issues/4014#issuecomment-596381063
@zjcnb Anything forward or problems ?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] zjcnb commented on issue #4014: Not
support JDBC getCatalog
Posted by GitBox <gi...@apache.org>.
zjcnb commented on issue #4014: Not support JDBC getCatalog
URL: https://github.com/apache/incubator-shardingsphere/issues/4014#issuecomment-585164417
> 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
> 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
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] terrymanu closed issue #4014: Not
support JDBC getCatalog
Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #4014: Not support JDBC getCatalog
URL: https://github.com/apache/incubator-shardingsphere/issues/4014
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] kimmking commented on issue #4014: Not
support JDBC getCatalog
Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #4014: Not support JDBC getCatalog
URL: https://github.com/apache/incubator-shardingsphere/issues/4014#issuecomment-576718695
Another method `getSchema()` is the same.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services