apache db-dbutils

找到DataBaseMetaDataWrapper類的escapeForSearch方法,修改成直接返回其參數。

    /**
     * Escape a string literal so that it can be used as a search pattern.
     * 
     * @param literalString The string to escape.
     * @return A string that can be properly used as a search string.
     * @throws SQLException If an error occurred retrieving the meta data
     */
    public String escapeForSearch(String literalString) throws SQLException
    {
    	return literalString;
    }

public static void main(String[] args) throws SQLException, DdlUtilsXMLException, IOException {
		BasicDataSource dataSource = new BasicDataSource();
		dataSource.setUsername("spring");
		dataSource.setPassword("spring");
		dataSource.setUrl("jdbc:oracle:thin:@192.168.1.148:1521:orcl");
		dataSource.setDriverClassName("oracle.jdbc.driver.OracleDriver");
		
		Platform platform = new Oracle10Platform();
		platform.setDataSource(dataSource);
		
		//一定要指定schema,不然系統表也會被讀出來。
		Database dataBase = platform.readModelFromDatabase("model", null, "SPRING", null);
		
		OutputStream os = new FileOutputStream(new File("c:/model.xml"));
		new DatabaseIO().write(dataBase, os);
		os.close();
	}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章