You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/ROOT/pages/_partials/_attributes-local.adoc
+18-32Lines changed: 18 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -36,46 +36,40 @@
36
36
//
37
37
38
38
// Begin -- Source Languages
39
-
// :langAndroid: kotlin
40
-
// :langAndroidFull: java-android
41
-
// :langClang: clang
42
-
// :langCsharp: csharp
43
-
// :langJava: java
44
-
// :langJavaFull: java
45
-
// :langJavascript: javascript
46
-
// :langObjc: objc
47
-
// :langObjcFull: objective-c
48
-
// :langSwift: swift
39
+
:langAndroid: android
40
+
:langAndroidFull: java-android
41
+
:langCsharp: csharp
42
+
:langJava: java
43
+
:langJavaFull: java
44
+
:langJavascript: javascript
45
+
:langObjc: objc
46
+
:langObjcFull: objective-c
47
+
:langSwift: swift
49
48
:platform-android: android
50
-
:platform-clang: clang
51
49
:platform-jvm: jvm
52
50
:platform-ios: ios
53
51
:platform-web: web
54
52
:platform-net: net
55
53
56
54
// Couchbase Lite
57
55
:lang-mod-android: android
58
-
:lang-mod-clang: clang
59
56
:lang-mod-csharp: csharp
60
57
:lang-mod-java: java
61
58
:lang-mod-objc: objc
62
59
:lang-mod-swift: swift
63
-
:lang-name-android: kotlin
64
-
:lang-name-clang: clang
60
+
:lang-name-android: android
65
61
:lang-name-csharp: csharp
66
62
:lang-name-java: java
67
63
:lang-name-objc: objc
68
64
:lang-name-swift: swift
69
65
:lang-name-javascript: javascript
70
66
:lang-platform-android: {platform-android}
71
-
:lang-platform-clang: {platform-clang}
72
67
:lang-platform-csharp: {platform-net}
73
68
:lang-platform-java: {platform-jvm}
74
69
:lang-platform-objc: {platform-ios}
75
70
:lang-platform-swift: {platform-ios}
76
71
:lang-platform-javascript: {platform-web}
77
72
:lang-title-android: Android
78
-
:lang-title-clang: C
79
73
:lang-title-csharp: C#/.Net
80
74
:lang-title-java: Java
81
75
:lang-title-objc: Objective C
@@ -91,13 +85,12 @@
91
85
:nmStarterCode: StarterCode1.0
92
86
:nmSampleAppUser: admin
93
87
:nmSampleAppPassword: password
94
-
// :nmLangJava: java
95
-
// :nmLangJS: javascript
96
-
// :nmLangClang: C
97
-
// :nmLangNet: C#/.Net
98
-
// :nmLangSwift: Swift
99
-
// :nmLangobjc: Objective-C
100
-
// :nmLangAndroid: Android
88
+
:nmLangJava: java
89
+
:nmLangJS: javascript
90
+
:nmLangNet: C#/.Net
91
+
:nmLangSwift: Swift
92
+
:nmLangobjc: Objective-C
93
+
:nmLangAndroid: Android
101
94
102
95
:tknwip: Under Construction
103
96
:tknwip-note: This page is {tknwip} and is included as a place holder only.
@@ -135,7 +128,6 @@
135
128
// deprecated that
136
129
137
130
:url-download-swift: https://packages.couchbase.com/releases/couchbase-lite-ios/2.8.0-beta/couchbase-lite-swift_community_2.8.0.zip[Couchbase Lite Swift]
138
-
:url-download-clang: https://packages.couchbase.com/releases/couchbase-lite-c/2.8.0-beta/couchbase-lite-objc_community_2.8.0.zip[Couchbase Lite C]
139
131
:url-download-objc: https://packages.couchbase.com/releases/couchbase-lite-ios/2.8.0-beta/couchbase-lite-objc_community_2.8.0.zip[Couchbase Lite ObjC]
140
132
:url-download-android: https://packages.couchbase.com/releases/couchbase-lite-android/2.8.0-beta/couchbase-lite-android_community_2.8.0.zip[Couchbase Lite Android]
141
133
:url-download-java: https://packages.couchbase.com/releases/couchbase-lite-java/2.8.0-beta/couchbase-lite-java_community_2.8.0.zip[Couchbase Lite Java]
// END: Conditional Block -- applies to Android and JVM Java
28
31
29
-
// == Default Database Location
30
-
// By default, _Couchbase Lite on {param-title}_ creates databases in the following path location shown in <<default-path>>.
32
+
[#open-db]
33
+
== Create or Open Database
31
34
32
-
// [#default-path]
33
-
// .Default database path
34
-
// ====
35
-
// [source, {console}]
36
-
// ----
37
-
// <root dir>/.couchbase/<db name>.cblite // <.>
38
-
// ----
35
+
You can create a new database and-or open and existing database, using the {url-api-class-database} class.
36
+
Just pass in a database name and optionally a {url-api-class-databasecfg}-- see <<ex-dbopen>>.
39
37
40
-
// ifdef::is-java[<.> Where the <root dir> is the directory in which JVM was started.]
41
-
// ifdef::is-android[<.> Where the <root dir> can be identified using `context.getFilesDir()`]
38
+
Things to watch for include:
42
39
43
-
// ====
40
+
* Opening/Creating a database is an asynchronous process
41
+
* If the named database does not exist in the specified, or default, location then a new one is created
42
+
* The database is created in a default location unless you specify a directory for it -- see: {url-api-class-databasecfg} and {url-api-method-databasecfg-setdir}
43
+
+
44
+
--
45
+
TIP: Best Practice is to always specify the path to the database explicitly.
44
46
45
-
[#open-db]
46
-
== New Database
47
-
As the top-level entity in the API, new databases can be created using the `Database` class by passing in a name, configuration, or both.
48
-
The following example opens, or creates, a database using the `Database(String name, DatabaseConfiguration config)` method.
47
+
Typically, the default location for {param-title} is
Just as before, the database will be created in a default location.
58
-
Alternatively, the `Database(string name, DatabaseConfiguration config)` initializer can be used to provide specific options in the {url-api-references}/com/couchbase/lite/DatabaseConfiguration.html[`DatabaseConfiguration`] object.
59
-
60
68
<.> Here we are specifying the database directory path.
69
+
61
70
====
62
71
63
-
* Remember that:
64
-
** Opening (or creating) a database is asynchronous.
65
-
** Closing a database is a *synchronous* operation, it is effective immediately
72
+
== Close Database
73
+
You are advised to incorporate the closing of all open databases into your application workflow.
66
74
67
-
[NOTE]
68
-
--
69
-
You cannot close a database that is not fully open.
75
+
Closing a database is a simple, just use {url-api-method-database-close} -- see: <<ex-dbclose>>. +
76
+
However, there are a number of things to be aware of:
70
77
78
+
* Closing a database is a *synchronous* operation, it is effective immediately
79
+
* You cannot close a database that is not open. +
80
+
Remember that opening (or creating) a database is asynchronous.
71
81
So issuing a close immediately after initiating an open/create, may result in an error if that process has not completed.
It is the application's responsibility to manage the key and store it in a platform specific secure store such as Apple's https://developer.apple.com/documentation/security/keychain_services[Keychain] or Android's https://developer.android.com/training/articles/keystore[Keystore].
109
+
== Database Encryption
95
110
96
-
An encrypted database can only be opened with the same language SDK that was used to encrypt it in the first place.
97
-
So a database encrypted using the Swift SDK, and then exported, is readable only by the Swift SDK.
If you're migrating an application from Couchbase Lite 1.x to 2.x, note that the <<database-upgrade,automatic database upgrade>> functionality is *not supported* for encrypted databases.
102
-
Thus, to upgrade an encrypted 1.x database, you should do the following:
115
+
[#lbl-find-db-loc]
116
+
== Finding a Database File
103
117
104
-
// set the correct language name for 1.4 pages
105
-
ifeval::["{param-name}"=="{lang-name-android}"]
106
-
:param-language: {lang-name-java}
118
+
:tags: {empty}
119
+
ifdef::is-csharp[]
120
+
:tags: "tags=list-only"
107
121
endif::[]
108
-
. Disable encryption using the Couchbase Lite 1.x framework (see https://docs-archive.couchbase.com/couchbase-lite/1.4/{param-name}.html#database-encryption[1.x encryption guide])
109
-
. Open the database file with encryption enabled using the Couchbase Lite 2.x framework.
110
-
111
-
Since it is not possible to package Couchbase Lite 1.x and Couchbase Lite 2.x in the same application this upgrade path would require two successive upgrades.
112
-
If you are using Sync Gateway to synchronize the database content, it may be preferable to run a pull replication from a new 2.x database with encryption enabled and delete the 1.x local database.
`cblite` is a command-line tool for inspecting and querying Couchbase Lite 2.x databases.
127
-
128
-
You can download and build it from the couchbaselabs https://github.com/couchbaselabs/couchbase-mobile-tools/blob/master/README.cblite.md[GitHub repository].
129
-
130
-
NOTE: The `cblite` tool is not covered under the https://www.couchbase.com/support-policy[Couchbase Support Policy].
130
+
include::{root-partials}cli-tool.adoc[]
131
131
132
132
// end::cli-tool[]
133
133
134
-
== Logging
135
-
136
-
If you are using a Couchbase Lite release prior to 2.5 see <<pre-2x5-logging, Deprecated functionality>>
134
+
== Troubleshooting
135
+
You should use Couchbase's console logs as your first source of diagnostic information.
136
+
If the information in the default logging level is insufficient you can focus it on database errors and generate more verbose messages -- see: <<ex-logdb>>.
0 commit comments