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 does a custom RowSetReader get called from a CachedRowSet?
How do I receive a ResultSet from a stored procedure?
What driver should I use for scalable Oracle JDBC applications?
What are the common jdbc exceptions?
What are the functions of the jdbc connection interface?
What is meant by connection string?
What is jdbc in java?
RowSetInternal caller and returns void. What can I do in the readData method?
How can we set null value in jdbc preparedstatement?
How to insert and delete a row programmatically? (new feature in JDBC 2.0)
Why resultset is used in java?
Explain about the drive manager class working?
What are 4 drivers available in JDBC? At what situation are four of the drivers used?
How can you retrieve data from the resultset using jdbc?
What is serialization and deserialization in java programming?