I have an application hosted on jboss. use jdbc driver of oracle to connect to an oracle 10.2g database. Can anyone guide as to what happens when a session is established.
Just trying to understand internal working of JDBC/ODBC.
Any help is appreciated.
Well first off, JDBC and ODBC are not compatible. JDBC was Java's answer to ODBC, and they fill the same niche, but you can't connect to an ODBC data source using JDBC and vice versa. Now there IS a jdbc-odbc bridge in Java, but that is a compatibility hack, not a native connector (The translation will go JDBC->ODBC->(Target Database) rather than JDBC->(Target Database))
ODBC is simply a standardized interface to access data from different databases. You install the ODBC to (whatever database) driver on your machine, then create an ODBC datasource, and then you can connect to that datasource via odbc rather than having to configure a native driver for the original database. Or if the database is ODBC capable, you can connect to it directly by importing the driver.
The benefit is that you can write all your code to be odbc compatible and it'll work with only small modifications regardless of what the real database type is.
The negative is a performance hit, and occasional weird behaviour as odbc fails to translate some database specific action in exactly the right way. Support varies. If you're using ODBC to connect to some legacy database, you may have a lot of work to do, but if you're using it to connect to an access database, then it'll work flawlessly.
The process that happens on connection is relatively simple. You send your "standardized" query, the JDBC or ODBC driver translates it into the native framework you're trying to access, and then submits the query. If the database returns anything, the process is reversed.
If you're having problems, I'd check the driver you're using. If you import a bad driver with java, nothing is going to work right. The first thing you need to do is log the error. If you're using an ODBC datasource, you can just turn logging on in the properties (look to the driver documentation to find out the correct settings; they vary).
If you're using JDBC, you're probably going to have to catch and log the SQLException's yourself.
First of all, ODBC and JDBC are entirely different APIs (though with the same purpose, namely interfacing with a database).
As to the internal working of JDBC:
Roughly speaking, the JDBC driver will open a connection to the database you want to use, and will pass along your queries to execute, then send back any results. How exactly it does that depends on the specific JDBC driver you use (the driver is specific for each DBMS). Some will use JNI to call non-Java libraries (e.g. the "OCI driver" for Oracle), others will implement the complete protocol to speak to the DBMS in Java (e.g. Oracle's "thin driver", MySQL's driver).
If you need more specific information, please clarify your question.
The Wikipedia pages on JDBC and ODBC also give a good overview of the subject.