Java and Sybase - java

What is the difference between the drivers provided using jtds.jar and jconn3.jar?

JTDS is open source (LGPL), the other is proprietary, made by sybase. In terms of which performs better, you would have to benchmark.
Sybase calls their latest JDBC jconn4.jar, so the version you are referencing complies with the JDBC 2.0 spec only. JTDS complies with JDBC 3.0. Whether or not that is important depends on the version of Java you are using to run your application.

jTDS works with both Microsoft SQL Server and Sybase. SQL Server is the product of a "collaboration" between Microsoft and Sybase, so that's not surprising.

Related

how to use JDBC 4 driver with oracle 11?

I am using oracle 11g . I do not know what is the default driver comes with oracle 11g. I see ojdbc14-10.2.0.3.0 under my <TOMCAT_HOME>/lib. I am not sure what change i need to do to make sure i am using JDBC 4 driver ?
Do i need to replace ojdbc14-10.2.0.3.0 or i need to put some other jar under my oracle installation ?
According to Oracle article, Oracle Database 11g Release 1 (11.1) goes with JDBC drivers provide support for the JDBC 4.0 standard.
You should have the ojdbc6.jar in your classpath environment variable in order to have JDBC 4.0 standard support.
Take a look at Oracle's JDBC drivers list: for 11g and 11g2, only ojdbc5.jar and ojdbc6.jar are listed, but some says that ojbc14 should work just fine with Oracle11g.
The primary difference between ojbc14 and later versions is that it wouldn't support new JDBC API, so I suppose you should better go with newer drivers.

Is JAVA DB compliant with Oracle 11 G?

I am using JAVA DB (Part of JDK1.7) for my development environment. We have Oracle 11g on our SIT environment. I was researching whether JAVA DB (Which is based upon Apache Derby) is compliant with Oracle 11g i.e. Will I need some changes in my query structure or code if I try to migrate my code from JAVA DB to Oracle 11g?
Java DB and Oracle 11g are not entirely compatible with each other. Depending on your query's complexity, you may or may not need to port your code.
it just require the connection to particular db which are using do need any extra code for db it is same for any database
SQL Compatibility is a big topic. You might want to start here: http://wiki.apache.org/db-derby/SQLvsDerbyFeatures

JDBC Driver vs Bridge

I've used JDBC in several applications now to query Derby, PostgreSQL and now MySQL databases. I guess I'm choking on some basic terminology in my attempt to understand what is actually going on underneath the hood. Several terms I've seen batted around:
ODBC
JDBC Driver
Bridge
JDBC-ODBC Bridge
For each of those I did my best to do some digging and gain an understanding of what they are, what they do, and how they relate to one another. I believe I'm about 70% of the way there, I just can't seem to find anything (articesl, blogs, docs, etc.) that tie everything together nicely and confirm my suspicions.
It seems that ODBC is a C library (perhaps a DLL?) that programs can use to communicate with RDBM systems (such as PostgreSQL and MySQL). All queries to these systems flow in and out of this library on a given system.
The JDBC-ODBC bridge is a Java component that contains native code that allows JDBC to communicate with that ODBC library on a given system.
JDBC is a pure Java API for querying RDBM systems.
A JDBC driver (such as a PostgreSQL-JDBC Driver) is where I'm really having trouble. If all RDBM systems follow RDBMS standards, and can communicate with the ODBC library, then why does JDBC need different "drivers" for each of them?
What are these drivers? What do they do? Why are they necessary? Also clarification on any other assertions I've made here would be enormously appreciated. Thanks in advance!
You are almost there. Good question.
What are these drivers: A pure JDBC driver is a driver written in Java, that does not need an ODBC driver to work. You should only use ODBC drivers (through JDBC-ODBC bridge) when you don't have a direct JDBC driver for your database (which is extremely rare, since most {if not all} databases support JDBC nowadays).
A pure JDBC has the advantage of not needing ODBC. ODBC is usually hard to configure, and requires a database native client library to be installed on the system (such as Oracle OCI, or Sybase CT Library).
It used to be the case that ODBC or native drivers were chosen for performance reasons, but I think today pure Java/JDBC perform almost as good as their native/ODBC counterparts.
What do they do: the same as ODBC. A standardized Java API to access relational databases.
Why are they necessary: They are necessary because it simpler to work with them, you just need the JDBC library JAR and your URL connection. Opposed to: native client library + ODBC driver + JDBC-ODBC configuration. It's also the case that every single database has its own network protocol to perform queries against it, and to get results back. So you need one driver for each database vendor. Each one of them implements the specific protocol it needs to connect to its relational database manager. If you were on a world where all database shared the same SQL language and the same communication protocol, you would only need one driver. But that won't happen any time soon.
ODBC and JDBC are equivalent. They both use drivers to transform ODBC (or JDBC) calls into the native database commands. ODBC is older and written in C/C++, while JDBC is written in Java. When JDBC came out, there were no JDBC drivers for most DBs, so they created the JDBC-ODBC driver to allow people to utilize the already available ODBC drivers. This is rarely used now, since almost every DB has a pure Java JDBC driver
Just because DBs use "standard" SQL (and that's in quotes for a reason), does not mean that the DB use the same lower level protocol for communication. SQL is simply a syntax, but not a protocol.
The protocols for Postgres and, say, Oracle are wildly different and offer different features, even though they both use similar SQL features.
SQL itself, while standard, has wide deviations in implementations. MySQL for example is notorious for being less SQL compliant than other DBs. While much SQL used today is portable across DBs, there is much that is not.
JDBC and ODBC are kindred spirits. They provide a shared interface that your application can use to talk to an RDBS. They also provided a common model for vendors to implement. These are the drivers.
Vendors implement a driver to allow a JDBC/ODBC compliant program talk to their database. The drivers task is convert ODBC/JDBC calls in to the appropriate SQL or and other control calls for the database.
The JDBC/ODBC Bridge is a JDBC driver that talks to an existing ODBC driver. It's an abomination. Don't use it. Every database of note today has JDBC drivers. And stick with "type 4" JDBC drivers if at all possible, since these are native Java rather than "type 2" drivers that use JNI to a binary. Buggy type 4 drivers give exceptions, buggy type 2 drivers give JVM crashes which nuke your appserver. No thanks.
You're right; you're very close to having the full picture!
JDBC and ODBC are conceptually very similar. They're both frameworks for interacting with databases. JDBC is Java-specific, while ODBC is Windows-specific. That said, both JDBC and ODBC are actually toothless APIs. In Java terminology, JDBC is actually a set of unimplemented interfaces. While they specify a behavioral contract, they don't inherently know how to talk to any specific database. That's where drivers come in.
Let's talk specifically about JDBC here. JDBC drivers are concrete implementations of the JDBC interfaces that actually know how to talk to an underlying database engine. JDBC guarantees that a ResultSet from the MySQL JDBC driver will behave the same way as a ResultSet from the Postgres JDBC driver.
As others have pointed out, a JDBC/ODBC bridge is just a bit of glue to make code written for JDBC to work with ODBC infrastructure. Generally, that only makes sense if you know with certainty you're writing Java for Windows exclusively; ODBC is Windows-specific, but JDBC is (in theory) cross-platform.
Jdbc is the java way to connect to a database using dricers written in java (since JDBC4).
ODBC is the MS Windows way to connect to a database, these drivers are usually written in C
A JDBC-ODBC Bridge is something rather old, in early days of java there were not all drivers in a JDBC version available, so the build a generic bridge beteween JDBC and already existing ODBC drivers.

SQL Server Libraries for Java

I'm curious to find what SQL Server libraries are available for Java.
At present we are using the com.microsoft.jdbc.sqlserver.SQLServerDriver driver. I think this was downloaded from the Microsoft site a while ago.
What alternative libraries are available?
Many thanks,
Andez
Seconding the open source jTDS Driver. It also works perfectly with Hibernate.
DataDirect is a well known alternative (used by many vendors) but also others such as
connx
attunity
i-net
Easysoft
JTDS is an open source alternative
NB: I have only used the MS driver, DataDirect and the i-net drivers suceccfully in production, mostly prior to the MS JDBC driver release.

Which OJDBC Driver for Java 6?

We're currently using ojdbc14.jar, should we be using ojdbc6.jar ?
Update: Oracle 10g being used
If you're working with java6, you can (and should) use ojdbc6.jar if it is compatible with your database.
Resources :
oracle.com - JDBC drivers
Short answer - yes, you should.
Long answer - look at compatibility tables in Oracle JDBC FAQ:
Which JDBC drivers support which versions of Oracle Database?
Which JDBC drivers support which versions of Javasoft's JDK?
For JDK 1.6 and Oracle 10g best option is o

Categories

Resources