I recently updated from java 7 to 8 and jdbc will no longer run.
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // classNotFoundException is thrown
is what i get now when I run it, where did I go wrong?
thanks
UCanAccess is a pure Java JDBC driver that allows us to read from and write to Access databases without using ODBC. It uses two other packages, Jackcess and HSQLDB, to perform these tasks.
sun.jdbc.odbc.JdbcOdbcDriver is Java internal class, it is not documented in the official Java SE javadoc and it should not be used by applications because it may change or totally disappear in a next Java version.
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 typed a single program to connect to a access database and display a single record.
but when i run the program, there seems to be an issue with the drivers.
(i'm just getting started in java)
** the DNS & table name are correct
The JDBC-ODBC bridge driver has been removed from JDK 8. Any tutorials you see that use Access probably depend on this class. It's been part of Java for 20 years, so I'm sure you'll find lots of examples that are now obsolete.
You'll either have to buy a JDBC driver for Access or use a real database like MySQL, PostgreSQL, etc.
I am trying to connect to a local .mdb file using Java 8. So far I have used UCanAccess's libraries but not all features are supported.
In Java 8 "JDBC/ODBC was scrapped"... So my question is:
What is the new method to connect to .mdb files (without UCanAccess)?
If you really don't want to use UCanAccess then you'll probably have to buy a third-party library
to replace the JDBC-ODBC Bridge that was removed from Java 8, or
to provide direct JDBC connectivity to the Access database.
However, as Marco indicates in his comment to the question, there could very well be UCanAccess (or HSQLDB) workarounds for your "feature not supported" issues if you care to give us a hint as to what they are.
can you please give the steps how to make simple program of jdbc on mac .
I have eclipse on my mac .so I need steps what to do next so that can able to make program of jdbc ?
I do lot of RND but they provide for windows.But I also download Mysql from this link
http://dev.mysql.com/downloads/file.php?id=450342
and download workbench from this link
http://dev.mysql.com/downloads/file.php?id=412161
Then can you please may I right ?
or what next I have to do to make jdbc program ?
Install and start MySql.
Download the MySql JDBC driver. Try here: http://dev.mysql.com/downloads/connector/j/. Extract all the files and add the jar to your eclipse project.
Now you can start coding. Look up the docs for DriverManager, Statement and ResultSet.
There is not much difference at all in using a Mac than other platforms for working with JDBC.
JDK
You need an implementation of Java, a "JDK". See my answer to another question about installing Java 7 and Java 8 on a Mac, including links for downloading a JDK. Before doing the database stuff, be sure this works in the Terminal.app program: java -version
JDBC Driver
You need a JDBC driver specific to your particular database engine.
H2 Database
I suggest trying the H2 database rather than MySQL, only because it may be a gentler easier way to get started. H2 is pure Java, rather simple in terms of installing and administrating, and free-of-cost. H2 comes with its own JDBC driver. The H2 web site has a quick-start page and a tutorial page. It is not written explicitly for Mac OS X, but you should be able to "translate" as needed.
Oracle Tutorial
Then follow the JDBC tutorial provided by Oracle.
Also: StackOverflow is for specific questions on programming, not general or wide-ranging discussion.
I am just setting up a test project using Oracle Streams.
My first problem is, is there something I need to install first? How can I tell if Oracle Streams is installed ?
Streams is automatically included in Oracle 9.2 Enterprise Edition and up. You may need to take additional steps to configure your instance to use Streams, however. This presentation covers a lot of the steps of configuration: http://www.scribd.com/doc/123217/Oracle-Streams-Step-by-Step-PPT
What version of oracle? It comes installed by default from at least 10g.