Do we always have to use jdbc with Java programs for making connectivity with database or can we use only odbc for connecting to databases with Java programs?
No. ODBC stands for Open Database Connectivity which literally means that it is compatible with all types of languages such as C, C++, Java, etc. JDBC Stands for Java database connectivity i.e only compatible with java language. ODBC was introduced by Microsoft prior to JDBC in 1992.
ODBC is more egalitarian, and is accessible to programs written in a variety of languages, such as Visual Basic, . NET, C# and Fortran. JDBC only works within a Java Runtime Environment. Another key difference between ODBC and JDBC is the set of compliant databases to a given standard.
ODBC is an SQL-based Application Programming Interface (API) created by Microsoft that is used by Windows software applications to access databases via SQL. JDBC is an SQL-based API created by Sun Microsystems to enable Java applications to use SQL for database access.
Open Database Connectivity (ODBC) is an open standard application programming interface (API) that allows application programmers to access any database.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With