Examples: query, "exact match", wildcard*, wild?ard, wild*rd
Fuzzy search: cake~ (finds cakes, bake)
Term boost: "red velvet"^4, chocolate^2
Field grouping: tags:(+work -"fun-stuff")
Escaping: Escape characters +-&|!(){}[]^"~*?:\ with \, e.g. \+
Range search: properties.timestamp:[1587729413488 TO *] (inclusive), properties.title:{A TO Z}(excluding A and Z)
Combinations: chocolate AND vanilla, chocolate OR vanilla, (chocolate OR vanilla) NOT "vanilla pudding"
Field search: properties.title:"The Title" AND text
How to close External DB Connections explicitly

Can someone please help me closing DB connection explicitly in GuideWire

Posted one year ago
Votes Newest


Any DB connections that are opened must be explicitly closed.
The logic to get the connection and query the DB using a prepared statement should be enclosed in a try catch block. The corresponding finally block should have the logic to close any prepared statements and DB connections.

// See the Sample Code template given below to understand how the code should be structured
// Note : Only minimal code is shown here. The intent is to convey the structure
//Pay attention to the code highlighted in Yellow

override function search(criteria : ISOLocationSearchCriteria) : List<T> {
  var _dbConnection : Connection = null
  .............some code….
  .............some code….

  try {
        // Step 1. Get the connection     

          _dbConnection = DBConnectionHelper.getConnection(DB_GROUP)

     // Step 2. EXECUTE THE Prepared statement AND ANY OTHER LOGIC   
  } catch (ex : DBConnectionException) {
    // Step 3 : Catch and Log any   DB exceptions. 
   // Step 4 : Optionally rethrow the exception 
    throw ex

  } catch (ex : Exception) {
    // Step 5 : Catch and log any other custom exceptions 
    // Step 6 : Optionally rethrow the exception 
    throw ex

  } finally {
    // Step 7 : Close any prepared statements and DB connections
    // Close any prepared statements 
    // Close any DB connections 
Posted one year ago

Your answer

1 Answer
one year ago
one year ago