Skip to content

Commit

Permalink
Merge branch '9.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
ndepomereu committed Aug 12, 2024
2 parents 446bb75 + db9f41d commit 73a0f50
Show file tree
Hide file tree
Showing 16 changed files with 506 additions and 130 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
/overview.html
/aceql-client-jdbc-comparison-matrix.md
>>>>>>> refs/heads/6.1
/private/
15 changes: 15 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
33 changes: 15 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

# AceQL HTTP

## AceQL Client JDBC Driver v9.3 - User Guide
## AceQL Client JDBC Driver v9.4 - User Guide

## March 2, 2023
## August 12, 2024

<img src="https://docs.aceql.com/img/AceQL-Schema-min.jpg" alt="AceQL Draw"/>

Expand Down Expand Up @@ -86,7 +86,7 @@ The Client JDBC Driver version is compatible with AceQL HTTP server side v12.2+

### Main features

| AceQL Client JDBC Driver v9.3<br>Main Features |
| AceQL Client JDBC Driver v9.4<br>Main Features |
| :----------------------------------------------------------- |
| <img src="https://download.aceql.com/images/check_20.png" alt="check!"/>&nbsp;Works as a real [JDBC Driver](https://docs.oracle.com/javase/tutorial/jdbc/basics/connecting.html) <br/>Plug & play without editing your app source code. |
| <img src="https://download.aceql.com/images/check_20.png" alt="check!"/>&nbsp;Main SQL types<br/>`Boolean`, `Integer`, `Short`, `Double`, `Float`, `BigDecimal`, `Long`, `String`, `Date`, `Time`, `Timestamp` |
Expand All @@ -113,7 +113,7 @@ The Client JDBC Driver version is compatible with AceQL HTTP server side v12.2+
<dependency>
<groupId>com.aceql</groupId>
<artifactId>aceql-http-client-jdbc-driver</artifactId>
<version>9.3</version>
<version>9.4</version>
</dependency>
```
### Single Jar
Expand Down Expand Up @@ -164,10 +164,9 @@ Note that AceQL is optimized as much as possible:
- The rows are all dumped at once on the servlet output stream by the server.
- The client side gets the `ResultSet` content as a file.
- All `ResultSet` navigation commands are executed locally on the client side by navigating through the file: `next()`, `prev(`), `first()`, `last()`, etc.

- **It is highly recommended to always use batch commands when you have many rows to INSERT or UPDATE.**

_________



## *[Advertisement] 📢*
Expand All @@ -186,15 +185,13 @@ _________

👉 Explore [**ChatMotor**](https://www.chatmotor.ai) and revolutionize your development workflow!



---

# Using the AceQL Client JDBC Driver

We will use the same `sampledb` database for all our code samples.

The schema is available here: [sampledb.txt](https://docs.aceql.com/rest/soft_java_client/9.3/src/sampledb.txt).
The schema is available here: [sampledb.txt](https://docs.aceql.com/rest/soft_java_client/9.4/src/sampledb.txt).

## Connection creation

Expand Down Expand Up @@ -256,7 +253,7 @@ Sample code:

## Handling Exceptions

Except for `NullPointerException`, exceptions thrown are always an instance of [AceQLException.](https://docs.aceql.com/rest/soft_java_client/9.3/javadoc/com/aceql/jdbc/commons/AceQLConnection.html)
Except for `NullPointerException`, exceptions thrown are always an instance of [AceQLException.](https://docs.aceql.com/rest/soft_java_client/9.4/javadoc/com/aceql/jdbc/commons/AceQLConnection.html)

The `AceQLException` contains 5 pieces of information :

Expand Down Expand Up @@ -559,8 +556,8 @@ The atomic variables values will be shared by AceQL download/upload processes an

The values are to be initialized and passed to `AceQLConnection` before the JDBC actions with the static setters:

- [AceQLConnection.setProgress(AtomicInteger progress)](https://docs.aceql.com/rest/soft_java_client/9.3/javadoc/com/aceql/jdbc/commons/AceQLConnection.html#setProgress(java.util.concurrent.atomic.AtomicInteger))
- [AceQLConnection.setCancelled(AtomicBoolean cancelled)](https://docs.aceql.com/rest/soft_java_client/9.3/javadoc/com/aceql/jdbc/commons/AceQLConnection.html#setCancelled(java.util.concurrent.atomic.AtomicBoolean))
- [AceQLConnection.setProgress(AtomicInteger progress)](https://docs.aceql.com/rest/soft_java_client/9.4/javadoc/com/aceql/jdbc/commons/AceQLConnection.html#setProgress(java.util.concurrent.atomic.AtomicInteger))
- [AceQLConnection.setCancelled(AtomicBoolean cancelled)](https://docs.aceql.com/rest/soft_java_client/9.4/javadoc/com/aceql/jdbc/commons/AceQLConnection.html#setCancelled(java.util.concurrent.atomic.AtomicBoolean))


Values will then be updated and read:
Expand Down Expand Up @@ -683,7 +680,7 @@ Assuming hat you want to display a progress indicator using `SwingWorker`, you w
}
```

A complete example is available in [SqlProgressMonitorDemo.java](https://docs.aceql.com/rest/soft_java_client/9.3/src/SqlProgressMonitorDemo.java) and [BlobExample.java](https://docs.aceql.com/rest/soft_java_client/9.3/src/BlobExample.java)
A complete example is available in [SqlProgressMonitorDemo.java](https://docs.aceql.com/rest/soft_java_client/9.4/src/SqlProgressMonitorDemo.java) and [BlobExample.java](https://docs.aceql.com/rest/soft_java_client/9.4/src/BlobExample.java)

## HTTP session options

Expand Down Expand Up @@ -715,18 +712,18 @@ First step is to get an instance of `RemoteDatabaseMetaData`:

### Downloading database schema into a file

Downloading a schema into a Java `File` is done through the method. See the `RemoteDatabaseMetaData` [javadoc](https://docs.aceql.com/rest/soft_java_client/9.3/javadoc/com/aceql/jdbc/commons/metadata/RemoteDatabaseMetaData.html).
Downloading a schema into a Java `File` is done through the method. See the `RemoteDatabaseMetaData` [javadoc](https://docs.aceql.com/rest/soft_java_client/9.4/javadoc/com/aceql/jdbc/commons/metadata/RemoteDatabaseMetaData.html).

```java
File file = new File("db_schema.out.html");
remoteDatabaseMetaData.dbSchemaDownload(file);
```

See an example of the built HTML schema: [db_schema.out.html](https://docs.aceql.com/rest/soft_java_client/9.3/src/db_schema.out.html)
See an example of the built HTML schema: [db_schema.out.html](https://docs.aceql.com/rest/soft_java_client/9.4/src/db_schema.out.html)

### Accessing remote database main properties

The [JdbcDatabaseMetaData](https://docs.aceql.com/rest/soft_java_client/9.3/javadoc/com/aceql/jdbc/commons/metadata/JdbcDatabaseMetaData.html) class wraps instance the main value retrieved by a remote JDBC call to `Connection.getMetaData`():
The [JdbcDatabaseMetaData](https://docs.aceql.com/rest/soft_java_client/9.4/javadoc/com/aceql/jdbc/commons/metadata/JdbcDatabaseMetaData.html) class wraps instance the main value retrieved by a remote JDBC call to `Connection.getMetaData`():

```java
JdbcDatabaseMetaData jdbcDatabaseMetaData = remoteDatabaseMetaData.getJdbcDatabaseMetaData();
Expand All @@ -737,7 +734,7 @@ The [JdbcDatabaseMetaData](https://docs.aceql.com/rest/soft_java_client/9.3/java

### Getting Details of Tables and Columns

See the [javadoc](https://docs.aceql.com/rest/soft_java_client/9.3/javadoc/com/aceql/jdbc/commons/metadata/package-summary.html) of the `com.aceql.jdbc.commons.metadata` package:
See the [javadoc](https://docs.aceql.com/rest/soft_java_client/9.4/javadoc/com/aceql/jdbc/commons/metadata/package-summary.html) of the `com.aceql.jdbc.commons.metadata` package:

```java
System.out.println("Get the table names:");
Expand All @@ -761,7 +758,7 @@ See the [javadoc](https://docs.aceql.com/rest/soft_java_client/9.3/javadoc/com/a

### Code Sample

Standard JDBC [DatabaseMetadata](https://docs.aceql.com/rest/soft_java_client/9.3/javadoc/com/aceql/jdbc/commons/metadata/JdbcDatabaseMetaData.html) and [ResultSetMetadata](https://docs.oracle.com/javase/8/docs/api/java/sql/ResultSetMetaData.html) calls are fully supported.
Standard JDBC [DatabaseMetadata](https://docs.aceql.com/rest/soft_java_client/9.4/javadoc/com/aceql/jdbc/commons/metadata/JdbcDatabaseMetaData.html) and [ResultSetMetadata](https://docs.oracle.com/javase/8/docs/api/java/sql/ResultSetMetaData.html) calls are fully supported.

`DatabaseMetaData` example:

Expand Down
9 changes: 9 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
AceQL Client JDBC Driver
Release Notes


Introduction
------------

Expand All @@ -18,6 +19,14 @@ The AceQL Client JDBC Driver is licensed under the Apache 2.0
License.


AceQL Client JDBC Driver - Version 9.4 - 12-Aug-2023
----------------------------------------------------

What's new:
- You can now define a maximum number of retries for failed HTTP calls,
with a configurable delay between each retry.


AceQL Client JDBC Driver - Version 9.3 - 02-Mar-2023
----------------------------------------------------

Expand Down
86 changes: 85 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.aceql</groupId>
<artifactId>aceql-http-client-jdbc-driver</artifactId>
<version>9.3</version>
<version>9.4</version>

<!--
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -41,6 +42,89 @@
</plugins>
</build>
-->

<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>

<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.5.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<additionalparam>-Xdoclint:none</additionalparam>

<sourcepath>${project.basedir}/src/main/java</sourcepath>

<excludes>
<exclude>com/aceql/jdbc/commons/main/**</exclude>
<exclude>com/aceql/jdbc/commons/driver/**</exclude>
</excludes>

<includes>
<include>com/aceql/jdbc/commons/*.java</include> <!-- Includes only Java files directly in the commons package -->
<include>com/aceql/jdbc/commons/*.html</include> <!-- Includes only HTML files directly in the commons package -->
<include>com/aceql/jdbc/commons/metadata/*.java</include> <!-- Includes only Java files directly in the metadata package -->
<include>com/aceql/jdbc/commons/metadata/*.html</include> <!-- Includes only Java files directly in the metadata package -->
<include>com/aceql/jdbc/driver/free/*.java</include> <!-- Includes only Java files directly in the free package -->
<include>com/aceql/jdbc/driver/free/*.html</include> <!-- Includes only HTML files directly in the free package -->
</includes>

</configuration>

<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

<dependencies>
<dependency>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/aceql/jdbc/commons/AceQLConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
* </pre>
*
* </blockquote> See the source code of <a href=
* "https://docs.aceql.com/rest/soft_java_client/9.3/src/SqlProgressMonitorDemo.java"
* "https://docs.aceql.com/rest/soft_java_client/9.4/src/SqlProgressMonitorDemo.java"
* >SqlProgressMonitorDemo.java</a> that demonstrates the use of atomic
* variables when inserting a Blob. <br>
* <br>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
*
* The code of {@code com.mycompany.MyServerQueryExecutor} server side sample is
* available here: <a href=
* "https://docs.aceql.com/rest/soft_java_client/9.3/src/MyServerQueryExecutor.java">MyServerQueryExecutor.java</a>.
* "https://docs.aceql.com/rest/soft_java_client/9.4/src/MyServerQueryExecutor.java">MyServerQueryExecutor.java</a>.
*
* @author Nicolas de Pomereu
* @since 8.2
Expand Down
78 changes: 47 additions & 31 deletions src/main/java/com/aceql/jdbc/commons/ConnectionInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,42 +67,34 @@ public class ConnectionInfo {
private Map<String, String> requestProperties = new HashMap<>();
private String clobReadCharset;
private String clobWriteCharset;

private int maxRetries;
private int retryIntervalMs;

/**
* Package protected constructor, Driver users can not instantiate the class.
*
* @param url
* @param database
* @param authentication
* @param passwordIsSessionId
* @param proxy
* @param proxyAuthentication
* @param connectTimeout
* @param readTimeout
* @param gzipResult
* @param resultSetMetaDataPolicy
* @param requestProperties
* @param clobReadCharset
* @param clobWriteCharset
* @param ConnectionInfoHolder all the info set and passed.
*/
ConnectionInfo(String url, String database, PasswordAuthentication authentication, boolean passwordIsSessionId,
Proxy proxy, PasswordAuthentication proxyAuthentication, int connectTimeout, int readTimeout,
boolean gzipResult, ResultSetMetaDataPolicy resultSetMetaDataPolicy, Map<String, String> requestProperties,
String clobReadCharset, String clobWriteCharset) {
this.url = url;
this.database = database;
this.authentication = authentication;
this.passwordIsSessionId = passwordIsSessionId;
this.proxy = proxy;
this.proxyAuthentication = proxyAuthentication;
this.connectTimeout = connectTimeout;
this.readTimeout = readTimeout;
this.gzipResult = gzipResult;
this.resultSetMetaDataPolicy = resultSetMetaDataPolicy;
this.requestProperties = requestProperties;
this.clobReadCharset = clobReadCharset;
this.clobWriteCharset = clobWriteCharset;
ConnectionInfo(ConnectionInfoHolder connectionInfoHolder) {
this.url = connectionInfoHolder.getUrl();
this.database = connectionInfoHolder.getDatabase();
this.authentication = connectionInfoHolder.getAuthentication();
this.passwordIsSessionId = connectionInfoHolder.isPasswordIsSessionId();
this.proxy = connectionInfoHolder.getProxy();
this.proxyAuthentication = connectionInfoHolder.getProxyAuthentication();
this.connectTimeout = connectionInfoHolder.getConnectTimeout();
this.readTimeout = connectionInfoHolder.getReadTimeout();
this.gzipResult = connectionInfoHolder.isGzipResult();
this.resultSetMetaDataPolicy = connectionInfoHolder.getResultSetMetaDataPolicy();
this.requestProperties = connectionInfoHolder.getRequestProperties();
this.clobReadCharset = connectionInfoHolder.getClobReadCharset();
this.clobWriteCharset = connectionInfoHolder.getClobWriteCharset();

this.maxRetries = connectionInfoHolder.getMaxRetries();
this.retryIntervalMs = connectionInfoHolder.getRetryIntervalMs();
}


/**
* Gets the URL of the remote database
Expand Down Expand Up @@ -254,7 +246,28 @@ public Instant getCreationDateTime() {
return creationDateTime;
}

@Override

/**
* Gets the maximum number of retries for failed requests.
* @return the maximum number of retries for failed requests.
*/
public int getMaxRetries() {
return maxRetries;
}

void setMaxRetries(int maxRetries) {
this.maxRetries = maxRetries;
}

/**
* Gets the interval between retries in milliseconds.
* @return the interval between retries in milliseconds.
*/
public int getRetryIntervalMs() {
return retryIntervalMs;
}

//@Override
public String toString() {

String username = authentication.getUserName();
Expand All @@ -264,8 +277,11 @@ public String toString() {
+ ", creationDateTime=" + creationDateTime + ", passwordIsSessionId=" + passwordIsSessionId + ", proxy="
+ proxy + ", proxyAuthentication=" + proxyUsername + ", connectTimeout=" + connectTimeout
+ ", readTimeout=" + readTimeout + ", gzipResult=" + gzipResult
+ ", maxRetries=" + maxRetries + ", retryIntervalMs=" + retryIntervalMs
+ ", resultSetMetaDataPolicy=" + resultSetMetaDataPolicy + ", requestProperties=" + requestProperties
+ ", clobReadCharset=" + clobReadCharset + ", clobWriteCharset=" + clobWriteCharset + "]";
}



}
Loading

0 comments on commit 73a0f50

Please sign in to comment.