Skip to content

Commit 634e31b

Browse files
authored
Merge pull request #27 from VedantMahajanOracle/XDK_SODA1_LINUX.X64_240916
240916
2 parents 0e44ed5 + 0658175 commit 634e31b

File tree

279 files changed

+25705
-7777
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

279 files changed

+25705
-7777
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ The Javadoc is located [here](http://oracle.github.io/soda-for-java).
8888

8989
### Build
9090

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
9292
details.
9393

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.
9595

9696
## Contributing
9797

THIRD_PARTY_LICENSES.txt

Lines changed: 573 additions & 0 deletions
Large diffs are not rendered by default.

build.xml

Lines changed: 0 additions & 89 deletions
This file was deleted.

doc/Building-and-running-tests.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ The test framework is located in the /test directory under the root SODA directo
1212
**(1)** Build the source code (which includes downloading SODA dependencies), as described
1313
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):
1414

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
1817
* orajsoda.jar (SODA Java jar)
19-
18+
* jakarta.json-*.jar
19+
* jakarta.json-api-*.jar
20+
* ojdbc8-*.jar
21+
2022
**(2)** Some of the tests use encrypted data, so you must open a wallet.
2123

2224
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
6971
If you're using an OS other then Linux, set the environment variable using the appropriate mechanism.
7072

7173
**(7)** Navigate to the /test directory under the root SODA directory, and run the test framework:
72-
74+
7375
ant -Ddatasource=datasource.properties
7476

7577
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.

doc/Building-source-code.md

Lines changed: 9 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,21 @@
11
# Building the source code
22

3-
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.
44

55
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+
77
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:
88

99
setenv JAVA_HOME /jdk8
1010

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:
16-
17-
setenv ANT_OPTS "-Dhttp.proxyHost=myproxy.mycompany.com -Dhttp.proxyPort=80 -Dhttps.proxyHost=myproxy.mycompany.com -Dhttps.proxyPort=80"
18-
19-
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
3312

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`
3515

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:
5918

60-
As this command is executing, you should see messages related to code compilation and archiving (jar creation).
19+
`mvn clean install -Dhttp.proxyHost=myproxy.mycompany.com -Dhttp.proxyPort=80 -Dhttps.proxyHost=myproxy.mycompany.com -Dhttps.proxyPort=80`
6120

62-
If the build is successful, you should see orajsoda.jar (the SODA jar) in the /lib directory
63-
under the top SODA directory.
21+
If the build is successful, you should see orajsoda.jar (the SODA jar) and other dependency jars in the /lib directory under the top SODA directory.

doc/Getting-started-example.md

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,20 @@ document collections will be stored in this schema. Pick or create a schema
1010
for this purpose, and then issue the following command (in sqlplus, for example):
1111

1212
grant SODA_APP to schemaName;
13-
13+
1414
The following simple SODA Java program performs several common operations:
1515

16-
* Creates a new collection
17-
* Inserts documents into the collection
18-
* Retrieves the first inserted document by its auto-generated key
19-
* Retrieves documents matching a query-by-example, or QBE
16+
* Creates a new collection
17+
* Inserts documents into the collection
18+
* Retrieves the first inserted document by its auto-generated key
19+
* Retrieves documents matching a query-by-example, or QBE
2020

2121
```java
2222
import java.sql.Connection;
2323
import java.sql.DriverManager;
2424

25+
import oracle.jdbc.OracleConnection;
26+
2527
import oracle.soda.rdbms.OracleRDBMSClient;
2628

2729
import oracle.soda.OracleDatabase;
@@ -53,10 +55,11 @@ public class testSODA {
5355
try {
5456
// Get a JDBC connection to an Oracle instance
5557
conn = DriverManager.getConnection(url, props);
56-
58+
59+
OracleConnection oracleConn = (OracleConnection) conn;
5760
// Enable JDBC implicit statement caching
58-
conn.setImplicitCachingEnabled(true);
59-
conn.setStatementCacheSize(50);
61+
oracleConn.setImplicitCachingEnabled(true);
62+
oracleConn.setStatementCacheSize(50);
6063

6164
// Get an OracleRDBMSClient - starting point of SODA for
6265
// Java application
@@ -156,11 +159,11 @@ public class testSODA {
156159

157160
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.
158161

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:
160163

161164
**Group id:** com.oracle.database.soda
162165
**Artifact id:** orajsoda
163-
**Version:** 1.1.7.1
166+
**Version:** 1.1.7.1
164167

165168
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.
166169

@@ -172,21 +175,28 @@ If you need to download the SODA jar and the dependencies manually, you can do t
172175

173176
* orajsoda-version.jar. The SODA jar. Download the latest version [here](https://github.com/oracle/soda-for-java/releases).
174177

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+
175183
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:
176184

177-
javac -classpath "orajsoda.jar" testSODA.java
178-
java -classpath "orajsoda-version.jar:ojdbc8.jar:javax.json-1.0.4.jar:." testSODA
185+
javac -classpath "orajsoda.jar:ojdbc8.jar" testSODA.java
186+
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
179187

180188
You should see the following output:
181189

182190
* Retrieving the first document by its key *
183191

184-
{ "name" : "Alex", "friends" : 50 }
192+
{ "name" : "Alex", "friends" : 50 , "_id":"66df52ce93038afff74f0692"}
185193

186194
* Retrieving documents representing users with at least 300 friends *
187195

188-
{ "name" : "Mia", "friends" : 300 }
189-
{ "name" : "Gloria", "friends" : 399 }
196+
{ "name" : "Mia", "friends" : 300, "_id":"66df52ce93038afff74f0692" }
197+
{ "name" : "Gloria", "friends" : 399, "_id":"66df52ce93038afff74f0696" }
198+
199+
Note - The "_id" values are randomly generated on every insert, and will be different from the specific values shown above.
190200

191201
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:
192202

@@ -204,25 +214,13 @@ You should see:
204214

205215
Name Null? Type
206216
----------------------------------------- -------- ----------------------------
207-
ID NOT NULL VARCHAR2(255)
208-
CREATED_ON NOT NULL TIMESTAMP(6)
209-
LAST_MODIFIED NOT NULL TIMESTAMP(6)
210-
VERSION NOT NULL VARCHAR2(255)
211-
JSON_DOCUMENT BLOB
212-
213-
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
220218

221219
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.
222220

223221
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:
224222

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
226224

227225
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.
228226

0 commit comments

Comments
 (0)