Hi - I was asked the following question on a test taken as part of a recruitment process. What do you guys think? Q: To code a JDBC transaction, a developer invokes the commit and rollback methods of the __________ interface. Choices: 1) java.sql 2) javax.Connection 3) javac.sql.Connection 4) javax.sql.Connection Regards, Guy
"Ming", your name does not conform to the JavaRanch naming policy. I have previously asked you to change your name (here). Please make sure you change your name otherwise we will have to lock the account. Thanks, Dave.
According to the javadoc, commit() and rollback() are implemented in java.sql.Connection. Distributed transactions, however, are supported in javax.sql via the XAConnection and XADatasource interfaces. Hence, the question is flawed. Craig [ March 20, 2002: Message edited by: Craig Demyanovich ]
Rather than imply that the question is "tricky," I would speculate that an error was made in providing the multiple choice answers. To more clearly state the point I tried to make in my earlier post, basic transactional support is provided in java.sql.Connection via commit() and rollback(). Distributed transactions are supported via javax.sql.XADatasource and javax.sql.XAConnection. The question doesn't distinguish the type of transactions; thus, I believe that answer D would be the correct one if not for a typo. Craig