SlideShare a Scribd company logo
1 of 5
1. package Examples;
import java.sql.*;
public class DBTwoTables {
public DBTwoTables()
{
// Load the JDBC driver
try{
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Driver loaded");
// Establish a connection
Connection connection = DriverManager.getConnection
("jdbc:mysql://localhost/test", "root", "root");
System.out.println("Database connected");
// Create a statement
Statement statement = connection.createStatement();
// Execute a statement
ResultSet resultSet = statement.executeQuery("select
e.empId,e.empName,c.comBranch from tblCompany1 c,tblEmployee e where c.comNo=e.comNo
and c.comNo='com1' ");
// Iterate through the result and print the student names
while(resultSet.next() )
{
System.out.println(resultSet.getString(1)+ "t" +
resultSet.getString(2)+ "t" + resultSet.getString(3));
}
// Close the connection
connection.close();
}
catch (ClassNotFoundException ex )
{
System.out.println(ex.getMessage());
}
catch (SQLException ex )
{
System.out.println(ex.getMessage());
//ex.printStackTrace();
}
}
public static void main(String args[]) throws SQLException
,ClassNotFoundException
{
DBTwoTables d1=new DBTwoTables();
}
}
2. package Examples;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Bk
*/
/*import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.SQLException;
import java.sql.ResultSet;
*/
import java.sql.*;
public class Db1 {
public static void main(String args[]) throws
SQLException,ClassNotFoundException {
// Load the JDBC driver
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Driver loaded");
// Establish a connection
Connection connection = DriverManager.getConnection
("jdbc:mysql://localhost/dbsample", "root", "root");
System.out.println("Database connected");
// Create a statement
Statement statement = connection.createStatement();
// Execute a statement
ResultSet resultSet = statement.executeQuery("select * from tblemployee");
// Iterate through the result and print the student names
while(resultSet.next() ){
System.out.println(resultSet.getString(1)+ "t" +
resultSet.getString(2)+ "t" + resultSet.getString(3));
}
// Close the connection
connection.close();
}
}
3. package Examples;
import java.sql.*;
public class DBUpdate {
public DBUpdate()
{
// Load the JDBC driver
try{
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Driver loaded");
// Establish a connection
Connection connection = DriverManager.getConnection
("jdbc:mysql://localhost/test", "root", "root");
System.out.println("Database connected");
// Create a statement
Statement statement = connection.createStatement();
// Execute a statement
statement.executeUpdate("update tblCompany1 set comBranch='Bole' where
comBranch like'S%' ");
System.out.println("the update is successful");
// Iterate through the result and print the student names
/*while(resultSet.next() )
{
System.out.println(resultSet.getString(1)+ "t" +
resultSet.getString(2)+ "t" + resultSet.getString(3));
}
*/
// Close the connection
connection.close();
}
catch (ClassNotFoundException ex )
{
System.out.println(ex.getMessage());
}
catch (SQLException ex )
{
System.out.println(ex.getMessage());
//ex.printStackTrace();
}
}
public static void main(String args[]) throws SQLException
,ClassNotFoundException
{
DBUpdate d1=new DBUpdate();
}
}
4.package Examples;
import java.sql.*;
public class DBDelete {
public DBDelete()
{
// Load the JDBC driver
try{
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Driver loaded");
// Establish a connection
Connection connection = DriverManager.getConnection
("jdbc:mysql://localhost/test", "root", "root");
System.out.println("Database connected");
// Create a statement
Statement statement = connection.createStatement();
// Execute a statement
statement.executeUpdate("delete from tblEmployee where empName='dady'
");
System.out.println("the update is successful");
// Iterate through the result and print the student names
/*while(resultSet.next() )
{
System.out.println(resultSet.getString(1)+ "t" +
resultSet.getString(2)+ "t" + resultSet.getString(3));
}
*/
// Close the connection
connection.close();
}
catch (ClassNotFoundException ex )
{
System.out.println(ex.getMessage());
}
catch (SQLException ex )
{
System.out.println(ex.getMessage());
//ex.printStackTrace();
}
}
public static void main(String args[]) throws SQLException
,ClassNotFoundException
{
DBDelete d1=new DBDelete();
}
}

More Related Content

What's hot

React Native: JS MVC Meetup #15
React Native: JS MVC Meetup #15React Native: JS MVC Meetup #15
React Native: JS MVC Meetup #15Rob Gietema
 
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code ExampleMaven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code ExampleNikhil Bhalwankar
 
Windows 7 64 java envirenment build
Windows 7 64 java envirenment buildWindows 7 64 java envirenment build
Windows 7 64 java envirenment buildLifeng (Aaron) Han
 
Continuous Integration and Drupal
Continuous Integration and DrupalContinuous Integration and Drupal
Continuous Integration and DrupalSteven Merrill
 
Mapping and listing in mule
Mapping and listing in muleMapping and listing in mule
Mapping and listing in muleKhan625
 
OpenDMS - the first 2 weeks
OpenDMS - the first 2 weeksOpenDMS - the first 2 weeks
OpenDMS - the first 2 weeksJPC Hanson
 
#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...탑크리에듀(구로디지털단지역3번출구 2분거리)
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with muleKhan625
 
Running ms sql stored procedures in mule
Running ms sql stored procedures in muleRunning ms sql stored procedures in mule
Running ms sql stored procedures in muleAnilKumar Etagowni
 
Assertj-DB
Assertj-DBAssertj-DB
Assertj-DBfbenault
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mulePraneethchampion
 

What's hot (17)

Jdbc
JdbcJdbc
Jdbc
 
java script
java scriptjava script
java script
 
React Native: JS MVC Meetup #15
React Native: JS MVC Meetup #15React Native: JS MVC Meetup #15
React Native: JS MVC Meetup #15
 
DbSetup
DbSetupDbSetup
DbSetup
 
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code ExampleMaven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
Maven + Jsf + Richfaces + Jxl + Jdbc - Complete Code Example
 
Mysql
MysqlMysql
Mysql
 
Windows 7 64 java envirenment build
Windows 7 64 java envirenment buildWindows 7 64 java envirenment build
Windows 7 64 java envirenment build
 
Jdbc[1]
Jdbc[1]Jdbc[1]
Jdbc[1]
 
Continuous Integration and Drupal
Continuous Integration and DrupalContinuous Integration and Drupal
Continuous Integration and Drupal
 
Mapping and listing in mule
Mapping and listing in muleMapping and listing in mule
Mapping and listing in mule
 
OpenDMS - the first 2 weeks
OpenDMS - the first 2 weeksOpenDMS - the first 2 weeks
OpenDMS - the first 2 weeks
 
#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
#31.스프링프레임워크 & 마이바티스 (Spring Framework, MyBatis)_스프링프레임워크 강좌, 재직자환급교육,실업자국비지원...
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 
Jdbc2016
Jdbc2016Jdbc2016
Jdbc2016
 
Running ms sql stored procedures in mule
Running ms sql stored procedures in muleRunning ms sql stored procedures in mule
Running ms sql stored procedures in mule
 
Assertj-DB
Assertj-DBAssertj-DB
Assertj-DB
 
Mapping and listing with mule
Mapping and listing with muleMapping and listing with mule
Mapping and listing with mule
 

Viewers also liked

Trendsilvania: The Game
Trendsilvania: The GameTrendsilvania: The Game
Trendsilvania: The GamePaloma Moreda
 
Catherine Calanni Resume 3 5 15
Catherine Calanni Resume 3 5 15Catherine Calanni Resume 3 5 15
Catherine Calanni Resume 3 5 15Catherine Calanni
 
Data mining chapter04and5-best
Data mining chapter04and5-bestData mining chapter04and5-best
Data mining chapter04and5-bestABDUmomo
 
Java how to_program__7th_edition
Java how to_program__7th_editionJava how to_program__7th_edition
Java how to_program__7th_editionABDUmomo
 
Chapter 2 multimedia authoring and tools
Chapter 2 multimedia authoring and toolsChapter 2 multimedia authoring and tools
Chapter 2 multimedia authoring and toolsABDUmomo
 
Chapter 1 introduction to multimedia
Chapter 1 introduction to multimediaChapter 1 introduction to multimedia
Chapter 1 introduction to multimediaABDUmomo
 
Cloud Computing Impact on SE by Arman Taherian
Cloud Computing Impact on SE by Arman TaherianCloud Computing Impact on SE by Arman Taherian
Cloud Computing Impact on SE by Arman TaherianArman Taherian
 
Tayyab ul warda fi sharha burda by allama abul hasnat syed muhammad ahmad qadri
Tayyab ul warda fi sharha burda by allama abul hasnat syed muhammad ahmad qadriTayyab ul warda fi sharha burda by allama abul hasnat syed muhammad ahmad qadri
Tayyab ul warda fi sharha burda by allama abul hasnat syed muhammad ahmad qadrisunninews92
 

Viewers also liked (12)

Trendsilvania: The Game
Trendsilvania: The GameTrendsilvania: The Game
Trendsilvania: The Game
 
Body of Work2
Body of Work2Body of Work2
Body of Work2
 
PAES 2015
PAES 2015PAES 2015
PAES 2015
 
Catherine Calanni Resume 3 5 15
Catherine Calanni Resume 3 5 15Catherine Calanni Resume 3 5 15
Catherine Calanni Resume 3 5 15
 
Data mining chapter04and5-best
Data mining chapter04and5-bestData mining chapter04and5-best
Data mining chapter04and5-best
 
Java how to_program__7th_edition
Java how to_program__7th_editionJava how to_program__7th_edition
Java how to_program__7th_edition
 
Chapter 2 multimedia authoring and tools
Chapter 2 multimedia authoring and toolsChapter 2 multimedia authoring and tools
Chapter 2 multimedia authoring and tools
 
Chapter 1 introduction to multimedia
Chapter 1 introduction to multimediaChapter 1 introduction to multimedia
Chapter 1 introduction to multimedia
 
Cloud Computing Impact on SE by Arman Taherian
Cloud Computing Impact on SE by Arman TaherianCloud Computing Impact on SE by Arman Taherian
Cloud Computing Impact on SE by Arman Taherian
 
Concorso shoah
Concorso shoahConcorso shoah
Concorso shoah
 
Livescores
LivescoresLivescores
Livescores
 
Tayyab ul warda fi sharha burda by allama abul hasnat syed muhammad ahmad qadri
Tayyab ul warda fi sharha burda by allama abul hasnat syed muhammad ahmad qadriTayyab ul warda fi sharha burda by allama abul hasnat syed muhammad ahmad qadri
Tayyab ul warda fi sharha burda by allama abul hasnat syed muhammad ahmad qadri
 

Similar to Db examples

Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1Zianed Hou
 
JDBC Connecticity.ppt
JDBC Connecticity.pptJDBC Connecticity.ppt
JDBC Connecticity.pptSwapnil Kale
 
Database connect
Database connectDatabase connect
Database connectYoga Raja
 
This is a basic JAVA pgm that contains all of the major compoents of DB2
This is a basic JAVA pgm that contains all of the major compoents of DB2This is a basic JAVA pgm that contains all of the major compoents of DB2
This is a basic JAVA pgm that contains all of the major compoents of DB2Sheila A. Bell, MS, PMP
 
30 5 Database Jdbc
30 5 Database Jdbc30 5 Database Jdbc
30 5 Database Jdbcphanleson
 
JDBC for CSQL Database
JDBC for CSQL DatabaseJDBC for CSQL Database
JDBC for CSQL Databasejitendral
 
Refactoring Jdbc Programming
Refactoring Jdbc ProgrammingRefactoring Jdbc Programming
Refactoring Jdbc Programmingchanwook Park
 
Introduction to JDBC and database access in web applications
Introduction to JDBC and database access in web applicationsIntroduction to JDBC and database access in web applications
Introduction to JDBC and database access in web applicationsFulvio Corno
 

Similar to Db examples (20)

Jdbc tutorial
Jdbc tutorialJdbc tutorial
Jdbc tutorial
 
Jdbc
JdbcJdbc
Jdbc
 
JDBC Tutorial
JDBC TutorialJDBC Tutorial
JDBC Tutorial
 
22jdbc
22jdbc22jdbc
22jdbc
 
Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1Tomcat连接池配置方法V2.1
Tomcat连接池配置方法V2.1
 
Data Access with JDBC
Data Access with JDBCData Access with JDBC
Data Access with JDBC
 
JDBC Connecticity.ppt
JDBC Connecticity.pptJDBC Connecticity.ppt
JDBC Connecticity.ppt
 
Database connect
Database connectDatabase connect
Database connect
 
JDBC programming
JDBC programmingJDBC programming
JDBC programming
 
Scrollable Test App
Scrollable Test AppScrollable Test App
Scrollable Test App
 
Lecture 1. java database connectivity
Lecture 1. java database connectivityLecture 1. java database connectivity
Lecture 1. java database connectivity
 
This is a basic JAVA pgm that contains all of the major compoents of DB2
This is a basic JAVA pgm that contains all of the major compoents of DB2This is a basic JAVA pgm that contains all of the major compoents of DB2
This is a basic JAVA pgm that contains all of the major compoents of DB2
 
30 5 Database Jdbc
30 5 Database Jdbc30 5 Database Jdbc
30 5 Database Jdbc
 
JDBC for CSQL Database
JDBC for CSQL DatabaseJDBC for CSQL Database
JDBC for CSQL Database
 
Jdbc
JdbcJdbc
Jdbc
 
Refactoring Jdbc Programming
Refactoring Jdbc ProgrammingRefactoring Jdbc Programming
Refactoring Jdbc Programming
 
Web based development
Web based developmentWeb based development
Web based development
 
Introduction to JDBC and database access in web applications
Introduction to JDBC and database access in web applicationsIntroduction to JDBC and database access in web applications
Introduction to JDBC and database access in web applications
 
JDBC Part - 2
JDBC Part - 2JDBC Part - 2
JDBC Part - 2
 
JDBC (2).ppt
JDBC (2).pptJDBC (2).ppt
JDBC (2).ppt
 

Recently uploaded

Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...amitlee9823
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...amitlee9823
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsJoseMangaJr1
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxolyaivanovalion
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...amitlee9823
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...amitlee9823
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...amitlee9823
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...amitlee9823
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangaloreamitlee9823
 
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Standamitlee9823
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...amitlee9823
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...amitlee9823
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxolyaivanovalion
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 

Recently uploaded (20)

Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
Chintamani Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore ...
 
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
Call Girls Hsr Layout Just Call 👗 7737669865 👗 Top Class Call Girl Service Ba...
 
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort ServiceBDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
BDSM⚡Call Girls in Mandawali Delhi >༒8448380779 Escort Service
 
Probability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter LessonsProbability Grade 10 Third Quarter Lessons
Probability Grade 10 Third Quarter Lessons
 
CebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptxCebaBaby dropshipping via API with DroFX.pptx
CebaBaby dropshipping via API with DroFX.pptx
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
Vip Mumbai Call Girls Marol Naka Call On 9920725232 With Body to body massage...
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
Junnasandra Call Girls: 🍓 7737669865 🍓 High Profile Model Escorts | Bangalore...
 
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
Call Girls Bannerghatta Road Just Call 👗 7737669865 👗 Top Class Call Girl Ser...
 
Anomaly detection and data imputation within time series
Anomaly detection and data imputation within time seriesAnomaly detection and data imputation within time series
Anomaly detection and data imputation within time series
 
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
Call Girls Jalahalli Just Call 👗 7737669865 👗 Top Class Call Girl Service Ban...
 
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service BangaloreCall Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
Call Girls Begur Just Call 👗 7737669865 👗 Top Class Call Girl Service Bangalore
 
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bellandur ☎ 7737669865 🥵 Book Your One night Stand
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
Escorts Service Kumaraswamy Layout ☎ 7737669865☎ Book Your One night Stand (B...
 
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men  🔝malwa🔝   Escorts Ser...
➥🔝 7737669865 🔝▻ malwa Call-girls in Women Seeking Men 🔝malwa🔝 Escorts Ser...
 
Midocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFxMidocean dropshipping via API with DroFx
Midocean dropshipping via API with DroFx
 
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 

Db examples

  • 1. 1. package Examples; import java.sql.*; public class DBTwoTables { public DBTwoTables() { // Load the JDBC driver try{ Class.forName("com.mysql.jdbc.Driver"); System.out.println("Driver loaded"); // Establish a connection Connection connection = DriverManager.getConnection ("jdbc:mysql://localhost/test", "root", "root"); System.out.println("Database connected"); // Create a statement Statement statement = connection.createStatement(); // Execute a statement ResultSet resultSet = statement.executeQuery("select e.empId,e.empName,c.comBranch from tblCompany1 c,tblEmployee e where c.comNo=e.comNo and c.comNo='com1' "); // Iterate through the result and print the student names while(resultSet.next() ) { System.out.println(resultSet.getString(1)+ "t" + resultSet.getString(2)+ "t" + resultSet.getString(3)); } // Close the connection connection.close(); } catch (ClassNotFoundException ex ) { System.out.println(ex.getMessage()); } catch (SQLException ex ) { System.out.println(ex.getMessage()); //ex.printStackTrace(); }
  • 2. } public static void main(String args[]) throws SQLException ,ClassNotFoundException { DBTwoTables d1=new DBTwoTables(); } } 2. package Examples; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Bk */ /*import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; import java.sql.SQLException; import java.sql.ResultSet; */ import java.sql.*; public class Db1 { public static void main(String args[]) throws SQLException,ClassNotFoundException { // Load the JDBC driver Class.forName("com.mysql.jdbc.Driver"); System.out.println("Driver loaded"); // Establish a connection Connection connection = DriverManager.getConnection ("jdbc:mysql://localhost/dbsample", "root", "root"); System.out.println("Database connected");
  • 3. // Create a statement Statement statement = connection.createStatement(); // Execute a statement ResultSet resultSet = statement.executeQuery("select * from tblemployee"); // Iterate through the result and print the student names while(resultSet.next() ){ System.out.println(resultSet.getString(1)+ "t" + resultSet.getString(2)+ "t" + resultSet.getString(3)); } // Close the connection connection.close(); } } 3. package Examples; import java.sql.*; public class DBUpdate { public DBUpdate() { // Load the JDBC driver try{ Class.forName("com.mysql.jdbc.Driver"); System.out.println("Driver loaded"); // Establish a connection Connection connection = DriverManager.getConnection ("jdbc:mysql://localhost/test", "root", "root"); System.out.println("Database connected"); // Create a statement Statement statement = connection.createStatement(); // Execute a statement statement.executeUpdate("update tblCompany1 set comBranch='Bole' where comBranch like'S%' "); System.out.println("the update is successful"); // Iterate through the result and print the student names /*while(resultSet.next() )
  • 4. { System.out.println(resultSet.getString(1)+ "t" + resultSet.getString(2)+ "t" + resultSet.getString(3)); } */ // Close the connection connection.close(); } catch (ClassNotFoundException ex ) { System.out.println(ex.getMessage()); } catch (SQLException ex ) { System.out.println(ex.getMessage()); //ex.printStackTrace(); } } public static void main(String args[]) throws SQLException ,ClassNotFoundException { DBUpdate d1=new DBUpdate(); } } 4.package Examples; import java.sql.*; public class DBDelete { public DBDelete() { // Load the JDBC driver try{ Class.forName("com.mysql.jdbc.Driver"); System.out.println("Driver loaded");
  • 5. // Establish a connection Connection connection = DriverManager.getConnection ("jdbc:mysql://localhost/test", "root", "root"); System.out.println("Database connected"); // Create a statement Statement statement = connection.createStatement(); // Execute a statement statement.executeUpdate("delete from tblEmployee where empName='dady' "); System.out.println("the update is successful"); // Iterate through the result and print the student names /*while(resultSet.next() ) { System.out.println(resultSet.getString(1)+ "t" + resultSet.getString(2)+ "t" + resultSet.getString(3)); } */ // Close the connection connection.close(); } catch (ClassNotFoundException ex ) { System.out.println(ex.getMessage()); } catch (SQLException ex ) { System.out.println(ex.getMessage()); //ex.printStackTrace(); } } public static void main(String args[]) throws SQLException ,ClassNotFoundException { DBDelete d1=new DBDelete(); } }