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

Briefly tell about the jdbc architecture.

0 Answers  

How to update a resultset programmatically?

0 Answers  

What is SQL Warning? How to retrieve SQL warnings in the JDBC program?

0 Answers  

Can we make a database connection from HTML ?

6 Answers   Aptech, Wipro, Cap Gemini, BOB Technologies,

What is the purpose of the jdbc resultset interface?

0 Answers  

how can connection with oracle10g with java

3 Answers   IonIdea,

Difference between Generic Servlet and HTTP Servlet?

13 Answers  

How to insert and delete a row programmatically? (new feature in JDBC 2.0)

0 Answers  

How we can you use preparedstatement.

0 Answers  

What do you mean by database connection pooling?

0 Answers  

PreparedStatement is a pre compiled statement but where it's pre compiled ?

4 Answers  

What is phantom read and which isolation level prevents it?

0 Answers