Explain the sequence of steps to connect to the database?
Answers were Sorted based on User's Feedback
Answer / v.kannan
1.Register the Driver
2.Mention the Database Name
3.get the Connection through Driver Manager
4.send the Sql Query
5.get the result through ResultSet
|Is This Answer Correct ?||7 Yes||1 No|
Answer / 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|
commit() and rollback() methods are defined in which interface?
What does executeupdate return in java?
What is Apache DBCP API?
What is the role of class.forname while loading drivers?
write down exceptions those appear in java programs when u write JDBC Programs?
what are the drawbacks of JDBC? explain briefly?
How you restrict a user to cut and paste from the html page using java programing?
Which type of driver provides jdbc access via one or more odbc drivers?
How does jdbc driver work?
What is an escape syntax?
What is ojdbc14 jar?
what is metadata and it's use?