How to load balance in database using JDBC? - jdbc

My Application uses below JDBC URL in domain configuration, but now all the load goes only to localhost1 server, now I wanted to pass the load between these 2 servers on round robin basis. How can I do that?
jdbc:mysql://localhost1:3306/pro?autoReconnect=true|jdbc:mysql://localhost2:3310/pro?autoReconnect=true

Related

Share Oracle database pool along subsites on the same Applicacion Pool on IIS 7

I'm having a problem with Oracle pools and IIS 7. I've written two webservices and deployed them as subsites on the same virtual folder both using the same applicacion pool. Both services use an Oracle pool (configured inside their Web.config using the same connection string) that stablish 10 as the minimun connections per pool.
As I understood it, both webservice should use the same database pool as they are running on the same Application pool, but I find that this is not the case.
I launched a request on the first webservice and (using v$session view) I see that 10 sessions are created (the correct minimun size of the pool). Nevertheless, when I launch a request to the other webservice, another 10 connections are created. So, it seems each webservice has its own database pool.
I tried to send more requests to the webservices and the connections do not grow (as expected).
How could I share the same Oracle database pool along all the subsites running on the same Applicacion Pool?
Thanks in advance
This is more like an iis problem.
But you could use a database resident connection pool for this. That can be shared across applications.
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/jjdbc/database-resident-connection-pooling.html#GUID-D4F9DBD7-7DC6-4233-B831-933809173E39

Fix HTTP 504: Gateway Timeout when not using a load balancer

I am developing an application which allows the user to download data from this remote database server. My server sode contacts another database server, get&package all the data, and send the data back to the client side. Everything works fine locally. However, when I deploy my code to AWS Elastic Beanstalk, I get a HTTP 504: Gateway Timeout, if my request doesn't get a respond in 60 seconds (when the data is too large and it takes more time to get all the data).
I have looked up a lot of posts online, but most solutions had to do with using a load balancer. I am not currently using a load balancer, and I am not really sure how to proceed with my issue. I know what I have to do is to change the timeout/idle limit, but I can't seem to find a resource that gives me insight on how to do that when I am not using a load balancer.
To give a main idea of how the project is built, it is written in ReactJS and Java, and it connects to a remote database server to request data. I am not using CORS/proxy, but using the Java backend code to have my server contacting the database server when I request for data. I am also using annotations in Spring framework for my requests (and more specifically, the controller class).
If you have any ideas on how to solve this issue, please let me know. I really don't know much about web application development. Thanks in advance!

How can I allow an external application to connect directly to my Ruby on Rails-integrated PostgreSQL database?

I have one database, and several applications that need to use it (one Ruby on Rails app, with which the database is integrated by default, and a bunch of Minecraft servers running Java plugins). Right now, I am using my web application's REST api to access the database.
So: plugin -> api -> db -> api -> plugin
I am looking for a way for my plugins to access the database directly, without having to first go through the web application.
plugin -> db -> plugin
How can I allow an external application to access my database? How can I ensure that only certain applications are allowed to access the db? (Also: SHOULD I be doing this at all?)
Take a look into how ActiveRecord connects to the database, and you'll see that it simply uses the same way to connect to Postgres (a login connection string, or set of credentials, etc.), and that same method can be used by any other application.
Basically this means that if another application knows:
The URL or IP address where your DB is hosted
The username
The password
The port
... and there are no restrictions in place such as firewall rules that prevent access, then the application should be able to talk to the DB directly. ActiveRecord is basically just a software layer on top of the DB, but it doesn't "own" or "control" the database. Your Rails app is technically a client of the DB server.

wso2 session timeout with multiple products on same server

I have followed the below article and installed 3 products on same server i.e AS, ESB, BAM
Monitoring a Web Service via ESB, Analyzing and Visualizing Results using Business Activity Monitor
Now the problem occurred when I tried to access ESB and BAM from same browser it is continuously redirecting me to login page, seems session timeout problem or may be same cookies creating that issue.
How can I resolve this issue?
If you use localhost or same host name for all the products, given time you can access only one UI. So you can assign different host names for each product by modifying the hosts file.

Spring framework, java remoting and user session

I have 3 tomcat servers
All my applications are deployed as WARs
The first one is a web server which use remote object by http invoker from server 2
Server 2 is using remote object with http invoker from server 3
I would like to use spring security on server 2 and 3.
I need to know under which user session the remote method was called
I was thinking on creating a session on each of the servers but I do not know how to do this?
Even if I can replicate the session to all servers how do I tell server 2 that user X called some remote method?
Well..We use Spring Security on our project. We use 3 Tomcat servers which are under a cluster. We use Sticky session on our LB so that, once the session form between the LB and a Node, the subsequent requests goes to that same node.
I suggest you to put the 3 TOmcat servers under on cluster(its quite easy) and maintain sticky session btw your LB and all nodes.

Resources