We are having an application which is already developed(Very OLD application,That time ORM was not in Market) and use Oracle as a database using JDBC. Now we are in situation where we have to connect different database like Postgres. We can not use ORM or such tool at this stage when application is completely developed. Is there any way so that we can provide multiple db support for our application using JDBC.
You can create multiple Datasource connections using the Apache commons DBCP package.
If you have a Spring Application you can easily have this configured in your spring application context.
http://javarevisited.blogspot.in/2012/06/jdbc-database-connection-pool-in-spring.html
Connection Pooling with Apache DBCP
Or you can have them defined as JNDI in your web server like JBOSS
Related
I have some on-premise based frontend java servlet server, on-premise Java backend app server and one on-premise oracle database server. My Oracle client version is 12.1.0 . Java version is openjdk "1.8.0_222" . And using tomcat v7.0.55 for frontend servlets. The Architecture is like the backend server communicate with Oracle DB to process SQL queries.
Now I moved all my servers to AWS cloud docker based containers except Oracle DB. And my Java backend server is running on AWS docker is connecting to Oracle DB running in on-premise Datacenter.
Now I am facing an issue where the AWS based application having latency when it connects to on-premise database and the latency keeps increasing as the number of requests grows and eventually the application gets gateway timeout if the requests are keep on increasing. But strangely it will not happen if I connect my AWS tomcat frontend servers to on-premise java backend servers which talks to on-premise Oracle DB. it only happens when the AWS Java backend servers talks to on-premise Oracle DB. I am not sure why this is happening. Any ideas will be highly appreciated.
The issue is related to the DAO / ORM framework we using. If you use something like Hibernate , Spring it will work in a way where SQL calls are not optimized with join statements. So to fetch a 1000 objects there will be 1000+ SQL calls. So if there is a single digit millisecond latency in the network to Database it will boot to 1000 times delay time. So the solution was to keep Database as close as possible with the application.
I have configured Activiti on Servicemix 5.1.1 and got it working with Camel. I need to configure Activiti to use SQL Server instead of the default inbuilt H2 which comes with servicemix for Activiti during feature installation. I am not finding any config files related to activiti to change the DB credentials either.
Any help on how to configure the Activiti DB with Servicemix is highly appreciated.
There's no easy way to configuring another database at the moment. The solution would be to create a Blueprint XML file like the one we're using internally (cfr. https://github.com/apache/servicemix/blob/master/activiti/activiti-config/src/main/resources/OSGI-INF/blueprint/activiti-config.xml - you may have to remove the custom resolver bits), modify it to point to your SQL server and drop it in ServiceMix' deploy directory.
FWIW, I created https://issues.apache.org/jira/browse/SM-2379 to provide a more convenient way to define a new database.
In our development team we have:
4 developers
one application uses PHP and database Microsoft SQL Server 2008r2, except one using PowerBuilder instead of PHP and one using MySql instead of Microsoft SQL Server
All applications are database-centered, some of them are for general public, some are not.
Question is: for the procedures and functions shared by all applications, what does it make most sense to use, database procedures/functions or web services?
We could not find an agreement within the team.
Whatever you answer, please explain the reasons.
Webservices and Database Proc/Functions are two entirely different things.
Webservices are the services over the web, mainly used when a client and a server interact and client interacts with the server through web or HTTP or any other protocol.
Database proc/func - are created to interact with a login to a DB server.
In your case, if all the application are in the same domain... then you dont need to access through webservices and also it is a lot of overhead.
You can create a common DB server , where you can keep these proc/func and can be consumed by all.
I want to use CF as an app container but as CF doesn't provide an Oracle DB service I have to use an external Oracle DB. Can my Java app that runs on CF infrastructure connect to an external Oracle DB that is located on another server using JDBC?
In Google App Engine you can't use JDBC at all.
you should be able to. The only outbound port that is block from CloudFoundry.com I believe, is port 25 (for obvious reasons).
Do any of the existing open source databases have the ability to expose a database as a web service on a server port? I'm looking for something like Microsoft SQL Servers ability to expose a wsdl web service URL .
If not, I guess i will use SQL Server Developer Edition...
CouchDb is built around HTTP, with all actions being http methods. This makes the database easy to access from a variety of platforms and languages.
However, you can create a web server for any databases, for the given app with varying degrees of flexibility.
You can do it with any database connected to a JBI like openEsb if you use a binding component like DatabaseBC
this is a good screencast on how generating a WSDL from an SQL file ... for more details you can look at this tutorial ...