DataImportAPI extends MetadataAPIBase { @RequestMapping(value = "/tables", method = {RequestMethod.GET}) @ResponseBody public RestWrapper getTableList(@RequestParam("common_dbURL") String connectionURL, @RequestParam("common_dbUser") String dbUser, @RequestParam("common_dbPassword") String dbPassword, @RequestParam("common_dbDriver") String driverClass, @RequestParam("common_dbSchema") String dbSchema ) { RestWrapper restWrapper = null; try { Class.forName(driverClass); conn = DriverManager.getConnection(connectionURL, dbUser, dbPassword); if(driverClass.contains("oracle")){ dbSchema = dbSchema.toUpperCase(); } ResultSet result = conn.getMetaData().getTables(null,dbSchema, null, new String[]{"TABLE","VIEW"} ); List<RdbmsEntity> rdbmsEntities = new ArrayList<RdbmsEntity>(); while (result.next()) { RdbmsEntity rdbmsEntity = new RdbmsEntity(); rdbmsEntity.setEntityName(result.getString(3)); LOGGER.debug("table is " + result.getString(3)); rdbmsEntity.setTable(true); String primaryKey = ""; ResultSet primaryKeys = conn.getMetaData().getPrimaryKeys(null, null, result.getString(3)); while (primaryKeys.next()) { primaryKey = primaryKeys.getString(4); LOGGER.debug("primary key is " + primaryKey); } rdbmsEntity.setPrimaryKeyColumn(primaryKey); rdbmsEntities.add(rdbmsEntity); primaryKeys.close(); } restWrapper = new RestWrapper(rdbmsEntities, RestWrapper.OK); result.close(); } catch (Exception e) { LOGGER.error("error occured :" + e); restWrapper = new RestWrapper(e.getMessage(), RestWrapper.ERROR); } return restWrapper; }  @RequestMapping(value = "/createjobs", method = {RequestMethod.POST}) @ResponseBody RestWrapper createJobs(HttpServletRequest request, Principal principal); @RequestMapping(value = "/tables", method = {RequestMethod.GET}) @ResponseBody RestWrapper getTableList(@RequestParam("common_dbURL") String connectionURL,
                             @RequestParam("common_dbUser") String dbUser,
                             @RequestParam("common_dbPassword") String dbPassword,
                             @RequestParam("common_dbDriver") String driverClass,
                             @RequestParam("common_dbSchema") String dbSchema
                             ); @RequestMapping(value = "/tables/{tableName}", method = {RequestMethod.GET}) @ResponseBody List<RdbmsEntity> getColumnsForTable(
            @PathVariable("tableName") String tableName
    ); @Override Object execute(String[] params);  }
@Test @Ignore public void testGetTableList() throws MetaDataAccessException { DataImportAPI dataImportAPI = new DataImportAPI(); RestWrapper restWrapper= dataImportAPI.getTableList("jdbc:oracle:thin:@localhost:1521/xe", "BDREORACLE", "root", "oracle.jdbc.driver.OracleDriver", "BDREORACLE"); LOGGER.debug("restWrapper = " + restWrapper); }