Is there any reactive jdbc driver support for Oracle database compatible with spring boot 2 version? I want to use it in production environment.
The upcoming DB 20c release of the Oracle JDBC drivers has the built-in extensions.
We are working on Reactive extensions for the Oracle JDBC driver that uses java.util.concurrent.Flow and Reactive streams. However, this is available in our next release.
The Reactive extensions to the Oracle JDBC driver will work with all Reactive Streams libraries including Reactor, RxJava, Akka Streams and others.
Related
Which one should I use for a modern backend Java application using Oracle OLTP database as a datasource?
To me HikariCP looks like a de-facto standard pool for a modern Java application. But now I need to maintain some project from the past, which is currently stuck at Oracle drivers v11 and using UCP. I am wondering now: does Oracle's UCP have any advantages over HikariCP? Would you use UCP or HikariCP?
Fresh Spring Boot project generated at start.spring.io will use HikariCP by default (Even though since 2.4 there is a support for UPC), until you explicitly enforce UCP in application.properties:
spring.datasource.type=oracle.ucp.jdbc.PoolDataSource
The Spring Boot docs say:
1. We prefer HikariCP for its performance and concurrency. If HikariCP is available, we always choose it.
...
4. If none of HikariCP, Tomcat, and DBCP2 are available and if Oracle UCP is available, we use it.
The Oracle website contains tutorials (1, 2) on how to use UCP with Spring Boot, but not explaining any advantages of such setup. I found an old StackOverflow answer mentioning some "non-blocking architecture", but I am still not sure if it makes UCP more valuable or reliable than HikariCP.
The Oracle UCP pool has a lot more features than HikariCP: "labelling" allows you to label special connections for later reuse, "request boundaries" is a new standard in JDK9 that provides a hint to the driver when a connection is borrowed or released into the pool, diagnostics and observability MBean and a bunch of integrated features that are specific to the Oracle Database such as Application Continuity, RAC Failover, Sharding, etc.
UCP also performs really well. It undergoes performance evaluation on a regular basis and, because of its non-blocking infrastructure, can maintain a very large number of connections being shared by 1000s of threads.
Note that UCP has a very large community of users among the Oracle Database users in the cloud and on-prem.
I am new to reactive programming I have started using webflux, previously I work on spring boot there I have used hibernate as a ORM framework. My doubt is what is replace of hibernate in reactive stack , which framework I have to use to connect & implement database logic.
I am using mongoDB.
Thanks in advance.
you have to use either R2DBC or Hibernate reactive.
if you migrating an old service from spring boot to webflux, I recommended you to use Hibernate reactive.
when you use R2DBC, you can't use hibernate mappings and annotations.
according to hibernate reactive documentation:
When using a stateless session, you should be aware of the following additional limitations:
persistence operations never cascade to associated instances,
changes to #ManyToMany associations and #ElementCollections cannot be
made persistent, and
operations performed via a stateless session bypass callbacks.
Hibernate is based on JDBC. JDBC is blocking. Blocking APIs don't work well in reactive stacks. Also, Hibernate under the hood uses ThreadLocals which makes it even worse candidate for reactive applications.
For Webflux, as the alternative to Hibernate you should look into Spring Data R2DBC which does the basic database result to Java object mapping, but keep in mind that it's not a full fledge ORM like Hibernate.
You may also want to give it a try to Hibernate Reactive. With this you can use the power of Hibernate mappings in a reactive non blocking way. One thing that will not work though (at least not yet) is declarative transaction management with #Transactional.
It depends on what database driver you are using.
If using the jdbc driver to talk to your database, then yes you can use hibernate. But important to note is that the JDBC spec is blocking so every call to the database will be blocking, and must be placed on its own scheduler (thread) and you will most likely not get the full performance benefits of a fully reactive application.
If you want a fully reactive application you must use a database driver that supports the R2DBC protocol. Hibernate does not support R2DBC so can not be used if you want a fully reactive application.
Hibernate is most commonly used with relation database such as mysql, postgres, oracle etc and not NoSql databases such as monogDB.
If you are using MongoDB then there is full support for R2DBC and there is no need for hibernate.
Can Apache Camel output a jdbc interface instead of Java object maps?
I need to read from CouchdB AND output standard JDBC query results
I thought I could use Camel as the connector.
It can read CouchDB but apparently can not output standard JDBC objects to a client app.
Is there anyway Camel can output JDBC results?
I have a tool that needs a JDBC connection and a standard JDBC interface.
Do you mean you want the data from the database as a javax.sql.ResultSet or what kind of interface do you think about? The camel-couchdb component uses a Couch Java Client and not a JDBC driver, so you cannot do this with Camel.
But you can look at using a JDBC driver for CouchDB and not use Camel at all.
I have HSQL server 2.3.4 and I am trying to use hsql jdbc connectivity jar 2.2.9 to aceess the HSQL database but I am getting End of file exception.
The Servr is working pretty fine when I am using hsql jdbc connectivity jar 2.3.4 with hSQL Server 2.3.4.
Can somebody explain the reason for no backward compatibility
New features are introduced in each new version of the database engine. Sometimes the addition of new features requires changes to the network protocol used for exchanging data between the client and server. These changes break backward compatibility.
It is recommended to use jars of the same version on client and server.
I would like to know the benefits of configuring JDBC Driver in JBoss As a module than package JDBC driver in application in terms of
connection pool
data source
caching
distributed environment
Please enlighten this. Thanks.
Module datasources
are shareable across multiple applications.
integrate with all of the monitoring and management facilities of JBoss AS, such as the CLI and web console.
provide good integration with JBoss security domains.