Skip to content

Commit e4bf616

Browse files
authored
Merge pull request #1023 from eclipse-vertx/oracle
Initial contribution of the Vert.x Oracle Client
2 parents 4c7a056 + 3b303d9 commit e4bf616

File tree

58 files changed

+5192
-41
lines changed

Some content is hidden

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

58 files changed

+5192
-41
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@ jobs:
1616
strategy:
1717
matrix:
1818
os: [ubuntu-latest]
19-
profile: [PostgreSQL-9,PostgreSQL-10,PostgreSQL-11,MySQL-8.0,MySQL-5.6,MySQL-5.7,MariaDB-10.4,MSSQL-2017-latest,MSSQL-2019-latest,DB2-11.5,SQL-templates]
20-
jdk: [8]
19+
profile: [PostgreSQL-9,PostgreSQL-10,PostgreSQL-11,MySQL-8.0,MySQL-5.6,MySQL-5.7,MariaDB-10.4,MSSQL-2017-latest,MSSQL-2019-latest,DB2-11.5,Oracle-18,SQL-templates]
20+
jdk: [8, 11]
21+
exclude:
22+
- profile: Oracle-18
23+
jdk: 8
2124
fail-fast: false
2225
runs-on: ${{ matrix.os }}
2326
steps:
@@ -28,7 +31,7 @@ jobs:
2831
with:
2932
java-version: ${{ matrix.jdk }}
3033
- name: Run tests
31-
run: mvn -s .github/maven-ci-settings.xml -q clean verify -B -DskipDefault -P ${{ matrix.profile }}
34+
run: mvn -s .github/maven-ci-settings.xml clean verify -B -DskipDefault -P ${{ matrix.profile }}
3235
Deploy:
3336
name: Deploy to OSSRH
3437
if: ${{ github.repository_owner == 'eclipse-vertx' && (github.event_name == 'push' || github.event_name == 'schedule') }}

pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
<module>vertx-mssql-client</module>
119119
<module>vertx-db2-client</module>
120120
<module>vertx-sql-client-templates</module>
121+
<module>vertx-oracle-client</module>
121122
</modules>
122123
</profile>
123124
<profile>
@@ -230,6 +231,16 @@
230231
<module>vertx-sql-client-templates</module>
231232
</modules>
232233
</profile>
234+
<profile>
235+
<id>Oracle-18</id>
236+
<properties>
237+
<oracle-container.version>18-slim</oracle-container.version>
238+
</properties>
239+
<modules>
240+
<module>vertx-sql-client</module>
241+
<module>vertx-oracle-client</module>
242+
</modules>
243+
</profile>
233244
</profiles>
234245

235246
</project>

vertx-oracle-client/pom.xml

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
~ Copyright (C) 2017 Julien Viet
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ http://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
~
17+
-->
18+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
20+
21+
<modelVersion>4.0.0</modelVersion>
22+
23+
<parent>
24+
<groupId>io.vertx</groupId>
25+
<artifactId>vertx-sql-client-parent</artifactId>
26+
<version>4.2.0-SNAPSHOT</version>
27+
</parent>
28+
29+
<artifactId>vertx-oracle-client</artifactId>
30+
31+
<name>Vertx Oracle Client</name>
32+
<url>https://github.com/eclipse-vertx/vertx-sql-client</url>
33+
<description>The Reactive Oracle Client</description>
34+
35+
<properties>
36+
<doc.skip>false</doc.skip>
37+
<docs.dir>${project.basedir}/src/main/docs</docs.dir>
38+
<generated.dir>${project.basedir}/src/main/generated</generated.dir>
39+
40+
<maven.compiler.source>11</maven.compiler.source>
41+
<maven.compiler.target>11</maven.compiler.target>
42+
43+
<ojdbc.version>21.1.0.0</ojdbc.version>
44+
</properties>
45+
46+
47+
<dependencies>
48+
49+
<!-- Oracle Driver -->
50+
<dependency>
51+
<groupId>com.oracle.database.jdbc</groupId>
52+
<artifactId>ojdbc11</artifactId>
53+
<version>${ojdbc.version}</version>
54+
</dependency>
55+
56+
<!-- Vert.x dependencies -->
57+
<dependency>
58+
<groupId>io.vertx</groupId>
59+
<artifactId>vertx-core</artifactId>
60+
</dependency>
61+
<dependency>
62+
<groupId>io.vertx</groupId>
63+
<artifactId>vertx-codegen</artifactId>
64+
<optional>true</optional>
65+
</dependency>
66+
<dependency>
67+
<groupId>io.vertx</groupId>
68+
<artifactId>vertx-docgen</artifactId>
69+
<optional>true</optional>
70+
</dependency>
71+
<dependency>
72+
<groupId>io.vertx</groupId>
73+
<artifactId>vertx-sql-client</artifactId>
74+
</dependency>
75+
76+
<!-- Testing purposes -->
77+
<dependency>
78+
<groupId>org.testcontainers</groupId>
79+
<artifactId>testcontainers</artifactId>
80+
<version>${testcontainers.version}</version>
81+
<scope>test</scope>
82+
</dependency>
83+
84+
<dependency>
85+
<groupId>io.vertx</groupId>
86+
<artifactId>vertx-sql-client</artifactId>
87+
<type>test-jar</type>
88+
<scope>test</scope>
89+
</dependency>
90+
91+
</dependencies>
92+
93+
<build>
94+
<pluginManagement>
95+
<plugins>
96+
<plugin>
97+
<artifactId>maven-surefire-plugin</artifactId>
98+
<configuration>
99+
<argLine>-Xmx1024M</argLine>
100+
<systemPropertyVariables>
101+
<target.dir>${project.build.directory}</target.dir>
102+
</systemPropertyVariables>
103+
<excludes>
104+
<exclude>io/vertx/pgclient/it/**</exclude>
105+
</excludes>
106+
</configuration>
107+
</plugin>
108+
</plugins>
109+
</pluginManagement>
110+
<plugins>
111+
<!-- TODO Implement examples -->
112+
<!-- <plugin>-->
113+
<!-- <groupId>org.bsc.maven</groupId>-->
114+
<!-- <artifactId>maven-processor-plugin</artifactId>-->
115+
<!-- <executions>-->
116+
<!-- <execution>-->
117+
<!-- <id>generate-sources</id>-->
118+
<!-- <configuration>-->
119+
<!-- <optionMap>-->
120+
<!-- <docgen.source>${project.basedir}/../vertx-sql-client/src/main/asciidoc/*.adoc,${asciidoc.dir}/*.adoc</docgen.source>-->
121+
<!-- </optionMap>-->
122+
<!-- </configuration>-->
123+
<!-- </execution>-->
124+
<!-- </executions>-->
125+
<!-- </plugin>-->
126+
<plugin>
127+
<artifactId>maven-assembly-plugin</artifactId>
128+
<executions>
129+
<!-- Override sources to use custom descriptor to have all adoc files -->
130+
<execution>
131+
<id>package-sources</id>
132+
<configuration>
133+
<descriptors>
134+
<descriptor>${project.basedir}/../assembly/sources.xml</descriptor>
135+
</descriptors>
136+
<descriptorRefs>
137+
<descriptorRef>none</descriptorRef>
138+
</descriptorRefs>
139+
<ignoreMissingDescriptor>true</ignoreMissingDescriptor>
140+
</configuration>
141+
</execution>
142+
</executions>
143+
</plugin>
144+
145+
<plugin>
146+
<groupId>org.apache.maven.plugins</groupId>
147+
<artifactId>maven-compiler-plugin</artifactId>
148+
<configuration>
149+
<release>11</release>
150+
<source>11</source>
151+
<target>11</target>
152+
</configuration>
153+
</plugin>
154+
</plugins>
155+
</build>
156+
157+
<profiles>
158+
159+
</profiles>
160+
161+
</project>
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
= Reactive Oracle Client
2+
:PREPARED_PARAMS: `?`
3+
4+
The Reactive Oracle Client is a client for Oracle with a straightforward API focusing on
5+
scalability and low overhead.
6+
7+
*Features*
8+
9+
* todo
10+
11+
WARNING: this module is in tech preview
12+
13+
== Usage
14+
15+
To use the Reactive Oracle Client add the following dependency to the _dependencies_ section of your build descriptor:
16+
17+
* Maven (in your `pom.xml`):
18+
19+
[source,xml]
20+
----
21+
<dependency>
22+
<groupId>${maven.groupId}</groupId>
23+
<artifactId>${maven.artifactId}</artifactId>
24+
<version>${maven.version}</version>
25+
</dependency>
26+
----
27+
* Gradle (in your `build.gradle` file):
28+
29+
[source,groovy]
30+
----
31+
dependencies {
32+
compile '${maven.groupId}:${maven.artifactId}:${maven.version}'
33+
}
34+
----
35+
36+
== Getting started
37+
38+
Here is the simplest way to connect, query and disconnect
39+
40+
[source,$lang]
41+
----
42+
{@link examples.OracleClientExamples#gettingStarted()}
43+
----
44+
45+
== Connecting to Oracle
46+
47+
Most of the time you will use a pool to connect to Oracle:
48+
49+
[source,$lang]
50+
----
51+
{@link examples.OracleClientExamples#connecting01}
52+
----
53+
54+
The pooled client uses a connection pool and any operation will borrow a connection from the pool
55+
to execute the operation and release it to the pool.
56+
57+
If you are running with Vert.x you can pass it your Vertx instance:
58+
59+
[source,$lang]
60+
----
61+
{@link examples.OracleClientExamples#connecting02}
62+
----
63+
64+
You need to release the pool when you don't need it anymore:
65+
66+
[source,$lang]
67+
----
68+
{@link examples.OracleClientExamples#connecting03}
69+
----
70+
71+
When you need to execute several operations on the same connection, you need to use a client
72+
{@link io.vertx.sqlclient.SqlConnection connection}.
73+
74+
You can easily get one from the pool:
75+
76+
[source,$lang]
77+
----
78+
{@link examples.OracleClientExamples#connecting04}
79+
----
80+
81+
Once you are done with the connection you must close it to release it to the pool, so it can be reused.
82+
83+
== Configuration
84+
85+
There are several alternatives for you to configure the client.
86+
87+
=== Data Object
88+
89+
A simple way to configure the client is to specify a `OracleConnectOptions` data object.
90+
91+
[source,$lang]
92+
----
93+
{@link examples.OracleClientExamples#configureFromDataObject(io.vertx.core.Vertx)}
94+
----
95+
96+
== Connect retries
97+
98+
You can configure the client to retry when a connection fails to be established.
99+
100+
[source,$lang]
101+
----
102+
{@link examples.OracleClientExamples#reconnectAttempts}
103+
----
104+
105+
include::queries.adoc[leveloffset=1]
106+
107+
include::connections.adoc[]
108+
109+
include::transactions.adoc[]
110+
111+
include::cursor.adoc[]
112+
113+
== Tracing queries
114+
115+
include::tracing.adoc[]
116+
117+
== Collector queries
118+
119+
You can use Java collectors with the query API:
120+
121+
[source,$lang]
122+
----
123+
{@link examples.OracleClientExamples#collector01Example(io.vertx.sqlclient.SqlClient)}
124+
----
125+
126+
The collector processing must not keep a reference on the {@link io.vertx.sqlclient.Row} as
127+
there is a single row used for processing the entire set.
128+
129+
The Java `Collectors` provides many interesting predefined collectors, for example you can
130+
create easily create a string directly from the row set:
131+
132+
[source,$lang]
133+
----
134+
{@link examples.OracleClientExamples#collector02Example(io.vertx.sqlclient.SqlClient)}
135+
----

0 commit comments

Comments
 (0)