Closed GoogleCodeExporter closed 8 years ago
the 404 comes from the fact that the Database you are trying to create a
document in does not exist. If you do something like
{{{
final String dbName = "mycouchdb";
Database db = new Database("localhost", 5984, dbName);
Server server = db.getServer();
if (!server.listDatabases().contains(dbName))
{
System.out.println("Create Database " + dbName);
server.createDatabase(dbName);
}
Map<String, String> doc = new HashMap<String, String>();
doc.put("foo", "value for the foo attribute");
doc.put("bar", "value for the bar attribute");
db.createDocument(doc);
}}}
it works fine.
Original comment by ff...@gmx.de
on 22 Aug 2010 at 8:43
Original issue reported on code.google.com by
bupt.z...@gmail.com
on 22 Aug 2010 at 2:30