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: README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,10 +88,10 @@ The Javadoc is located [here](http://oracle.github.io/soda-for-java).
88
88
89
89
### Build
90
90
91
-
SODA for Java source code is built with Ant and (optionally) Ivy. See [Building the source code](https://github.com/oracle/soda-for-java/blob/master/doc/Building-source-code.md) for
91
+
SODA for Java source code is built with Maven. See [Building the source code](doc/Building-source-code.md) for
92
92
details.
93
93
94
-
SODA for Java comes with a testsuite, built with JUnit and driven by Ant. See [Building and running the tests](https://github.com/oracle/soda-for-java/blob/master/doc/Building-and-running-tests.md) for details.
94
+
SODA for Java comes with a testsuite, built with JUnit and driven by Ant. See [Building and running the tests](doc/Building-and-running-tests.md) for details.
Copy file name to clipboardExpand all lines: doc/Building-and-running-tests.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,11 +12,13 @@ The test framework is located in the /test directory under the root SODA directo
12
12
**(1)** Build the source code (which includes downloading SODA dependencies), as described
13
13
in [Building the source code](https://github.com/oracle/soda-for-java/blob/master/doc/Building-source-code.md). Make sure you perform all steps described in this link. Specifically, make sure that the JAVA_HOME environment variable is set, and that the following jars are located in the /lib directory under the top level SODA directory (the one that contains LICENSE.txt):
14
14
15
-
* JDBC jar
16
-
* javax.json-1.1.4.jar (JSR353 jar)
17
-
* junit-3.8.1.jar (JUnit jar)
15
+
* javax.json-*.jar
16
+
* junit-*.jar
18
17
* orajsoda.jar (SODA Java jar)
19
-
18
+
* jakarta.json-*.jar
19
+
* jakarta.json-api-*.jar
20
+
* ojdbc8-*.jar
21
+
20
22
**(2)** Some of the tests use encrypted data, so you must open a wallet.
21
23
22
24
Set the parameter in sqlnet.ora, if not set already, to specify the location of the wallet:
@@ -69,7 +71,7 @@ Replace myaccount and mypassword with the account name and password created in s
69
71
If you're using an OS other then Linux, set the environment variable using the appropriate mechanism.
70
72
71
73
**(7)** Navigate to the /test directory under the root SODA directory, and run the test framework:
72
-
74
+
73
75
ant -Ddatasource=datasource.properties
74
76
75
77
The test framework should run and output "BUILD SUCCESSFUL" at the end. Open up a browser, and navigate to the /test/testoutput directory under the root SODA directory. Then navigate to the directory identified by the timestamp of your run (this directory is created by the test framework, on every run). From there, nagivate to /html/index.html, for a detailed test report. In case of test failures, this report allows you to navigate to the failures, and see the stack trace of their occurrence in each failed test.
SODA is built using Ant with Ivy. Make sure you have Ant 1.9 or above installed and configured. It's not required that Ivy is installed - as long as you have an internet connection, the build process will download Ivy and use it to download SODA dependencies.
3
+
SODA is built using Maven. Make sure you have Apache Maven 3.6.2 or above installed and configured.
4
4
5
5
The following instructions require setting various environment variables. They assume you're on Linux, and using the C Shell (csh). On other OSes, you would set environment variables analogously, using a mechanism appropriate for your specific operating system.
6
-
6
+
7
7
Set the JAVA_HOME environment variable to the JDK install directory. At a minimum, JDK 8 is required. For example, assuming you are using JDK 8 installed under /jdk8, and you're using the C Shell (csh) on Linux, do:
8
8
9
9
setenv JAVA_HOME /jdk8
10
10
11
-
### Building with Ivy
12
-
13
-
If you're behind a firewall, you might need to set the proxy host and port
14
-
number by setting the ANT_OPTS environment variable. For example, assuming
15
-
your proxy host is myproxy.mycompany.com and the port is 80, do:
If you have Ivy installed already, set the IVY_HOME environment variable.
20
-
The ivy.jar file must be located under the IVY_HOME/lib. For example,
21
-
suppose your ivy.jar is in /home/myname/ivyinstall/lib. Then you would set
22
-
IVY_HOME as follows:
23
-
24
-
setenv IVY_HOME /home/myname/invyinstall
25
-
26
-
If you don't have Ivy installed, it will be downloaded automatically to
27
-
${user.home}/.ant/lib. See [https://ant.apache.org/manual/Tasks/property.html](https://ant.apache.org/manual/Tasks/property.html) for info on what ${user.home} resolves to on different operating systems.
28
-
29
-
Finally, navigate to the top SODA Java directory (the one that contains LICENSE.txt),
30
-
and execute the ant build file by typing:
31
-
32
-
ant
11
+
### Building with Maven
33
12
34
-
As this command is executing, you should see messages informing you about Ivy downloading itself (unless it's already installed), downloading of the SODA dependencies, and code compilation and archiving (jar creation).
13
+
`cd soda-for-java`\
14
+
`mvn clean install`
35
15
36
-
If the process gets stuck while downloading Ivy, or downloading SODA dependencies (in case you
37
-
have Ivy installed already), and you're behind a firewall, make sure your proxy host and port
38
-
settings are correct.
39
-
40
-
If the build is successful, you should see orajsoda.jar (the SODA jar) in the /lib directory
41
-
under the top SODA directory.
42
-
43
-
### Building without Ivy
44
-
45
-
SODA has the following dependencies:
46
-
47
-
* ojdbc8.jar or above (JDBC jar)
48
-
* javax.json-1.1.4.jar (JSR353 jar)
49
-
* junit-3.8.1.jar (JUnit jar, only used by the testsuite)
50
-
51
-
Download the jdbc jar ([https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc8/19.3.0.0/ojdbc8-19.3.0.0.jar](https://repo1.maven.org/maven2/com/oracle/database/jdbc/ojdbc8/19.3.0.0/ojdbc8-19.3.0.0.jar)), javax.json-1.1.4.jar ([http://search.maven.org/remotecontent?filepath=org/glassfish/javax.json/1.1.4/javax.json-1.1.4.jar](http://search.maven.org/remotecontent?filepath=org/glassfish/javax.json/1.0.4/javax.json-1.0.4.jar)) and junit-3.8.1.jar ([http://central.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar](http://central.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar)).
52
-
53
-
Place these jars in the /lib directory under the root SODA directory.
54
-
55
-
Finally, navigate to the top SODA Java directory (the one that contains LICENSE.txt),
56
-
and execute the ant build file by typing the following command:
57
-
58
-
ant -Ddownload.deps=false
16
+
If you're behind a firewall, you might need to set the proxy host and port
17
+
number. For example, assuming your proxy host is myproxy.mycompany.com and the port is 80, do:
59
18
60
-
As this command is executing, you should see messages related to code compilation and archiving (jar creation).
// Get an OracleRDBMSClient - starting point of SODA for
62
65
// Java application
@@ -156,11 +159,11 @@ public class testSODA {
156
159
157
160
Copy and paste this code into a file called testSODA.java. Then modify the "url" String at the beginning of the program with connection info for your Oracle RDBMS instance. Also "user" and "password" properties set at the beginning of the program need to be modified with the schema name which will contain the table backing the collection, and the password for that schema.
158
161
159
-
To compile and run SODA for Java application you will need the orajsoda-version.jar and its dependencies (javax.json-1.1.4.jar, which is the JSR252 implementation, and the Oracle JDBC jar). Obtain the latest SODA for Java jar and its dependencies using these Maven coordinates:
162
+
To compile and run SODA for Java application you will need the orajsoda-version.jar and its dependencies (javax.json-1.1.4.jar, which is the JSR252 implementation, and the Oracle JDBC jar, JSON API - jakarta.json-api-2.1.3.jar, Parsson - jakarta.json-1.1.5.jar). Obtain the latest SODA for Java jar and its dependencies using these Maven coordinates:
160
163
161
164
**Group id:** com.oracle.database.soda
162
165
**Artifact id:** orajsoda
163
-
**Version:** 1.1.7.1
166
+
**Version:** 1.1.7.1
164
167
165
168
The above will automatically pull the latest versions of the dependencies needed to work with SODA on all supported database versions and cloud services. **Note:** there was an issue with 1.1.7 SODA release on Maven Central - an incorrect version for the javax.json dependency was stated in the SODA POM. This is fixed in the 1.1.7.1 SODA patch release on Maven Central, so please use 1.1.7.1 as the release version.
166
169
@@ -172,21 +175,28 @@ If you need to download the SODA jar and the dependencies manually, you can do t
172
175
173
176
* orajsoda-version.jar. The SODA jar. Download the latest version [here](https://github.com/oracle/soda-for-java/releases).
174
177
178
+
* JSONP API. jakarta.json-api-2.1.3.jar. Download the latest version [here](https://mvnrepository.com/artifact/jakarta.json/jakarta.json-api/2.1.3).
179
+
180
+
* Parsson. jakarta.json-1.1.5.jar. Download the latest version [here](https://mvnrepository.com/artifact/org.eclipse.parsson/parsson/1.1.5).
181
+
182
+
175
183
Compile and run testSODA.java, making sure the necessary jars are in the classpath. JDK 8 or above is required. For example, assuming you're in the directory where the jars are located, and you are using ojdbc8.jar, do:
Note - The "_id" values are randomly generated on every insert, and will be different from the specific values shown above.
190
200
191
201
This example illustrates two ways of retrieving documents from the collection: by using unique document keys, or by using QBEs. To find all users with at least 300 friends, the following QBE was used in the code above:
As you can see a table has been created with the following columns:
214
-
215
-
ID Stores the auto-generated key
216
-
JSON_DOCUMENT Stores the document content
217
-
CREATED_ON Stores the auto-generated created-on timestamp
218
-
LAST_MODIFIED Stores the auto-generated last-modified timestamp
219
-
VERSION Stores the auto-generated document version
217
+
DATA JSON
220
218
221
219
This table schema corresponds to the default collection configuration, but SODA collections are highly configurable. For example, the timestamp and the version columns are optional, there are many possible ways of generating the IDs or versions, etc. Custom collection configuration is covered in the documentation (see [Creating a Document Collection with SODA for Java](https://docs.oracle.com/en/database/oracle/simple-oracle-document-access/java-1/adsda/using-soda-java.html#GUID-CCD5E91C-7F28-4193-8564-C8201CCF08CE) and [SODA Collection Configuration Using Custom Metadata](https://docs.oracle.com/en/database/oracle/simple-oracle-document-access/java-1/adsda/soda-collection-configuration-using-custom-metadata.html#GUID-D17E8D3C-EE74-49CD-84AA-CE86B9664554)). Although most users should be fine with the defaults, custom collection configuration might be useful in some cases, such as mapping an existing table to a new collection.
222
220
223
221
To drop the collection, removing the underlying table and cleaning up the metadata persisted in the database, run the example again, but this time with the "drop" argument at the end:
224
222
225
-
java -classpath "orajsoda-version.jar:ojdbc8.jar:javax.json-1.1.4.jar:." testSODA drop
223
+
java -classpath "orajsoda.jar:ojdbc8.jar:javax.json-1.1.4.jar:jakarta.json-api-2.1.3.jar:jakarta.json-1.1.5.jar:." testSODA drop
226
224
227
225
The output will now be different from before, since the same three documents will be inserted again. But, at the end, the collection will be dropped, and the underlying table removed.
0 commit comments