Skip to content

Commit c927f36

Browse files
[FLINK-39960][docs] Remove broken JavaDoc shortcode usage from JDBC docs (#193)
* [FLINK-39960][docs] Remove broken JavaDoc shortcode usage from JDBC docs * [FLINK-39960][docs] Align indentation in JDBC datastream code examples
1 parent f8f84a4 commit c927f36

2 files changed

Lines changed: 31 additions & 44 deletions

File tree

  • docs
    • content.zh/docs/connectors/datastream
    • content/docs/connectors/datastream

docs/content.zh/docs/connectors/datastream/jdbc.md

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ Please consult your database documentation on how to add the corresponding drive
4040

4141
## JDBC Source
4242

43-
Configuration goes as follow (see also {{< javadoc file="org/apache/flink/connector/jdbc/source/JdbcSource.html" name="JdbcSource javadoc" >}}
44-
and {{< javadoc file="org/apache/flink/connector/jdbc/source/JdbcSourceBuilder.html" name="JdbcSourceBuilder javadoc" >}}).
45-
4643
### Usage
4744

4845
{{< tabs "4ab65f13-607a-411a-8d24-e709f701cd41" >}}
@@ -128,7 +125,6 @@ ResultExtractor resultExtractor = new ResultExtractor() {
128125
### JdbcParameterValuesProvider
129126

130127
A provider to provide parameters in sql to fulfill actual value in the corresponding placeholders, which is in the form of two-dimension array.
131-
See {{< javadoc file="org/apache/flink/connector/jdbc/split/JdbcParameterValuesProvider.html" name="JdbcParameterValuesProvider javadoc" >}} for more details.
132128

133129
```java
134130

@@ -178,8 +174,6 @@ jdbcSourceBuilder =
178174
JdbcSource source = jdbcSourceBuilder.build();
179175
```
180176

181-
See {{< javadoc file="org/apache/flink/connector/jdbc/utils/ContinuousUnBoundingSettings.html" name="ContinuousUnBoundingSettings javadoc" >}} for more details.
182-
183177
### Full example
184178

185179
{{< tabs "4ab65f13-608a-411a-8d24-e303f348ds81" >}}
@@ -214,7 +208,7 @@ public class JdbcSourceExample {
214208
new Book(
215209
resultSet.getLong("id"),
216210
resultSet.getString("title")))
217-
.build();
211+
.build();
218212
env.fromSource(jdbcSource, WatermarkStrategy.noWatermarks(), "TestSource")
219213
.addSink(new DiscardingSink());
220214
env.execute();
@@ -233,7 +227,7 @@ Still not supported in Python API.
233227

234228
The JDBC sink provides at-least-once guarantee.
235229
Effectively though, exactly-once can be achieved by crafting upsert SQL statements or idempotent SQL updates.
236-
Configuration goes as follow (see also {{< javadoc file="org/apache/flink/connector/jdbc/JdbcSink.html" name="JdbcSink javadoc" >}}).
230+
Configuration goes as follows:
237231

238232
{{< tabs "4ab65f13-607a-411a-8d24-e709f701cd4c" >}}
239233
{{< tab "Java" >}}
@@ -274,16 +268,16 @@ It then repeatedly calls a user-provided function to update that prepared statem
274268

275269
### JDBC execution options
276270

277-
The SQL DML statements are executed in batches, which can optionally be configured with the following instance (see also {{< javadoc name="JdbcExecutionOptions javadoc" file="org/apache/flink/connector/jdbc/JdbcExecutionOptions.html" >}})
271+
The SQL DML statements are executed in batches, which can optionally be configured with the following instance:
278272

279273
{{< tabs "4ab65f13-607a-411a-8d24-e709f512ed6k" >}}
280274
{{< tab "Java" >}}
281275
```java
282276
JdbcExecutionOptions.builder()
283277
.withBatchIntervalMs(200) // optional: default = 0, meaning no time-based execution is done
284278
.withBatchSize(1000) // optional: default = 5000 values
285-
.withMaxRetries(5) // optional: default = 3
286-
.build();
279+
.withMaxRetries(5) // optional: default = 3
280+
.build();
287281
```
288282
{{< /tab >}}
289283
{{< tab "Python" >}}
@@ -300,13 +294,12 @@ JdbcExecutionOptions.builder() \
300294
A JDBC batch is executed as soon as one of the following conditions is true:
301295

302296
* the configured batch interval time is elapsed
303-
* the maximum batch size is reached
297+
* the maximum batch size is reached
304298
* a Flink checkpoint has started
305299

306300
### JDBC connection parameters
307301

308-
The connection to the database is configured with a `JdbcConnectionOptions` instance.
309-
Please see {{< javadoc name="JdbcConnectionOptions javadoc" file="org/apache/flink/connector/jdbc/JdbcConnectionOptions.html" >}} for details
302+
The connection to the database is configured with a `JdbcConnectionOptions` instance.
310303

311304
### Full example
312305

@@ -397,14 +390,14 @@ env.execute()
397390

398391
## `JdbcSink.exactlyOnceSink`
399392

400-
Since 1.13, Flink JDBC sink supports exactly-once mode.
401-
The implementation relies on the JDBC driver support of XA
393+
Since 1.13, Flink JDBC sink supports exactly-once mode.
394+
The implementation relies on the JDBC driver support of XA
402395
[standard](https://pubs.opengroup.org/onlinepubs/009680699/toc.pdf).
403396
Most drivers support XA if the database also supports XA (so the driver is usually the same).
404397

405398
To use it, create a sink using `exactlyOnceSink()` method as above and additionally provide:
406-
- {{< javadoc name="exactly-once options" file="org/apache/flink/connector/jdbc/JdbcExactlyOnceOptions.html" >}}
407-
- {{< javadoc name="execution options" file="org/apache/flink/connector/jdbc/JdbcExecutionOptions.html" >}}
399+
- `JdbcExactlyOnceOptions`
400+
- `JdbcExecutionOptions`
408401
- [XA DataSource](https://docs.oracle.com/javase/8/docs/api/javax/sql/XADataSource.html) Supplier
409402

410403
For example:
@@ -415,7 +408,8 @@ For example:
415408
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
416409
env
417410
.fromElements(...)
418-
.addSink(JdbcSink.exactlyOnceSink(
411+
.addSink(
412+
JdbcSink.exactlyOnceSink(
419413
"insert into books (id, title, author, price, qty) values (?,?,?,?,?)",
420414
(ps, t) -> {
421415
ps.setInt(1, t.id);
@@ -430,11 +424,11 @@ env
430424
JdbcExactlyOnceOptions.defaults(),
431425
() -> {
432426
// create a driver-specific XA DataSource
433-
// The following example is for derby
427+
// The following example is for derby
434428
EmbeddedXADataSource ds = new EmbeddedXADataSource();
435429
ds.setDatabaseName("my_db");
436430
return ds;
437-
});
431+
}));
438432
env.execute();
439433
```
440434
{{< /tab >}}
@@ -452,8 +446,8 @@ In such cases, please use the following API to construct `JdbcExactlyOnceOptions
452446
{{< tab "Java" >}}
453447
```java
454448
JdbcExactlyOnceOptions.builder()
455-
.withTransactionPerConnection(true)
456-
.build();
449+
.withTransactionPerConnection(true)
450+
.build();
457451
```
458452
{{< /tab >}}
459453
{{< tab "Python" >}}

docs/content/docs/connectors/datastream/jdbc.md

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ Please consult your database documentation on how to add the corresponding drive
4040

4141
## JDBC Source
4242

43-
Configuration goes as follow (see also {{< javadoc file="org/apache/flink/connector/jdbc/source/JdbcSource.html" name="JdbcSource javadoc" >}}
44-
and {{< javadoc file="org/apache/flink/connector/jdbc/source/JdbcSourceBuilder.html" name="JdbcSourceBuilder javadoc" >}}).
45-
4643
### Usage
4744

4845
{{< tabs "4ab65f13-607a-411a-8d24-e709f701cd41" >}}
@@ -128,7 +125,6 @@ ResultExtractor resultExtractor = new ResultExtractor() {
128125
### JdbcParameterValuesProvider
129126

130127
A provider to provide parameters in sql to fulfill actual value in the corresponding placeholders, which is in the form of two-dimension array.
131-
See {{< javadoc file="org/apache/flink/connector/jdbc/split/JdbcParameterValuesProvider.html" name="JdbcParameterValuesProvider javadoc" >}} for more details.
132128

133129
```java
134130

@@ -178,8 +174,6 @@ jdbcSourceBuilder =
178174
JdbcSource source = jdbcSourceBuilder.build();
179175
```
180176

181-
See {{< javadoc file="org/apache/flink/connector/jdbc/utils/ContinuousUnBoundingSettings.html" name="ContinuousUnBoundingSettings javadoc" >}} for more details.
182-
183177
### Full example
184178

185179
{{< tabs "4ab65f13-608a-411a-8d24-e303f348ds81" >}}
@@ -214,7 +208,7 @@ public class JdbcSourceExample {
214208
new Book(
215209
resultSet.getLong("id"),
216210
resultSet.getString("title")))
217-
.build();
211+
.build();
218212
env.fromSource(jdbcSource, WatermarkStrategy.noWatermarks(), "TestSource")
219213
.addSink(new DiscardingSink());
220214
env.execute();
@@ -233,7 +227,7 @@ Still not supported in Python API.
233227

234228
The JDBC sink provides at-least-once guarantee.
235229
Effectively though, exactly-once can be achieved by crafting upsert SQL statements or idempotent SQL updates.
236-
Configuration goes as follow (see also {{< javadoc file="org/apache/flink/connector/jdbc/JdbcSink.html" name="JdbcSink javadoc" >}}).
230+
Configuration goes as follows:
237231

238232
{{< tabs "4ab65f13-607a-411a-8d24-e709f701cd4c" >}}
239233
{{< tab "Java" >}}
@@ -274,16 +268,16 @@ It then repeatedly calls a user-provided function to update that prepared statem
274268

275269
### JDBC execution options
276270

277-
The SQL DML statements are executed in batches, which can optionally be configured with the following instance (see also {{< javadoc name="JdbcExecutionOptions javadoc" file="org/apache/flink/connector/jdbc/JdbcExecutionOptions.html" >}})
271+
The SQL DML statements are executed in batches, which can optionally be configured with the following instance:
278272

279273
{{< tabs "4ab65f13-607a-411a-8d24-e709f512ed6k" >}}
280274
{{< tab "Java" >}}
281275
```java
282276
JdbcExecutionOptions.builder()
283277
.withBatchIntervalMs(200) // optional: default = 0, meaning no time-based execution is done
284278
.withBatchSize(1000) // optional: default = 5000 values
285-
.withMaxRetries(5) // optional: default = 3
286-
.build();
279+
.withMaxRetries(5) // optional: default = 3
280+
.build();
287281
```
288282
{{< /tab >}}
289283
{{< tab "Python" >}}
@@ -300,13 +294,12 @@ JdbcExecutionOptions.builder() \
300294
A JDBC batch is executed as soon as one of the following conditions is true:
301295

302296
* the configured batch interval time is elapsed
303-
* the maximum batch size is reached
297+
* the maximum batch size is reached
304298
* a Flink checkpoint has started
305299

306300
### JDBC connection parameters
307301

308-
The connection to the database is configured with a `JdbcConnectionOptions` instance.
309-
Please see {{< javadoc name="JdbcConnectionOptions javadoc" file="org/apache/flink/connector/jdbc/JdbcConnectionOptions.html" >}} for details
302+
The connection to the database is configured with a `JdbcConnectionOptions` instance.
310303

311304
### Full example
312305

@@ -397,14 +390,14 @@ env.execute()
397390

398391
## `JdbcSink.exactlyOnceSink`
399392

400-
Since 1.13, Flink JDBC sink supports exactly-once mode.
401-
The implementation relies on the JDBC driver support of XA
393+
Since 1.13, Flink JDBC sink supports exactly-once mode.
394+
The implementation relies on the JDBC driver support of XA
402395
[standard](https://pubs.opengroup.org/onlinepubs/009680699/toc.pdf).
403396
Most drivers support XA if the database also supports XA (so the driver is usually the same).
404397

405398
To use it, create a sink using `exactlyOnceSink()` method as above and additionally provide:
406-
- {{< javadoc name="exactly-once options" file="org/apache/flink/connector/jdbc/JdbcExactlyOnceOptions.html" >}}
407-
- {{< javadoc name="execution options" file="org/apache/flink/connector/jdbc/JdbcExecutionOptions.html" >}}
399+
- `JdbcExactlyOnceOptions`
400+
- `JdbcExecutionOptions`
408401
- [XA DataSource](https://docs.oracle.com/javase/8/docs/api/javax/sql/XADataSource.html) Supplier
409402

410403
For example:
@@ -430,7 +423,7 @@ env
430423
JdbcExactlyOnceOptions.defaults(),
431424
() -> {
432425
// create a driver-specific XA DataSource
433-
// The following example is for derby
426+
// The following example is for derby
434427
EmbeddedXADataSource ds = new EmbeddedXADataSource();
435428
ds.setDatabaseName("my_db");
436429
return ds;
@@ -452,8 +445,8 @@ In such cases, please use the following API to construct `JdbcExactlyOnceOptions
452445
{{< tab "Java" >}}
453446
```java
454447
JdbcExactlyOnceOptions.builder()
455-
.withTransactionPerConnection(true)
456-
.build();
448+
.withTransactionPerConnection(true)
449+
.build();
457450
```
458451
{{< /tab >}}
459452
{{< tab "Python" >}}

0 commit comments

Comments
 (0)