// Update layer metadata
Public static boolean updateLayerMetadataByID (DataSource ds, String id, String xml) throws SQLException, ClassNotFoundException {
Boolean flag = false;
Connection con = null;
Try {
String metadataTableName = DBUtil. getLayerMetadataTableName (ds );
StringBuffer buffer = new StringBuffer ("Update ");
Buffer. append (metadataTableName );
Buffer. append ("set datacol =? Where recordid =? ");
// Buffer. append (id );
// Buffer. append ("'");
Con = DBUtil. getConnection (ds );
Logger.info ("excute SQL:" + buffer. toString ());
OraclePreparedStatement ste = (OraclePreparedStatement) con. prepareStatement (buffer. toString ());
XMLType xmltype = XMLType. createXML (con, xml );
Ste. setObject (1, xmltype );
Ste. setString (2, id );
// Boolean result = false;
// Try {
Ste.exe cute ();
Flag = true;
// _ Log.info ("execute SQL:" + SQL. toString () + "successful .");
//} Finally {
If (ste! = Null ){
Ste. close ();
Ste = null;
}
//}
} Catch (ClassNotFoundException e ){
Flag = false;
Throw new ClassNotFoundException (e. getMessage ());
} Catch (SQLException e ){
Flag = false;
Throw new SQLException (e );
} Finally {
Try {
DBUtil. closeConnection (con );
}
Catch (SQLException e ){
Flag = false;
Throw new SQLException (e );
};
}
Return flag;
};
Please indicate the source for reprinting. Please contact us! Http://www.cnblogs.com/likehua