Is there an alternative to using sun.jdbc.odbc.Jdb

2019-06-25 14:13发布

问题:

I recently migrated an older application we have at work from Java 1.5 to 1.6. I noticed that during the build, I now get a (new) compiler warning:

... DatabaseSession.java:[9,20] sun.jdbc.odbc.JdbcOdbcDriver is Sun proprietary API and may be removed in a future release

So I understand what that means, but is there a well-known alternative that is more open-standards friendly, not proprietary? What driver do you use and/or recommend and what are the advantages of it?

So far I have taken the approach that it compiles in 1.6, so we'll keep using it and we can find a replacement later if the next version of Java does not support it, and I will likely try to suppress the warning from showing up in the build. Am I wrong to think that?

回答1:

Yes, use a Type 4 JDBC driver for the database you're using.

The JDBC-ODBC brigde is one of the worst JDBC drivers that I had to pleasure to work with.

Alternatively you might want to look into third-party JDBC-ODBC bridges such as this Easysoft product, but I don't have any experience with those.