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
How to set the attribute concurrency in resultset?
How can you make a connection?
What is metadata in java programming?
Why do we need jdbc api?
What does jdbc stand for?
What causes the "No suitable driver" error?
What are the factors that the jdbc driver performance depends upon?
What is a jdbc connection?
How java can be connected to a database?
Which package contains jdbc api?
Is jdbc connection secure?
What is meant by jdbc and odbc?
What is JDBC Statement?
What are the advantages of using preparedstatement over statement?
How many types of jdbc drivers are available?