Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

A Connection question

 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its option 4
javax.sql.Connection
 
Ming Chen
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why it's not number 1.
Is javax.sql a new API package or it's just your own package.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Swamy Vatti:
its option 4
javax.sql.Connection

Swamy's got it.
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You sure its not a typo for java.sql.Connection instead of javax or javac? (available here)
Dave
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah ha, a trick question.
Thanks, Craig
 
Craig Demyanovich
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic