Posts

Showing posts with the label statement

JDBC interview questions and answers

1. What is the JDBC? A. Java Database Connectivity (JDBC) is a standard Java API to interact with relational database form Java. JDBC has set of classes and interfaces which can use from Java application and talk to database without learning RDBMS details and using Database specific JDBC Drivers. 2. What are the new features added to JDBC 4.0? A. The major features added in JDBC 4.0 includes:        • Connection management enhancements        • Support for RowId SQL type        • provides SQL DataSet implementation using annotations        • SQL exception handling enhancements        • SQL XML support 3. Explain basic steps in writing a java program using JDBC? A. JDBC makes the interaction with RDBMS simple and interactive. When a java application needs to access database, Loads RDBMS specific JDBC driver because this driver actually communicates with the ...

How to retrieve data from table by using JDBC with example

To retrieve data from mysql data table by using jdbc, we need to confirm weather which table data we need to retrieve. To confirm open your mysql and view all database names by using the ' show databases ' commands in mysql. Then select which is your database name from showing list of database names, by using the ' use <database name> ' command in mysql. Then we need to see all your existing tables by executing the ' show tables ' command. This command gives you the list of existing tables in your selected database. You need to use existing table only you can follow with that. But, here we will see with entirely new which is not existing in mysql database. Now, We will create simple mysql table with minimal columns. create table emp(eno integer(10), ename varchar(30), sal float); The above command creates a new table, we will move further to insert records into emp table by executing the insert which we mentioned in the below. ...