Java interview questions: – What is JDBC and steps included in the JDBC connection?

A widely asked Java interview questions in most of the Java interview.

So one can start the answer as follows: –

Definition: –

JDBC is a set of Java API for executing SQL statements. This API consists of a set of classes and interfaces to enable programs to write pure Java Database applications.

Steps in the JDBC connection: –

Step 1: Register the database driver by using:

Class.forName(\" driver class for that specific database\" );

Step 2: Now create a database connection using:

Connection con = DriverManager.getConnection(url,username,password);

Step 3: Now create a query using:

Statement stmt = Connection.Statement(\"select * from TABLE NAME\");

Step 4: Execute the query:

stmt.exceuteUpdate();

Also see the following video on Java Builder Design Pattern as follows: –

Know more on Java interview questions

Regards,

Get more on Java interview questions from author’s blog.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s