Jdbc Odbc Driver Connection

JDBC ODBC Driver Connection

As mentioned in the comments to the question, the JDBC-ODBC Bridge is - as the name indicates - only a mechanism for the JDBC layer to "talk to" the ODBC layer. Even if you had a JDBC-ODBC Bridge on your Mac you would also need to have

  • an implementation of ODBC itself, and
  • an appropriate ODBC driver for the target database (ACE/Jet, a.k.a. "Access")

So, for most people, using JDBC-ODBC Bridge technology to manipulate ACE/Jet ("Access") databases is really a practical option only under Windows. It is also important to note that the JDBC-ODBC Bridge will be has been removed in Java 8 (ref: here).

There are other ways of manipulating ACE/Jet databases from Java, such as UCanAccess and Jackcess. Both of these are pure Java implementations so they work on non-Windows platforms. For details on how to use UCanAccess see

Manipulating an Access database from Java without ODBC

connection string of jdbc odbc with MS access

Following connection string for JDBC-ODBC is working correctly.

  try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String connectionQuery="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=path upto the database;uid=; pwd=password here;";

con = DriverManager.getConnection(connectionQuery,"","");
st=con.createStatement();
stmt=con.createStatement();

}
catch(Exception ex)
{

System.out.println("exception is"+ex);
}

do I have odbc/jdbc and their drivers installed and configured by default?

I have used just sql server as db by now but never installed and
configured odbc or its driver,what is this?

I thought you said you knew what ODBC was? Kind of sounds like you are not not sure?

An odbc driver is an open database driver connection which is a generic way to connect to most databases. It might work for basic functionality but it's typically best to get a more specific driver type for the database you're using.

do I have them installed and configured by default?

You usually have odbc drivers by default (I'm not sure what system you're on or even then how it was set up) but the connections are not configured. You can configure them as environment variables in Windows (if that's what you're using) or within your application as needed.

Is it always necessary to have odbc/jdbc and their drivers installed
and configured ?

No. Only if you want to use an odbc/jdbc connection.

why should java have jdbc?

It's the standard API for Java. Sorry I don't know what else to say about that.

why just it can't use odbc like other programming languages?

Because the standard database API that was programmed for java is jdbc.

can I use for example c# and jdbc?

Yes but are you specifically trying to connect to the SQL Server? I'd use something like SqlClient to do that (System.Data.SqlClient).

Connecting to SQLServer using JDBC-ODBC Bridge

You should not use the JDBC-ODBC bridge in a production environment. It is much slower than other JDBC drivers and only necessary when a JDBC driver is not available.

SQL Server has a JDBC driver available from Microsoft. If you use it then you will get the required result.

With the ODBC bridge you have no choice but to install the ODBC driver.

This article describes the connection string you will need to use to connect to the SQL Server.

Can we use odbc only with java to connect to databases?

Sun JRE contains a built-in JDBC/ODBC driver (sun.jdbc.odbc.JdbcOdbcDriver). Here's an example how to use it: http://www.javacoffeebreak.com/articles/jdbc/

The driver was removed in Oracle JRE 8, so use Java version 7 or earlier.



Related Topics



Leave a reply



Submit