Posts

Showing posts with the label retrieve data from table by using jdbc

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.