Our Company working on a web App in java that combining with spring framework. For database side of application we use hibernate and our database is postgresql. I am on of developers and recently I have this strange problem only on my computer. retrieving data from database in our web application is so slow. there is not any common problem about slow query because when I run a query inside the database directly by postgresql query tools , there is not any slow retrieving problem.even I used one of my coworker's system as a database server.so the web application deployed inside my computer and the database server was inside another computer and strangely I had no speed problem. The data retrieved from database through web application was very fast!!! What's going wrong? is there a problem about my hard?
Related
I am using the Azure web app with PHP 7.3 stack. In my project, we have the feature to sync from mobile to web and for that, we are using the SQLite file. And for other modules, we have a MySQL database.
The mobile app sends the SQLite file and we stored it in the directory. But we try to make a query to the SQLite with PDO then it throws the error that the database is locked.
I tried many solutions from the other's answer but not get success.
This has to do with permissions of the underlying storage mount.
One option you could try is mounting an Azure File share and persisting the database there, see https://learn.microsoft.com/answers/answers/320889/view.html. The best option however is to utilize a cloud database such as Postgres or MySQL for Azure.
I have a Java Spring project which does a lot of database reading. The database I have available is a shared postgresql database on a remote machine and it's quite slow to get data from it, especially when I'm doing a lot of back-and-forth.
When I'm doing local testing and development, I use the embedded H2 in-memory database. Things easily go 100 times faster.
This made me wonder. Is there a way to use the embedded H2 in-memory database so that:
Data manipulation (INSERT, UPDATE, DELETE) is ("eventually") replicated to the PostgreSQL database
Upon start/restart of the Spring project, the H2 database is automatically filled with the data of the PostgreSQL server
This would allow me to use the fast H2 to provide a seamless user experience while at the same time also storing the data in a longer-term data storage. In a way, I'd be using the H2 as a fully cached version of the PostgreSQL database.
Is there a known / standardized way to approach this? Google for H2 and PostgreSQL and replication gives me results on transitioning from one to the other, but I'm not finding much as to using one as a sort of cache for the other.
I remain on the lookout for a Spring / JPA / Hibernate focused answer, but if none comes: I may have found an alternative domain to investigate. Dedicated database replication software might be able to manage this. Specifically, I've discovered SymmetricDS, which seems (I've only given the documentation a cursory glance) like it might be able to be embedded into my Spring application, do an initial load of my embedded in-memory H2 database on startup and then trickle feed data changes to the remote database.
(I'm not in any way affiliated with SymmetricDS, it just looks like it might be a solution.)
I am developing java applications which connect to Oracle databases. Application loads some amount of data on startup. Because of slow connection to TEST environment, applications start up take some time.
I am looking if there is some proxy/cache tool, which would locally store results for every query. So it could load result from memory if query was already called, instead of calling DB again. This could save a lot of time.
I guess ProxySQL does something similar but it is targeted for MySQL. Is there something for Oracle DB ?
Check out the Oracle Client Result Cache. It works with the JDBC OCI driver.
https://docs.oracle.com/database/121/TGDBA/tune_result_cache.htm#TGDBA626
We have multiple oracle schema which we want to import in to somekind of inmemory db so that when we run our integration test we can use that db and run our tests faster.
Is there anyway we this can be achieved using something like HSQL db. We are using spring framework and it does support inmemory db.
Any link to some resource would be highly appreciated.
Try force full database caching mode, if you're using 12.1.0.2. It's not exactly the same as a full in-memory database, but it should be closer.
alter database force full database caching;
In-memory database performance is over-rated anyway. Oracle's "old-fashioned" asynchronous IO and caching often work just fine. For example, in this question, accessing a temporary table (which is stored on disk) runs faster than an equivalent solution using in-memory data structures. And I've seen a small Oracle database handle petabytes of IO with the "boring" old buffer cache.
Or when you say "run our tests faster", are you referring to a more agile database; one that can be controlled by an individual, instead of the typical monolithic Oracle database installed on a server? I see that issue a lot, and there's no technical reason why Oracle can't be installed on your desktop. But that can be a tough cultural battle.
Yes, you can use HSQLDB for the purpose of unit testing - see this post for more information on how to integrate with Spring.
Also, see this list as a good starting point for different usages of HSQLDB.
I have to load two Derby instances that reference same data Derby file in a remote repository.
Is it possible? How can I achieve this? Would you give detailed information?
Two different connections in the same Derby app is ok because Derby uses Java synchronization features to coordinate their access to the db.
Two different apps cannot use Java synchronization because that only works inside a single Jvm class loader so instead Derby locks the db and only allows one app at a time to access the db.
That is the benefit of the Derby network server because many apps can access the db simultaneously via the network server.
There is a hybrid mode by which one embedded app can also serve as the network server for other apps but it is complex and usually not the best choice.
Update: You can find more information about embedded servers in these docs: http://db.apache.org/derby/docs/10.11/adminguide/cadminov825149.html and http://db.apache.org/derby/docs/10.11/adminguide/radminembeddedserverex.html
or by searching the Internet for "Derby embedded server".