Can I bundle the Oracle JDBC driver JAR in a Docker image? - java

I'm building Docker images based on the official Docker Tomcat images, where in addition to Tomcat, I add one of our web applications as a WAR file so it gets deployed when the container starts.
Since the application requires access to a database, and the supported databases use different JDBC drivers and some additional configuration files, I'm building one image per supported database (all based on a common base image), where the image contains the respective database configuration and JDBC driver JAR.
So far, I have done this for MySQL and PostgreSQL, and I'm now looking at support for Oracle.
Since Oracle is a commercial product, and I read somewhere (sorry, no official source) that you're not allowed to bundle the JDBC drivers - what's the best solution for this?
Am I permitted/allowed to bundle the Oracle JDBC driver JAR in a Docker image that I make available to our internal users (not outside of the company)? Or do I have to ask users to download the driver themselves and map it into the image?

When you need an Oracle jdbc driver inside a war, you provide the service for your users without asking Oracle and without asking your users to accept the license, so it should not be different for a Docker image.
Now if you are distributing the driver packaged into your own software (not only the service), I guess Oracle requires you to contact them :
"Can third party vendors distribute Oracle's JDBC drivers along with their own software?
If you are a third party software company (and Oracle partner) then please check out Oracle's licensing terms spelled out at Oracle Licensing Agreement Please contact your local Oracle sales rep for more details."
source : http://www.oracle.com/technetwork/topics/jdbc-faq-090281.html

Related

Best place to store driver JAR's on .jsp application hosted on Tomcat

I've been quizzing my mentor, but he isn't sure on the answer.
I'm building a JSP based application to be hosted on a tomcat server. It connects to several different types of SQL database. Where is the best place to store the drivers? We can't decide between adding to a lib folder in the application, or whether to add them to the lib folder of tomcat.
I'm using Eclipse to build the application and setting the buildpath for the app, rather than setting the classpath of the machine.
Thanks.
Db drivers normally go in the Container lib folder as different apps might use the same driver. Just to give you an idea an Application Server like JBoss provides drivers and libraries to connect to databases and other resources.
Another advantage it makes your WAR file a bit smaller.

Java integrated SQL server

I'm working on a plugin for an emulator that is going to allow people to host a control panel through a website to view statistics, etc; Currently I have XAMPP installed which is running my SQL Server, and the HTTP Server is being handled through the Netty networking library in Java.
I'm curious as to if there is a way to host the SQL Server from within Java, similar to the HTTP Server. It'd also greatly simplify the process of installation for the plugin.
The other option was to use ObjectDB, but after looking into it, it seems like it requires Quercus and I don't want to go through that.
The term you're looking for is "embedded database".
There are a number of databases that you can use as an embedded database, and you can choose to use them as an in-memory database (which means the data is gone when your application stops) or make them save data to a file on disk, so that the data is still there when you stop and re-start the application.
Examples of databases that can be used in this way: H2 Database, HSQLDB, Apache Derby.

install mysql using java

If I have an application that uses a mysql Server to keep its back end database is there a way to bundle the mysql installation with the application installer?
The installer must search if there is an existing mysql server and configure it to work with the application or install mysql and configure it. The target platform is windows.
You can't distribute mysql database according to MySQL license agreement typically:
" MySQL software for your personal applications as long as you do not distribute them"
http://www.mysql.com/about/legal/licensing//commercial-license.html
However, if your application is open source and you have some of kind agreement in terms of distributing the MySql then you can download and package a set of generic binary files on the below link which will allow you to have it available as part of your install package.
MySql Binary package

How feasible is it to extend Microsoft's JDBC driver?

I'm currently working on a project where we have a Java web app bought from a 3rd party vendor that's connecting to SQL Server using Microsoft's JDBC driver. However, I've been given the requirement of having to encrypt the connection string using a proprietary encryption protocol.
So my question is how feasible would it be to extend the JDBC drivers distributed from Microsoft to incorporate this encryption. At this point I'm mainly thinking of creating a JDBC wrapper that will underneath use the Microsoft JDBC driver.
I'm open to other suggestions from more experienced people who might have done something similar in the past, or even if they could share pitfalls with this approach.
Use jtds. It's all java, works great for sql server, and supports encryption. It's a drop in replacement minus setting up encryption. You just need to know where they've configured their JDBC URL (hopefully in a configuration file under WEB-INF or some place like that), put in your jtds URL in there, and drop the Jar in the WEB-INF/lib directory. You may have to extract the WAR file and repackage it with jtds. It just depends on how this 3rd party vendor has deliver their app to you. And yes I've shipped production packaged enterprise software using it for years.
http://jtds.sourceforge.net/
So say they have a simple properties file like this:
db.url=jdbc:mssql:....
db.username=bibby
db.password=blahblahblah
Change it to:
db.url=jdbc:jtds:<server_type>://<server>[:<port>][/<database>][;<property>=<value>[;...]]
db.username=bibby
db.password=blahblahblah
Of course you'll have to fill in all of the <> and [] parts as needed. Then copy jtds.jar and any dependencies it needs into WEB-INF/lib and restart the server. It should work.
if the original driver does not have your desired function -> you could fetch the official release (or fork it) and patch/add your needs
https://github.com/Microsoft/mssql-jdbc/releases
At this point I'm mainly thinking of creating a JDBC wrapper that will underneath use the Microsoft JDBC driver.
I guess that you need a proxy on server side to decrypt the connection inforamtion, and forward database connection to SQLServer's port.

special driver to connect to sql server 2008 express

I'm a java newbie, want to test out some hibernate goodies!
I have netbeans installed, and I included the Hibernate libraries.
I then created a new package named Model.
I will drop my Class and xml config files in there.
Do I need a special library to connect to sql server? (windows machine)
Yes, you'll need a JDBC library that talks to Microsoft SQL Server. jTDS used to be my first choice but the Microsoft JDBC driver has come a long way and I'd recommend using that. You can download it from this site.
You'll also need to follow these instructions to get the two talking to each other as SQL Server express doesn't listen to TCP by default and uses Windows Authentication Mode.
Have a look at these two URLs for examples of your hibernate.cfg: An explanatory Blog Entry and a JavaRanch Question.

Categories

Resources