Basics of jdbc programming Tutorial -2
This video deals with the steps involved in writing a jdbc program.
I have included a basic jdbc program to understand the basic concept.
JDBC Driver
-A JDBC driver is a software component enabling a Java application to interact with a database.
-To connect with individual databases, JDBC (the Java Database Connectivity API)
requires drivers for each database.
-the JDBC driver contains Classes & Interfaces which are used to interact with database.
Examples:
1. sun.jdbc.odbc.JdbcOdbcDriver (Bridge driver/Type 1)
2. oracle.jdbc.driver.OracleDriver (Type-4 driver for Oracle database)
3. com.mysql.jdbc.Driver (Type-4 driver for mysql database)
;etc
Steps in writing a Jdbc program
1. Registering to a database
Here we need to register the database driver so as to use the packages,interfaces and classes
that gets automatically loaded.
Class.forName("oracle.jdbc.driver.OracleDriver");
2. Connecting to a database
Here we establish a connection to a specific DB through the driver which is already registered
in the previous step-
Connection con=DriverManager.getConnection("URL","USERID","PASSWORD");
3. Preparing the Sql statement
sql statements are of 2 types:
1.select
2.Non-select
we have generally the CRUD operations to be performed on the database:
C-Create
R-Read
U-update
D-delete
we generally have 3 types of statements used :
a. Statement
b. PreparedStatement
c. CollableStatement
ex:
Statement st=con.createStatement();
PreparedStatement pst=con.prepareStatement(query);
CollableStatement cst=con.prepareCall(query);
4.Executing the sql query on the database
To execute the queries the Statement interface provides the following methods:
a. execute();-used mainly for select in pl/sql
b. executeQuery();-used mainly for select statement
c. executeUpdate();-used mainly for non-select statement
5.Retrieving the Result
-For non-select,we store the result in integer return variable ,as we do the insertion,deletion and updation of the database
-For select statement ,we will craete reference of ResultSet interface to retrieve the table
6.Closing the Connection
con.close();
Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Basics of jdbc programming Tutorial -2», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.
Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.
Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!
Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.