Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Explain the sequence of steps to connect to the database?

Answer Posted / william

An alternate, and preferred way, to using the DriverManager class is to use a DataSource object.

1. The data source is registered on the server side, which stores connection information, like: host, port, sid, credentials (optional), driver to use, etc.

2. The application gets a handle on the data source through a JNDI lookup.

3. The DataSource object is a connection factory and you can invoke .getConnection()

One of the reasons it is preferred over the DriverManager is because it is more flexible. The connection information is taken out of the code, therefore if changes need to be made - such as the machine the db resides on, the driver, etc - the application does not have to be recompiled and redeployed.

Is This Answer Correct ?    2 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I check in my code whether a maximum limit of database connections have been reached?

1028


Differentiate between type_scroll_insensitive and type_scroll_sensitive.

970


How to update a resultset programmatically?

1138


What are drivers available?

1065


How do I stop nullpointerexception?

1024


What are restrictions on triggers?

2290


What are the different types of resultset?

1021


What is jdbc and odbc?

981


Explain how data flows from view to db and reverse

2090


What is a jdbc connection pool?

997


What is the limitation of PreparedStatement and how to overcome it?

1187


Why should we close database connections in java?

1194


What are database warnings in jdbc and how can we handle database warnings in jdbc?

1042


What are the advantages of collection pools?

1102


Is it possible to connect to multiple databases simultaneously? Using single statement can one update or extract data from multiple databases?

1059