File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
sample/src/main/java/oracle/r2dbc/samples Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -70,5 +70,24 @@ public static void main(String[] args) {
7070 .concatWith (Mono .from (connection .close ()).cast (String .class )))
7171 .toStream ()
7272 .forEach (System .out ::println );
73+
74+ // A descriptor may also be specified as the value of
75+ // ConnectionFactoryOptions.HOST
76+ Mono .from (ConnectionFactories .get (ConnectionFactoryOptions .builder ()
77+ .option (ConnectionFactoryOptions .DRIVER , "oracle" )
78+ .option (ConnectionFactoryOptions .HOST , DESCRIPTOR )
79+ .option (ConnectionFactoryOptions .USER , USER )
80+ .option (ConnectionFactoryOptions .PASSWORD , PASSWORD )
81+ .build ())
82+ .create ())
83+ .flatMapMany (connection ->
84+ Mono .from (connection .createStatement (
85+ "SELECT 'Connected with TNS descriptor' FROM sys.dual" )
86+ .execute ())
87+ .flatMapMany (result ->
88+ result .map ((row , metadata ) -> row .get (0 , String .class )))
89+ .concatWith (Mono .from (connection .close ()).cast (String .class )))
90+ .toStream ()
91+ .forEach (System .out ::println );
7392 }
7493}
You can’t perform that action at this time.
0 commit comments