Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

different ways to connect to database

 
karthik swamy
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,
I heard that there are different ways to connect to database.
Can anyone tell me what are they?

thanks
Karthik Swamy.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34196
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure what you are asking here. The four driver types or something else?
 
karthik swamy
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeanne Boyarsky wrote:Not sure what you are asking here. The four driver types or something else?



i mean by how many ways i can connect the front end application to the database
1. by getConnection method
2.By ClassForName
3.Manually by user interface

so like this by how many ways.

thanks,
Karthik swamy
 
Philip Grove
Ranch Hand
Posts: 68
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One problem with your list is that a method called getConnection that can be used on both a java.sql.DriverManager and a javax.sql.DataSource to get a java.sql.Connection, so actually 1 covers 2 methods.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Philip Grove wrote:One problem with your list is that a method called getConnection that can be used on both a java.sql.DriverManager and a javax.sql.DataSource to get a java.sql.Connection, so actually 1 covers 2 methods.

+1. And those are the only methods; all others boil down to these at the end, even though there may be N ways to write code to do so.

I've always been puzzled by this kind of question. "How many ways are there to create an object" is another popular one. Are these interview question? If so, they're strange ones to ask.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic