I'm now trying to decide which driver to use to create a DataSource from my JavaEE application to MS SqlServer.
A couple of years ago I had good experience with JTDS, and SO answers suggest that JTDS was a preference back then.
But now I can see that its latest version 1.2.5 is two years old (2009-12-30).
Is it a good enough reason to choose MS proprietary driver, or is JTDS so good that it doesn't require any development anymore? :)
Microsoft JDBC driver is JDBC 4.0 compliant while jTDS is JDBC 3.0.
Here are some new features and improvements introduced in version 4.0 of JDBC.
Related
I am having a rather trivial question. In our project we are using Oracle 10g as the database and Java 1.8 as the language. Can anyone please suggest me which JDBC driver will be suitable in this case?
In the Oracle documentation in the below link:
http://www.oracle.com/technetwork/apps-tech/jdbc-10201-088211.html
I found that ojdbc14.jar should be used. However it is written that it is classes compiled using JDK 1.4 and 1.5. So should I use the same driver when using JDK 1.8?
You can try using ojdbc14.jar however it won't support methods introduced in JDBC 4 (Java 6), JDBC 4.1 (Java 7) and JDBC 4.2 (Java 8). Because Java emphasizes backwards compatibility you most likely will be able to open the database connection, however:
The code will throw LinkageError in runtime if you use methods introduced in JDBC 4+. The code will compile with JDBC 4.2 (Java 8) but these methods will not be available during runtime.
You may experience weird behavior with low level features e.g. statement caching and row fetching was modified in 11g ojdbc6.jar few times. I'm not even sure how this features work in the old ojdbc14.jar.
It's a very unusual, an I'd say not advisable, setup that you want to test. The only way to see if it works is to try it.
I am a bit confused about what JDBC version to use for MySQL server 5.1.72.
Could you please tell me, what version I should use and why?
The following link http://www.mysql.com/products/connector/ provides a list of MySQL Connectors, choose the JDBC connector and the platform.
Table 2.1 in this page could help you.
Anyway manual states:
The current recommended version for Connector/J is 5.1. This guide covers all four connector versions, with specific notes given where a setting applies to a specific option.
JDBC version does not makes sense here either you were talking about JDBC API then available versions are
JDBC 3.0
JDBC 4.0 (included in Java SE 6)
JDBC 4.1, is specified by a maintenance release 1 of JSR 221
and is included in Java SE 7
The latest version, JDBC 4.2, is specified by a maintenance release 2 of JSR 221
and is included in Java SE 8.
And if you are talking about JDBC driver mysql then it is better to use the latest version available which is
Connector/J 5.1.31
It is always recommended to use the most stable version unless you find some compatibility issue.
I was googling and couldn't quite tell which JDBC driver to download that my search results returned. I'm using the latest version of MySQL (Community Edition) and running Glassfish 3.0 (If that has any relevance?) also I'm using java 6.
Which driver should I download that would be compatible with my current setup? I really did try and do my research but the fact that there are so many different drivers and from difference sources makes it a tad confusing for some.
Thanks in advance!
You could download a JDBC Driver for MySQL (Connector/J).
When you develop a Java application that talks to oracle DBs, there are 2 options right? One is oracle thin driver, and the other is OCI driver that requires its own installation (please correct if I'm misunderstanding).
Now, what are the pros and cons? Obviously thin driver sounds much better in terms of installation, but is there anything that OCI can and the thin one can't?
Develop environment is Tomcat6 + Spring 3.0 + JPA(Hibernate) + apache-DBCP
The choice of the driver depends several factors. The nature of your calls to database (e.g. it seem like your app won't be using lots of stored proc calls), requirements for failover (e.g. clustered Oracle servers) and distributed transactions. Generally it is recommended to use the thin driver, but if there is some specific feature of the OCI driver that you just must have you may have to consider the OCI driver. It also been said that drivers in Oracle 10 and higher do have matching capabilities and there is practically no performance difference on modern JVMs.
Unless you have a dependency on a feature that is only available in the JDBC-OCI driver and not in the JDBC-thin driver, the recommendation from Oracle is to use thin. The most recent Oracle Database features such as Transaction Guard or Application Continuity are only available in the JDBC-thin driver. The thin driver is also more used than the JDBC-OCI driver so bugs will be fixed more quickly. It's considered as more stable. If you're still not convinced think that Oracle Weblogic Server ships with the JDBC-thin driver only.
I could not find any jdbc driver for ms access.So how can I connect MS Access with JPA ?
AFAIK, the only free drivers available are JDBC-ODBC bridges (type 1).
The JDBC-ODBC Bridge Driver distributed by Sun is sun.jdbc.odbc.JdbcOdbcDriver and this is what they write about it:
Note that the bridge driver included in the Java Platform Standard Edition (Java SE) 6 is appropriate only for experimental use or when no other driver is available.
And if this is not enough, here is what Ted Neward writes in Item 49 of Effective Enterprise Java:
(...) the JDBC-ODBC driver is an unsupported, bug-ridden 1.0 driver that is incredibly slow and is rumored to leak memory in some ODBC driver configurations (...)
Things may be a bit better with the Microsoft one (which is com.ms.jdbc.odbc.JdbcOdbcDriver) but I wouldn't expect a miracle.
So, if this is for a corporate application, maybe consider spending a few dollars for a commercial type 4 JDBC Driver. See this previous answer for some options.
It doesn't look like you need a MS driver at all. Just use a sun ODBC driver.
Look at the article here.
I've never needed it, but I've heard good things about this one: http://jackcess.sourceforge.net/
You can use UcanAccess: http://ucanaccess.sourceforge.net/site.html
It is a good replacement for the ODBC driver since Java 8