を使用してcloudantデータベースからデータを取得します。私は特定のIDのデータを取得するプログラムをWRITEA。(以下のコード)私が最後に文書が変更を取得するには、Androidアプリケーションは、私が問題に直面していますJavaの自由(Javaサーブレットプログラム)
@Resource(name = "couchdb/myCloudant")
protected CouchDbInstance mydb ;
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String dbname1 = "Tempdb";
String dbname2 = "pulsedb";
try {
CouchDbConnector dbconnector1 = mydb.createConnector(dbname1, true);
InputStream s1 = dbconnector1.getAsStream("2");
// here passing the id 2 in cloudant this will return the document of id 2
BufferedReader reader1 = new BufferedReader(new InputStreamReader(s1));
StringBuilder out1 = new StringBuilder();
String line1;
while ((line1 = reader1.readLine()) != null) {
out1.append(line1);
}
// response.getWriter().print();
String ss1 = out1.toString();
}
}
This the screenshot of table in cloudant database
「プログラムを入手する」とはどういう意味ですか? – nitind
最後のドキュメントIDを取得しようとしていますので、増分できるので、その増分値は次のドキュメントIDになりますか?もしそうなら、それは曇りでは動作しません。アトミックにフィールドを増やしたい場合は、redisなどのクラウドを持つ別のテクノロジーを使用する必要があります。 –
いいえ、データベースに挿入された最後の値をアンドロイドアプリケーションに取得する必要があります – nithin