aspose file tools*
The moose likes JDBC and the fly likes different ways to connect to database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "different ways to connect to database" Watch "different ways to connect to database" New topic
Author

different ways to connect to database

karthik swamy
Ranch Hand

Joined: Mar 14, 2011
Posts: 42
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30537
    
150

Not sure what you are asking here. The four driver types or something else?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
karthik swamy
Ranch Hand

Joined: Mar 14, 2011
Posts: 42
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

Joined: Aug 18, 2009
Posts: 68

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
Marshal

Joined: Mar 22, 2005
Posts: 41876
    
  63
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.


Ping & DNS - my free Android networking tools app
 
 
subject: different ways to connect to database