private void set(DatasourceConnection dc) { if (dc != null) { datasource = dc.getDatasource(); try { DatabaseMetaData md = dc.getConnection().getMetaData(); md.getDatabaseProductName(); setAdditional(KeyImpl.init("DatabaseName"), md.getDatabaseProductName()); setAdditional(KeyImpl.init("DatabaseVersion"), md.getDatabaseProductVersion()); setAdditional(KeyImpl.init("DriverName"), md.getDriverName()); setAdditional(KeyImpl.init("DriverVersion"), md.getDriverVersion()); // setAdditional("url",md.getURL()); setAdditional(KeyConstants._Datasource, dc.getDatasource().getName()); } catch (SQLException e) { } } }
private static Struct checkTable(DatasourceConnection dc, String tableName, ORMEngine engine) throws PageException { String dbName = dc.getDatasource().getDatabase(); try { DatabaseMetaData md = dc.getConnection().getMetaData(); Struct rows = checkTableFill(md, dbName, tableName); if (rows.size() == 0) { String tableName2 = checkTableValidate(md, dbName, tableName); if (tableName2 != null) rows = checkTableFill(md, dbName, tableName2); } if (rows.size() == 0) { // ORMUtil.printError("there is no table with name ["+tableName+"] defined", engine); return null; } return rows; } catch (SQLException e) { throw Caster.toPageException(e); } }