|
27 | 27 | import io.r2dbc.spi.ConnectionFactoryMetadata;
|
28 | 28 | import io.r2dbc.spi.ConnectionMetadata;
|
29 | 29 | import io.r2dbc.spi.IsolationLevel;
|
| 30 | +import io.r2dbc.spi.R2dbcException; |
30 | 31 | import io.r2dbc.spi.Statement;
|
31 | 32 | import io.r2dbc.spi.ValidationDepth;
|
32 | 33 | import org.reactivestreams.Publisher;
|
|
38 | 39 | import java.util.concurrent.CompletionStage;
|
39 | 40 | import java.util.concurrent.atomic.AtomicReference;
|
40 | 41 |
|
| 42 | +import static oracle.r2dbc.DatabaseConfig.user; |
| 43 | + |
41 | 44 | /**
|
42 | 45 | * <p>
|
43 | 46 | * A {@link ConnectionFactory} which caches a single connection that is
|
@@ -176,9 +179,17 @@ private static Publisher<String> queryOpenCursors(Connection connection) {
|
176 | 179 | .execute())
|
177 | 180 | .flatMapMany(result ->
|
178 | 181 | result.map((row, metadata) ->
|
179 |
| - row.get("sql_text", String.class))); |
180 |
| - // Don't count the v$open_cursor query |
181 |
| - //.filter(); |
| 182 | + row.get("sql_text", String.class))) |
| 183 | + .onErrorMap(R2dbcException.class, r2dbcException -> |
| 184 | + // Handle ORA-00942 |
| 185 | + r2dbcException.getErrorCode() == 942 |
| 186 | + ? new RuntimeException( |
| 187 | + "V$OPEN_CUROSR is not accessible to the test user. " + |
| 188 | + "Grant access as SYSDBA with: " + |
| 189 | + "\"GRANT SELECT ON v_$open_cursor TO "+user()+"\", " + |
| 190 | + "or disable open cursor checks with: " + |
| 191 | + " -Doracle.r2bdc.disableCursorCloseVerification=true") |
| 192 | + : r2dbcException); |
182 | 193 | }
|
183 | 194 |
|
184 | 195 | /**
|
|
0 commit comments