1
目前我正在嘗試爲我的java應用程序找到一個可嵌入的nosql數據庫。我目前的做法是使用couchbase lite java。我運行下面的例子,看到db.sqlite3文件的創建。沒有couchbase lite真的沒有sql數據庫
public class Main {
public static void main(String[] args) {
// Enable logging
Logger log = Logger.getLogger("app1");
log.setLevel(Level.ALL);
JavaContext context = new JavaContext();
// Create a manager
Manager manager = null;
try {
manager = new Manager(context, Manager.DEFAULT_OPTIONS);
} catch (IOException e) {
e.printStackTrace();
}
// Create or open the database named app
Database database = null;
try {
database = manager.getDatabase("app1");
} catch (CouchbaseLiteException e) {
e.printStackTrace();
}
// The properties that will be saved on the document
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("title", "Couchbase Mobile");
properties.put("sdk", "Java");
// Create a new document
Document document = database.createDocument();
// Save the document to the database
try {
document.putProperties(properties);
} catch (CouchbaseLiteException e) {
e.printStackTrace();
}
// Log the document ID (generated by the database)
// and properties
log.info(String.format("Document ID :: %s", document.getId()));
log.info(String.format("Learning %s with %s", (String) document.getProperty("title"), (String) document.getProperty("sdk")));
System.out.println(document.toString());
}
}
所以我在這裏使用nosql數據庫?
的各種回購協議下找到它是的,Couchbase是一個多模型NoSQL面向文檔的數據庫,您可以在[官方網站](http://www.couchbase.com/)上找到。 – DimaSan
確實couchbase lite文件的持久性機制是.sqlite3。這些讓我感到困惑的是這些數據庫文件的關係模型。你能否在這裏啓發我。 – user3014595
您看到NoSQL代表「不僅SQL」。 – DimaSan