Is This Possible?

I was wondering if it is possible to develop a web app that can pull data from multiple databases that use Java as their front?  If it is possible would it be also written in Java?

My supervisors want me to suggest something in a meeting that will basically combine multiple different programs we use which happen to all be Java based.  What I was thinking is a centralized program that can pull the data from all the other programs without having to manually open up each individual program.

Sorry for rambling but any input is greatly appreciated. Thanks!

yeah you can, though its not secure. Java is never.

All the applications I would want to pull data from are on our intranet and is not connected to the internet in anyway.  I don't think security would be an issue with that.

You have to specify what type of databases you are talking about. Are they mySQL based? Do they take input from a website or from a separate server? Is it a windows or a linux based server? Personally, if it is a windows server I recommend that C# is the way to go. Your supervisors must be the type of people that command others without having a glimpse of understanding. Java is not as secure as C# and most definitely not as advanced. If we're talking about an SQL database, C# Is highly optimized and can easily extract data to one or multiple sources.

 Some easily adjustable code aimed towards an SQL server with 3 data parameters on a local network.

Assuming the 3 fields are 'firstname' 'lastname' and 'age' just to give an example. You can change parameters around for your benefit.

C# for sure. Very clean language and easy for anyone coming behind you to get the hang of your coding method. tomporter_ has a nice clean framework there to start from. I am definately noy Java savy though so no idea on any possible hangups there.

Thanks for your inputs.  I can't see the link from work due to the firewall but I will check it out when I get home.  We are currently using a Reflection IBM terminal emulator that connects to the servers already but it is text based and some of our employees are a bit computer challenged.  I just think a GUI interface would make it a lot easier for them.  I'll see what kind of databases we are running.

Sometimes I get sick of the misinformation about Java that gets bandied about.  The security issues related to Java that people continually clamor about are related to Java Applets and Java Webstart.  The former no one really codes anymore, except mainly nefarious hackers.  Browser Applets are a relic from the late 90s, which were useful once upon a time, but are now obsolete.  Java Webstart is used a fair amount, but server side Java is where the vast majority of Java development is done— Android development would be second.  And server side Java does not suffer from the security related problems that were headlines last year.  Server side Java is what you would be using to build your web app.  I am not saying that there are absolutely no security vulnerabilities in Java server side code, but any security vulnerabilities would more than likely be caused by the server container, the container's configuration, or the configuration of the machine hosting the container and not Java itself.  And if a rogue hacker can directly access the machine hosting your sever side code, you have bigger problems than any potential security flaws in Java.

And remember, many of the largest web companies in the world widely use server side Java; Google, Facebook, and Twitter, just to name a few.  If Java were so vulnerable, it is doubtful they would use it.

To answer your questions, yes, you can have a Java web app access multiple databases, as long as there are JDBC drivers (or a Java driver for nosql databases) available for the databases you want to access.  MySQL, PostgreSQL, Oracle, Sybase, MongoDB, CouchDB, Cassandra, and Oracle NoSQL all have Java drivers available.

How you configure your web application to access your databases depends on what container you will be using.  Will you be using a simple WebApp container like Tomcat?  Will you be adding web functionality to a standalone Java App using Jetty?   Will you be using a full JEE container like Glassfish, JBoss, or WebLogic?  Or will you be using a lightweight container like the Play Framework or plain Akka? 

If you are using a relational DB like MySQL or Oracle most of these containers allow you to configure database connection pools and data sources within the container itself and where you need to access a database, you simple inject or mix in the particular database connection in your code.  For nosql database connections, configuring connections takes a little more work for some of these containers, but is still pretty easy to configure.

If you are going  to use a full JEE app server you will probably want to use JPA and/or Hibernate to abstract your data access and transaction management rather than directly access the databases.  If you are going to use Tomcat, you will probably want to package Hibernate with your web app, and again use that for data access and transaction management.  

This is perfect. Thank you very much.


oh yeah definately is you just need a way to distinquish the data source. i have a program i wrote for my college's mailroom that can "use" multiple types of databases but only one at a time. poor design but hey i only need on DB open per instance. so i have classes like MysqlManager which handles connecting to MySQL DB. one for sqlite, and one for postgresql. you would write something similar and then in the data calls, make the appropriate call to the appropriate manager and get the result back. ideally the different systems would be similar in shcema so then you can more or less copy paste code between the different managers and only tweak a few lines to finish compatibility. message me if you wanna know more or wanna see how i did it for my program.

I would actually be interested in what it would look like.  I am not going to be writing this App, I'm just coming up with the idea to propose to my higher ups.  Apparently since I build Desktop PCs and do a little web design I am like the Go To tech guy here.

Hiring a Ruby on Rails developer would not be a bad idea the framework can handle everything your boss is asking for