Explain the sequence of steps to connect to the database?

Answers were Sorted based on User's Feedback



Explain the sequence of steps to connect to the database?..

Answer / devarathnam c,kotagudibanda(po

Hi... These are the steps to connecting to the database
1: Loading the drivers
2:Get the connection
3:Create the statement
4:Execute the query
5:Process the resultset
6:Close the connection

Is This Answer Correct ?    18 Yes 0 No

Explain the sequence of steps to connect to the database?..

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

Explain the sequence of steps to connect to the database?..

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

Post New Answer

More JDBC Interview Questions

What is jdbc and jdbc drivers?

0 Answers  


What are the conditions applies to varchar variable, when using in procedures?

0 Answers  


What is ODBC and JDBC? How do you connect the Database?

0 Answers  


RowSetInternal caller and returns void. What can I do in the readData method?

0 Answers  


What is odbc and jdbc?

0 Answers  






What is JDBC Connection isolation levels?

0 Answers  


What is odbc jdbc?

0 Answers  


What is connection pooling? What Method and class used for Connection pooling in Java?

2 Answers  


How does JDBC API helps us in achieving loose coupling between Java Program and JDBC Drivers API?

0 Answers  


What is Apache DBCP API?

0 Answers  


Why resultset is used in java?

0 Answers  


Why is odbc needed?

0 Answers  


Categories