src/main/java/org/lightcouch/CouchDbContext.java
public void createDB(String dbName) {
		assertNotEmpty(dbName, "dbName");
		InputStream getresp = null;
		HttpResponse putresp = null;
		final URI uri = buildUri(dbc.getBaseUri()).path(dbName).build();
		try {
			getresp = dbc.get(uri);
		} catch (NoDocumentException e) { // db doesn't exist
			final HttpPut put = new HttpPut(uri);
			putresp = dbc.executeRequest(put);
			log.info(String.format("Created Database: '%s'", dbName));
		} finally {
			close(getresp);
			close(putresp);
		}
	}
public void createDB(String dbName) {
		assertNotEmpty(dbName, "dbName");
		InputStream getresp = null;
		HttpResponse putresp = null;
		final URI uri = buildUri(dbc.getBaseUri()).path(dbName).build();
		try {
			getresp = dbc.get(uri);
		} catch (NoDocumentException e) { // db doesn't exist
			final HttpPut put = new HttpPut(uri);
			putresp = dbc.executeRequest(put);
			log.info(String.format("Created Database: '%s'", dbName));
		} finally {
			close(getresp);
			close(putresp);
		}
	}
public void createDB ( String dbName ) { assertNotEmpty ( dbName , "dbName" ) ; InputStream getresp = null ; HttpResponse putresp = null ; final URI uri = buildUri ( dbc . getBaseUri ( ) ) . path ( dbName ) . build ( ) ; try { getresp = dbc . get ( uri ) ; } catch ( NoDocumentException e ) { // db doesn't exist final HttpPut put = new HttpPut ( uri ) ; putresp = dbc . executeRequest ( put ) ; log . info ( String . format ( "Created Database: '%s'" , dbName ) ) ; } finally { close ( getresp ) ; close ( putresp ) ; } }
Requests CouchDB creates a new database; if one doesn't exist.
@param dbName The Database name
Requests CouchDB creates a new database ; if one doesn t exist .