Sample MS Access database - java

For JDBC-ODBC Bridge, I use a self-made School.mdb database with no more than 5 records.
One of the community members told me to use a 'real' database like HL2D (if I got the name right).
Where is this database located?
If it is available on the internet, where can I get it?

They might have meant Hypersonic SQL. You can also try Derby, which is part of JDK 7 and higher. Or SQL Lite.
I'd prefer all of them to MS Access. All have type IV, pure Java JDBC drivers that will work on 64 bit operating systems. The JDBC-ODBC bridge driver uses native code for 32 bit operating systems that hasn't been ported to 64 bit.
Five records? You don't need a database. A simple file on the file system loaded into a Map will do for that.

Related

odbc driver exception jdk 1.8

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.

Microsoft access database to java

I am considering using a Microsoft access database for a Java project. My question is, if I use a Microsoft access database and I complete my project and run it as a jar file on any computer/operating system, does any computer/ operating system need to have Microsoft access installed on it, particularly if the database needs to be put on a GUI on the java program and the administrator of the program can add and remove entries.
You will have to install the access odbc driver on any machine that accesses the database. I think you can do this by installing the Access runtime stuff without installing all of Access. Keep in mind that this sort of data-access is file-level, so your performance will be very poor. I'd suggest that you use a real database (postgres, mysql, sql server, oracle) or maybe a lightweight one such as SQL Server express and then accessing that database using either an odbc-jdbc bridge or preferably a native jdbc driver. Using a native jdbc driver will let you run your app from a non-windows environment.
You can use a Access Database via the JDBC-ODBC bridge on every Microsoft Windows system without to install Microsoft Access. You only need the Access Database Engine (ACE) formerly known as Jet Database Engine. ACE is part of current Windows versions. For older ones it may be necessary to install the Microsoft Data Access Components (MDAC).
Using a Access Database from Java has some disadvantages:
This is a type 1 driver with native code. Generally pure Java JDBC drivers are more performant.
With JDK 6 the JDBC-OLE bridge was somewhat enhanced. But there are still some problems with charsets and CLOBs.
Your application is restricted to Microsoft Windows operating systems.
According to the JDK 7 JDBC-ODBC bridge guide the JDBC-ODBC bridge will be removed in JDK 8:
The JDBC-ODBC Bridge should be considered a transitional solution; it will be removed in JDK 8. In addition, Oracle does not support the JDBC-ODBC Bridge. Oracle recommends that you use JDBC drivers provided by the vendor of your database instead of the JDBC-ODBC Bridge.
So if there is any chance to use another database for your project, you should avoid using Microsoft Access together with Java.
There are lots of alternatives with far more better JDBC drivers.
If you want a small footprint embedded database, there are:
Java DB (part of the JDK), also known as Apache Derby
H2
HSQLDB
SQLite e.g. with Xerial driver
(Java DB, H2 and HSQLDB are pure Java solutions)
If you prefer a client server solution, for most commercial and open source there exist full-fledged JDBC drivers.
Oracle
Microsoft SQL Server (the server has to run on Windows but your Java client can run on every OS that supports a JVM. See Microsoft JDBC Driver for SQL Server Support Matrix)
PostgreSQL
MySQL

java odbc foxpro

I am attempting to build some java apps that use a FoxPro database that is part of a large Visual FoxPro product. I have been able to read the data using a jdbc-odbc bridge. While I had to search long and hard to find out how to accomplish that task, what I haven't been able to find out is if I can safely insert/delete/edit the tables. I don't know if the index files are used by the jdbc-odbc libraries.
On a related note, does anyone know if you use MS SqlServer to set up a link to the foxpro data will make the FoxPro data "act" like a real relational db, or if the functionality doing things that way is the same as using the odbc solution.
I'm not replacing the current Visual FoxPro product, just trying to add some functionality, and I don't want to break the existing product.
Thanks.
I would imagine the JDBC-ODBC bridge handles indexes transparently, it wouldn't be much use otherwise.
You might be better looking at StelsDBF or Hxtt's native JDBC drivers.
Visual FoxPro is already a relational database. Not sure what you would achieve via the MSSQL approach.

Java database compatibility

Will code that communicates with a Ms Access 2007 database work with a Ms Access 2003 database as well? And vice versa. How compatible is all the JDBC stuff with different versions?
Thanks.
There is an odbc-jdbc bridge, so Java can connect to everything you can setup an ODBC driver to.
Of course, the drivers mostly just "pass" the SQL to the database, so if your code used querys specific of a database they will work on that database but won't on anything else.
Although SQL is a standard, db vendors provide "extra" functionality that is not necessarily standard. Depends on your usage. I am not an expert in MS Access, but I would say assume it is not compatible until you are able to prove that it is
It would depend on your jdbc driver, but as long as you're not doing any vender specific calls, (ie: custom types for cursors or vender specific sql) you shouldn't have any problems.
So to answer your question, the jdbc code will port, but the sql may not.
Is the MS Access 2007 database in ACCDB format? If so you need to use the appropriate ACE driver. Now this will work just against an Access 2003 format database file so long as ACE is installed on the client system. If not then you'll want to use Jet 4.0 which is part of every Windows OS since Windows 2000.

How to Java Persistence Api with MS Access?

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

Categories