// Insert layer metadata
Public static boolean insertLayerMetadata (DataSource ds, String xml, String id) throws SQLException, ClassNotFoundException {
Boolean flag = false;
String metadataTableName = DBUtil. getLayerMetadataTableName (ds );
StringBuffer SQL = new StringBuffer ("INSERT ");
SQL. append (metadataTableName). append ("(RECORDID, DATACOL) values (?, ?) ");
Try {
Connection con = DBUtil. getConnection (ds );
Logger.info ("excute SQL:" + SQL. toString ());
PreparedStatement prest = con. prepareStatement (SQL. toString ());
XMLType poXML = XMLType. createXML (con, xml );
Prest. setString (1, id );
Prest. setObject (2, poXML );
Prest.exe cute ();
Flag = true;
}
Catch (SQLException e ){
Flag = false;
Logger.info (e );
Throw new SQLException (e );
} Catch (ClassNotFoundException e ){
Flag = false;
Logger.info (e );
Throw new ClassNotFoundException (e. getMessage ());
}
Return flag;
};
Please indicate the source for reprinting. Please contact us! Http://www.cnblogs.com/likehua