Using pure Java type 4 JDBC driver is the best way to connect commercial databases from Java programs. BTW, there are several disadvantages of using JDBC ODBC Bridge driver, first, it requires an ODBC driver to be installed in your machine, second, it makes your code platform dependent. I didn't have to go with pain involved in installing Oracle, SQL Server, or MySQL database, sometimes even you don't even have administrator access in your machine to do that. Even I have done the same when I first started learning JDBC, the main reason for that was MS ACCESS comes as part of Microsoft Office and was available in my machine. Many newbies in Java programming prefer to connect to MS Access database from Java then bigger databases like Oracle, SQL Server or MySQL. You will learn the right ways of doing things with respect to Java and the database.
#JAVA 8 JDBC ODBC BRIDGE HOW TO#
This course is a comprehensive guide on how to use JDBC in Java to connect to different databases. JdbcOdbcDriver class is present in rt.jar, which is always included in Classpath, as this JAR file is part of the JRE.Īnd, if you are new to JDBC then you can also take a look at the Complete JDBC Programming course on Udemy. JDBC driver to connect Oracle database comes on ojdbc6.jar and MySQL driver comes in mysql-connector-java-5.1.23-bin.jar.
#JAVA 8 JDBC ODBC BRIDGE DRIVERS#
Just remember that is a standard class from JDK API and it doesn't come with any external JAR like other vendor database's JDBC drivers e.g. In order to connect to MS Access, we need type 1 JDBC driver, also known as JDBC ODBC bridge driver and the class in question, JdbcOdbcDriver is driver implementation to connect to Open database connectivity driver installed in the machine. In order to load driver, we use Class.forName("") and this method throws, if ClassLoader is not able to find the requested class ( ) in CLASSPATH. If you remember, In order to open SQL connection to the database, the first step is to load and register the driver. Normally, in pre-Java 8 world, error comes when you try to connect to the Microsoft Access database from Java using JDBC and JDBC ODBC bridge driver is not available in the classpath. In order to solve this error, just use the Jackcess library or a commercial driver like HXTT. Microsoft Access, but unfortunately, you cannot use it from JDK 8 onward. This class is required to connect any database using Object database connectivity driver e.g. exception comes in Java 8 because it has removed the JDBC ODBC bridge driver class "" from JDK and JRE.