private boolean checkForDBExistence ( ) throws ClientProtocolException , IOException , URISyntaxException { URI uri = new URI ( CouchDBConstants . PROTOCOL , null , httpHost . getHostName ( ) , httpHost . getPort ( ) , CouchDBConstants . URL_SEPARATOR + databaseName . toLowerCase ( ) , null , null ) ; HttpGet get = new HttpGet ( uri ) ; HttpResponse getRes = null ; try { // creating database. getRes = httpClient . execute ( httpHost , get , CouchDBUtils . getContext ( httpHost ) ) ; if ( getRes . getStatusLine ( ) . getStatusCode ( ) == HttpStatus . SC_OK ) { return true ; } return false ; } finally { CouchDBUtils . closeContent ( getRes ) ; } }
Check for db existence .