How to configure GlassFish connection pool in order to work with multiple Databases? - glassfish

Well, My WebApp uses several databases and I'm trying to use GlassFish connection pool to manage the connections, but I've found configuration examples that use only one database.
So, what should I do? Create as many connection pools as databases I'm using or is there a way to configure a pool with multiple databases?

A connection pool connects to only one database (or cluster), so if you need access to different data stores you will need to set up several connection pools. One for each data store.

Related

Keep ActiveMQ running when losing connection to database

I have an instance of ActiveMQ 5.16.4 running that is using MySQL as a persistent data storage. Recently the MySQL server had some issues, and ActiveMQ lost its connection to MySQL. That caused multiple Spring microservices to throw errors because ActiveMQ wasn't working.
Is it possible to have master/slave ActiveMQ running where master and slave uses separate persistence storage?
I have done some research and found "pure master slave", but it says that it is deprecated and not recommend to use and will be removed in 5.8. It says to use shared storage which I am trying to avoid (cause my problem is what if storage itself is down).
What are my options to keep running ActiveMQ if it loses connection to database?
If you're using ActiveMQ "Classic" (i.e. 5.x) then your only option is to use shared storage between the master and the slave. This could be a shared file system or a relational database. This, of course, is a single point of failure.
However, there are both file system and database technologies that can mitigate this risk. For example you could use a replicated file system (e.g. Ceph or GlusterFS) or a replicated database (e.g. MySQL).
You might also consider using ActiveMQ Artemis (i.e. the next-generation broker from ActiveMQ) which supports replication natively.

Database datasource binding for multiple app and instance

We use a single mysql database for 2 applications. One of this application has 2 instances.
So we would like to know how cloudbees manage the connexion pool between all these apps. I saw in other threads that mysql default conf on cloudbees accept 20 connections. For the moment, we use "old" hibernate configuration with explicite c3p0 but we thought that they could try to open too much connexions on the db.
If we change the conf to use jndi cloudbees datasource (as describ here https://developer.cloudbees.com/bin/view/RUN/DatabaseGuide), should our apps share the same connection pool ? Or at least all instances of each app ?
Hope it's understandable. Let me know if not.
Thanks for your help,
Each instance of the app has its own connection pool - so you need to consider that in sizing the pool.

multiple clients silmuntaneously on sesame repository

i use sesame for a project and i use a local nativestore file repository. everything is fine but when multiple clients use my application silmuntaneusly the repository locks.How can i deal with parallel connections problem;
A Sesame Native Store assumes it has sole, unique access to its datadir. This means that you can not create two NativeStore objects that use the same datadir, as this will cause inconsistencies and potential deadlocks. So, you need to share a single NativeStore object.
In a single JRE, this can be easily achieved by using a RepositoryManager. See this article for an explanation and code examples. If your setup requires several independent client applications to connect to Sesame, you will either have to implement your own server app for these clients to connect to, or you can use a Sesame Server and have each client connect via a HTTPRepository.

Connection sharing in JCA glassfish

I have a misunderstanding regarding the connection handle sharing in JCA.
I want to know if the connection sharing only happens during a phase of transaction ( multiple components call ) or the connection sharing is possible amongst multiple clients accessing a component that has the same EIS destination.
I created my own resource adapter on Glassfish application server 3.1. The problem is the resource adapter doesn't perform any connection sharing (no associateConnection method call).
Thanks,

Connection pool for per application server instead of per application

I would like to replace glassfish connection pool with another connection pool implementation in order to create more dynamic configurations. I have a lot application at the same server. I do not want to create a connection pool for each application because of the connection count can be dramatically increase by the application count. What is the best way in order to provide a common application pool for the application server. Maybe as a side note I am using Spring and BoneCP will be used as a connection pool replacement.
Thanks
I'm not sure if you can exchange the internal connection pool of an application server. It sounds like exchanging some internals that aren't meant to be exchanged. However you can just ignore the application server connection pool and use your own connection pool.
One of my colleages was using DBCP in his projects so that the testcases can be run without an JNDI connection. He just initiated the connections directy with his spring context through dbcp.
The downside with this solution is that you will loose the central application server configuration facility.