jdbcを使用してteradataからメタデータフェッチを実行していますが、すべてのデータ型を取得したいと考えています。しかし、DECIMAL(10,4)を含むDBフィールドの場合、精度を得ることができません。コードスニペットを添付しています。提案は大歓迎です!JDBCメタデータフェッチ10進精度
DatabaseMetaData md = con.getMetaData();
ResultSet tbls = md.getTables(null, schema, name, null);
if(false == tbls.next()){
nonExistingRdbmsTables.add(name);
LOGGER.error("Table with name {} in schema {} does not exists in source database", name, schema);
continue;
}
RdbmsTableMetadata tableMD = new RdbmsTableMetadata();
List<String> pkList = new ArrayList();
ResultSet primaryKeys = md.getPrimaryKeys(null, schema, name);
while(primaryKeys.next()){
String pk = primaryKeys.getString("COLUMN_NAME");
pkList.add(pk);
}
tableMD.setPkList(pkList);
LOGGER.info("*****Primary key list for table {} is {}", name, pkList);
tableMD.setSchema(schema);
tableMD.setName(name);
tableMD.setTargetName(targetName);
tableMD.setTargetSchema(targetSchema);
List<Column> colList = new ArrayList<>();
ResultSet cols = md.getColumns(null, schema, name, null);
while (cols.next()) {
String columnName = cols.getString("COLUMN_NAME");
String columnType = cols.getString("TYPE_NAME");
String columnLength = cols.getString("COLUMN_SIZE");
}
jdbcメタデータから精度の詳細を問い合せる方法はありますか?
どのDBMSを使用していますか?また、 'cols.getInt(" DECIMAL_DIGITS ")'はあなたに何を提供しますか? –
'COLUMN_SIZE'と' DECIMAL_DIGITS'にはどんな価値がありますか? –
DECIMAL_DIGITSは正常に機能します。みんなありがとう!これは私の情報スキーマをよく知らないために得られるものです! – Ayon