Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JDBC and the fly likes A Connection question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "A Connection question" Watch "A Connection question" New topic
Author

A Connection question

Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
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
Swamy Vatti
Ranch Hand

Joined: May 02, 2001
Posts: 57
its option 4
javax.sql.Connection


Swamy
Ming Chen
Greenhorn

Joined: Mar 14, 2002
Posts: 13
Why it's not number 1.
Is javax.sql a new API package or it's just your own package.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"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.
Chris Stewart
Ranch Hand

Joined: Sep 29, 2001
Posts: 124
Originally posted by Swamy Vatti:
its option 4
javax.sql.Connection

Swamy's got it.
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
Really guys?
Please give me a link to a Sun API doc page that shows the interface javax.sql.Connection.
Guy
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

You sure its not a typo for java.sql.Connection instead of javax or javac? (available here)
Dave
Guy Allard
Ranch Hand

Joined: Nov 24, 2000
Posts: 776
Hi Dave - I think it is either a typo, or one of those questions where the answer is 'none of the above'.
Regards, Guy
Craig Demyanovich
Ranch Hand

Joined: Sep 25, 2000
Posts: 173
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 ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

Ah ha, a trick question.
Thanks, Craig
Craig Demyanovich
Ranch Hand

Joined: Sep 25, 2000
Posts: 173
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: A Connection question
 
Similar Threads
i need JSP code
question on hascode()
Query on wrapper constants
Need help on calling javascript without any handler from JSP..
Connection con;