Using UCanAccess with DNS - java

How can I access ODBC 32-bit drivers with UCanAccess with DNS?
jdbc:ucanaccess:pmg
Here is the 32-bit driver from a custom ODBC driver:
I'm using Java 11 with JavaFX.

Short answer: You cannot.
UCanAccess is a JDBC driver to access databases which were created by the Microsoft Jet Engine, the default database format used by MS Access. It does this by leveraging Jackcess, which is able to read directly the database file format bypassing MS DLLs so it is able to work under Linux.
But if you use Access only as a GUI to access another database like SQL Server or Acomba via ODBC UCanAccess is unable to access those database links.
So you need a JDBC driver for your target database. It seems there is none for Acomba. And the old built-in JDBC-ODBC-Bridge driver is no longer provided since Java 8 and was never intended for production use. There was a commercial JDBC-ODBC-Bridge driver provided by Easysoft. But the Easysoft web site is no longer available. So it seems you are out of luck. Maybe you can implement the data access part with another programming language which supports ODBC.

Related

Recommendation for Embedded DB with External ODBC Access?

Is there a database that can be embedded in a Java program but also allow access through ODBC; more specifically, ODBC through ADOdb?
The environment is MS Windows (XP on).
The situation is that a Java program (mine) runs an external program (not mine) that uses an ADOdb.Connection object to connect to the embedded database and extract data. Oh, legacy support.
I've been trying to set this up using Derby (i.e. JavaDB/Cloudscape) and the NetworkServerControl object, but cannot figure out how to configure the System DSN such that an ADODB.Connection object can connect. Chances are I'm doing it wrong, but I can't figure out how to specify the path to the Derby files.
Is there an embedded db that can be accessed in this manner? Preferably one (unlike Derby) that doesn't require unsupported third-party drivers for ODBC access?
Alternatively, am I going about this completely wrong? I'm not very conversant with databases, nor ADOdb or .NET in general.
H2 stated a ODBC driver on the features list (but still experimental).

Using MySQL 3.x and 5.x simultaneously from Java

How can I use MySQL 3.x and MySQL 5.x simultaneously from my Java application if the two versions need different versions of JDBC drivers but the driver class name is the same?
For MySQL 3.x I downloaded MySQL Connector/J 3.0.17 and for MySQL 5.x I have MySQL Connector/J 5.1.12. How can I use them both?
First check whether (as mentioned by #DaveHowes +1) you can use JDBC driver for v5 with DB v3. It probably works. In this case you have no problem.
If it does not work you have to use separate class loaders for 2 connectors to 2 different DBs. So, neither v5 nor v3 JDBC driver will not be in "regular" classpath of your application. Instead you should create some kind of wrapper that will instantiate its own UrlClassLoader: and start driver. The mentioned collector should expose API that allows you to perform JDBC query. I hope this will work. All this if you are using pure JDBC. If you are using some kind of tools (e.g. Hibernate, iBatis etc.) I wish you good luck :) and suggest to ask more specific question that mentions tool you are using.

Do pure java jdbc drivers (Type 4 ) call native database API functions such as OCI and DB2/CLI?

Do pure java jdbc drivers (Type 4 ) call native database API functions such as OCI and DB2/CLI?
If not do databases expose custom API for Java programs?
For example reading this intro to OCI here http://www.oracle.com/technetwork/database/features/oci/index.html
They do not mention thin jdbc driver as being one of the interfaces that use OCI.
The Oracle "thin" driver (Type 4) talks directly to the Oracle database server without any layer in between. It does not even need any Oracle client installation which would provide the OCI API.
Oracle's driver can use OCI for certain features (mainly TAF - Transparent Application Failover), but the JDBC URL will look differently then. If that is used, it is no longer a Type 4 driver and requires an Oracle client install (OCI) to be available.
I don't know about the DB2 driver.

Sun JDBC ODBC Driver or MSSQL JDBC Driver

we have 2 approaches to connecting to our MSSQL databases, the one being the Sun JDBC ODBC bridge and the other being the MSSQL JDBC Driver.
We're doing some reorganization and want a uniform approach to database connectivty.
Which driver should we use?
(I'm leaving the question at a very broad level on purpose, I'd like to hear what peoples opinions are)
Sun's bridge driver shouldn't be used for anything other than prototyping and quick development.
You should always use a type IV JDBC driver if one's available. There are two that I know of for SQL Server: Microsoft's version and jTDS.
Even Sun/Oracle says so. This is from their docs:
If possible, use a Pure Java JDBC driver instead of the Bridge and an
ODBC driver. This completely eliminates the client configuration
required by ODBC. It also eliminates the potential that the Java VM
could be corrupted by an error in the native code brought in by the
Bridge (that is, the Bridge native library, the ODBC driver manager
library, the ODBC driver library, and the database client library).
The JDBC-ODBC Bridge driver is recommended for use in prototyping
efforts and for cases where no other JDBC technology-based driver
exists. If a commercial, all-Java JDBC driver is available, we
recommend that it be used instead of the Bridge.
Use the MSSQL Type 4 JDBC driver provide by Microsoft or the jTDS driver. At the time of writing this, the MSSQL JDBC driver offered by Microsoft is at version 3.0 although version 4 is available as a preview release.
Avoid the Sun JDBC ODBC driver, for it really is a bridge to the ODBC driver installed in the machine. Atleast one question has been asked on StackOverflow on why Type 4 drivers ought to be used as opposed to Type 1 (ODBC bridges) or Type 2 (JNI-based) drivers.
To add to the answers posted in that question, Type 1 (ODBC driver bridges) are to be avoided unless you cannot find a JDBC driver from the vendor. After all, it does not make any business sense to have dependencies on both the ODBC driver offered by the vendor, as well as the Sun JDBC-ODBC driver; any bug encountered in production could be in either. Therefore, if you are making this decision for a line-of-business application, you ought to be using a well-tested third-party JDBC driver (like jTDS or DataDirect) or the vendor provided driver (unless your experience suggests that the driver is poorly written or that the vendor is incapable of resolving issues or providing workarounds in a sufficient timespan).
There is also the OpenLink Multi-tier JDBC Driver for SQL Server...
This driver has its place - where additional security and configurability is required.

Is jdbc by itself compatible with mysql

I'd like to know if jdbc by itself is compatible with mysql or do I have to intsall something extra? I was told it is not compatible and that I'd have to use a different database.
It does.
You have to use the correct mysql jdbc driver and that's it!
Some useful links:
Little old but still helpful:
Using JDBC with MySQL, Getting Started
Official reference:
Official JDBC Driver
JDBC reference
You have to look at your specific version.
MySQL belogs to Sun Microsystems now after all
Using MySQL from Java
JDBC is a specification for Java/database interaction. As a specification it's compatible with almost every DB. However, you need a JDBC compliant driver written for your database. Googling "jdbc driver {databasevendor}" should get you an the right track.

Categories