I would develop an Spring boot application compliant with new feature Webflux.
Does an driver JDBC for Mysql exist?
I found just driver for some NoSql DB (for ex. MongoDB).
Could you help me?
Thanks, regards.
UPDATE:
On official site of R2DBC project there is the drivers list: https://r2dbc.io/
Actually there isn't any reactive support for relational database. But not for long time since the Spring Data team is working on R2DBC, which will provide the ability to access data reactively from a relational database. Stay tuned here: https://github.com/r2dbc
EDIT
The first release is out, see here for more details: https://github.com/r2dbc/r2dbc-postgresql/tags
An asynchronous driver for MySQL exists and it's called jasync-sql:
https://github.com/jasync-sql/jasync-sql
No there is no reactive driver for MySQl. There is one for Postgres:
https://github.com/r2dbc/r2dbc-client
it uses all the reactive bits from project rector (collections are return as flux). Of Course you are back to working with prepared statements. And pulling data directly from the Serch reasult.
And the one for the oracle DB:
https://github.com/oracle/oracle-db-examples/tree/master/java/AoJ
But it uses a blocking JDBC calls and only hides the problem of behind thread pool. However it represent the current effort at Oracle to attack the problem. And it is not a trivial thing as there is a certain philosophy when working with relational databases of consistent state. That is why your query result is return all at once unlike mongodb that can return result as it comes in.
Because of that any ORM (hibernate, eclipselink) tooling is nowhere.
I think for production code we are stuck with blocking calls for now.
Related
Working on a JAX-RS application which uses Microsoft-SQL-Server as a Database.
It does not use any ORM frameworks, just plain old JDBC.
Most of the application's operations involve store and retrieve data as XML into DB tables.
I have a use case where I have to run this application offline. So there wont be any connection available to DB SQL-Server.
Whilst looking into my options thought I would embed the DB and ship with the application EAR.
Looking into options I learned that, SQL-Server-Compact does not have a proper JDBC driver.
Is there any other In-Memory DB that could serve my purpose?
I want avoid any code changes like: changing the SQL queries (written specifically for Microsoft-SQL-Server).
Is there any solution which I can use and ship my application just by changing the DataSource to embedded DB?
note: I could not find any useful post on stackoverflow for this query, If it's already been discussed. Please point me to the post and I will delete this duplicate question.
Background: I am working on a web application, which uses oracle jdbc and access database with java code and also sql queries which will be executed by our engine.
Now I am thinking about "replacing" jdbc over the time with hibernate t have -let's say - hibernate advantages.
My question is, can this be done step by step?
Can I start to create new tables with hibernate and work with hibernate without having risk with the existing database structure? can hibernate works in parallel with jdbc?
The answer is positive.
You can have both jdbc and hibernate data-sources in the same project, no problem.
Just be careful not to mix up those two data-sources, that's all.
Yes, JDBC and hibernate both can be used in parallel.
However, it depends on use cases. As per your question you just want to "replace" JDBC with Hibernate.
So, yes in this case you can start with :
creating new tables
creating hibernate mapping files
creating DAO layer
implementing hibernate code.
I am starting with a new project and currently evaluating whether to use JPA or JDBC. Our operations mostly are going to be an bulk-insert and bulk-read and very rarely single insert/read.
I checked a prototype with JPA and JDBC and realized that both has its own merits and limitations.
Considering the current use case that for a fact I will only have always a bulk read and bulk write, which one will be a better option to go with ?
Spring JPA Repository gives a simple method save(Collection) which can take a collection and save as well.
Also Validations are also not be considered here, as the payload will already be validated in the layers above and the database layer should just do the read/write operations.
Does the JPA save(Collection<>) method in turn uses the jdbc templates or is it entirely a different implementation ?
Thanks in advance !
We use both JPA and JDBC in one application wiht no problem. Preferably we use JPA/JPQL and fall back to JDBC if needed. For JPA we use Spring Data JPA and for JDBC Spring JDBC Template.
I have an Oracle database that runs a PL/SQl job once every week to copy data from a table in the Oracle database to another Oracle database using Oracle database links. Both systems run on Unix/Solaris. The job is scheduled and executed via the Unix Cron facility.
The remote machine is now being migrated from UNIX to a Windows platform with a MSQL Server database. I have been looking into the possibility of using Oracle database links to connect from UNIX to the MSSQL Server database which will be running on a Windows platform. It is possible but it looks to me like there is a lot of fiddling around to get it to work and there is not a lot of information on how to implement it.
The other solution i am thinking of is to implement the process as a Java daemon process that will run every week. All it will do is connect to the Oracle database read data from some tables, connect to the MSSQL Server database and run some insert commands. I think i will need two kind of drivers for this - i.e. jdbc for Oracle and jdbc for MSSQL Server.
Does Spring provide any facility that will make the above easier to implement and or maintain? (Specifically the multiple drivers and the scheduling part of the requirements)
Is Hibernate suitable for managing the multiple database connections or is that overkill?
Feel free to also suggest a better solution :)
Thanks
Spring has extensive support for scheduling tasks.
Running queries against multiple databases via different drivers is a basic JDBC feature; Spring is not really relevant there - unless you want it to happen in a single (distributed) transaction. Spring does support those via JTA and XA.
This sounds like a perfect application for Spring Batch
You should check these Pages to see what it's about:
Features
Use Cases
Spring Batch will happily accept different datasources with different drivers, but you will probably have to provide some RowMapper objects to create interim Objects.
I am creating a web application that is accessing a SQLite database in the server. I also have "clients" that updates this same database. As we know SQLite locks the entire database during INSERTs which are done by the clients and the web application is also trying to make some UPDATEs at the same time. So my problem now is about concurrency in database access. I would like to use an embeddable database like SQLite. Any suggestions.
H2 database the new thing from the creator of Hypersonic SQL: H2 stands for Hypersonic 2, however H2 does not share code with Hypersonic SQL or HSQLDB. H2 is built from scratch.
HSQLDB
If you value convenience over raw performance the database bundled with Java 6, JavaDB/Derby, may work well for you. It offers row-level locking and has it enabled by default.
You've got to the point where I would be switching to using a separate database server. The SQLite wiki has a page on when to use SQLite and when not; highly concurrent writes are one of the times when you're beyond its architecture (which deliberately doesn't handle this case well so it can do better at others).
PostgreSQL and MySQL are probably your first ports of call.
Try Oracle's Berkeley DB.
Thought about MySQL? We're using it in our application an it works great.