SlideShare a Scribd company logo
Java Tutorial
JAVA DATA BASE CONNECTIVITY USING
ORACLE
Prepared By
Dr. G Jena
Mr. B S N Murthy
JDBC Connection using Java
• Install JDK 1.5 and JRE 1.5 or later version
• Install Oracle 9i or later versions
• Crate data source name ‘dsn’ using following
steps:
1. Got Control Panel-> Administrative Tools->
Data Sources(ODBC)
Contd…
Contd…
2. Selest ‘Add’ -> Microsoft ODBC for Oracle
Contd…
3. Click ‘Finish’ and enter Data source name
->Ok.
Contd….
step 4: Go to Connection pooling tab->
Enable->Apply->Ok
Contd…
Write the Java source Code:
import java.sql.*;
class jdbc
{
public static void main(String args[])
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:dsn3","scott","tiger");
Statement st=con.createStatement();
String sq="create table student(roll number(4),name varchar2(10))";
Contd…
st.executeUpdate(sq);
st.executeUpdate("insert into student values(501,'Murthy1')");
st.executeUpdate("insert into student values(502,'Murthy2')");
System.out.println("table created ...");
st.close(); con.close();
}
catch(Exception e) { System.out.println(e.getMessage()); }
}
}
Cont….
• Compile the source code
C:> javac jdbc.java
• Run the java code
C:> java jdbc.

More Related Content

What's hot

Java EE 8 security and JSON binding API
Java EE 8 security and JSON binding APIJava EE 8 security and JSON binding API
Java EE 8 security and JSON binding API
Alex Theedom
 
Html web sql database
Html web sql databaseHtml web sql database
Html web sql database
AbhishekMondal42
 
Jdbc oracle
Jdbc oracleJdbc oracle
Jdbc oracle
yazidds2
 
บทที่3
บทที่3บทที่3
บทที่3
Palm Unnop
 
Presentation cs313 (1)
Presentation cs313 (1)Presentation cs313 (1)
Lesson3
Lesson3Lesson3
Sequelize
SequelizeSequelize
Sequelize
Tarek Raihan
 
Simple Jdbc With Spring 2.5
Simple Jdbc With Spring 2.5Simple Jdbc With Spring 2.5
Simple Jdbc With Spring 2.5
David Motta Baldarrago
 
Connection Database
Connection DatabaseConnection Database
Connection Database
jdkkamal
 
Dropping unique constraints in sql server
Dropping unique constraints in sql serverDropping unique constraints in sql server
Dropping unique constraints in sql server
Paul Houle
 
New_DOCX_FileSavedOnSugarSync_21
New_DOCX_FileSavedOnSugarSync_21New_DOCX_FileSavedOnSugarSync_21
New_DOCX_FileSavedOnSugarSync_21
Quickoffice Test
 
Working with Cookies in NodeJS
Working with Cookies in NodeJSWorking with Cookies in NodeJS
Working with Cookies in NodeJS
Jay Dihenkar
 
Db examples
Db examplesDb examples
Db examples
ABDUmomo
 
Spring Introduction
Spring IntroductionSpring Introduction
Spring Introduction
Cao Manh Dat
 
Examplecode
ExamplecodeExamplecode
Examplecode
Sailaja Rama
 
JQuery New Evolution
JQuery New EvolutionJQuery New Evolution
JQuery New Evolution
Allan Huang
 
Creating, Updating and Deleting Document in MongoDB
Creating, Updating and Deleting Document in MongoDBCreating, Updating and Deleting Document in MongoDB
Creating, Updating and Deleting Document in MongoDB
Wildan Maulana
 
Design and develop secured oracle applications
Design and develop secured oracle applicationsDesign and develop secured oracle applications
Design and develop secured oracle applications
dyahalom
 

What's hot (18)

Java EE 8 security and JSON binding API
Java EE 8 security and JSON binding APIJava EE 8 security and JSON binding API
Java EE 8 security and JSON binding API
 
Html web sql database
Html web sql databaseHtml web sql database
Html web sql database
 
Jdbc oracle
Jdbc oracleJdbc oracle
Jdbc oracle
 
บทที่3
บทที่3บทที่3
บทที่3
 
Presentation cs313 (1)
Presentation cs313 (1)Presentation cs313 (1)
Presentation cs313 (1)
 
Lesson3
Lesson3Lesson3
Lesson3
 
Sequelize
SequelizeSequelize
Sequelize
 
Simple Jdbc With Spring 2.5
Simple Jdbc With Spring 2.5Simple Jdbc With Spring 2.5
Simple Jdbc With Spring 2.5
 
Connection Database
Connection DatabaseConnection Database
Connection Database
 
Dropping unique constraints in sql server
Dropping unique constraints in sql serverDropping unique constraints in sql server
Dropping unique constraints in sql server
 
New_DOCX_FileSavedOnSugarSync_21
New_DOCX_FileSavedOnSugarSync_21New_DOCX_FileSavedOnSugarSync_21
New_DOCX_FileSavedOnSugarSync_21
 
Working with Cookies in NodeJS
Working with Cookies in NodeJSWorking with Cookies in NodeJS
Working with Cookies in NodeJS
 
Db examples
Db examplesDb examples
Db examples
 
Spring Introduction
Spring IntroductionSpring Introduction
Spring Introduction
 
Examplecode
ExamplecodeExamplecode
Examplecode
 
JQuery New Evolution
JQuery New EvolutionJQuery New Evolution
JQuery New Evolution
 
Creating, Updating and Deleting Document in MongoDB
Creating, Updating and Deleting Document in MongoDBCreating, Updating and Deleting Document in MongoDB
Creating, Updating and Deleting Document in MongoDB
 
Design and develop secured oracle applications
Design and develop secured oracle applicationsDesign and develop secured oracle applications
Design and develop secured oracle applications
 

Viewers also liked

Gloumar delitos informaticos
Gloumar delitos informaticosGloumar delitos informaticos
Gloumar delitos informaticos
maria jose acuña mendoza
 
catec catalog 2016
catec catalog 2016catec catalog 2016
catec catalog 2016
Terrence H.F.
 
Insider_s_Tips_to_NYC
Insider_s_Tips_to_NYCInsider_s_Tips_to_NYC
Insider_s_Tips_to_NYC
Jonathan Stas
 
Curriculum Vitae.VAISALA.14.08.2015
Curriculum Vitae.VAISALA.14.08.2015Curriculum Vitae.VAISALA.14.08.2015
Curriculum Vitae.VAISALA.14.08.2015
Elena Elizarovskaya
 
The animal world!!!
The animal world!!!The animal world!!!
The animal world!!!
Stephanie Kemple
 
DELITOS INFORMÁTICOS
DELITOS INFORMÁTICOS  DELITOS INFORMÁTICOS
DELITOS INFORMÁTICOS
maria jose acuña mendoza
 
History Brochure
History BrochureHistory Brochure
History Brochure
Jonathan Stas
 
Usa politics News
Usa politics NewsUsa politics News
Usa politics News
usaPoliticsnews
 
Rmi ppt
Rmi pptRmi ppt

Viewers also liked (9)

Gloumar delitos informaticos
Gloumar delitos informaticosGloumar delitos informaticos
Gloumar delitos informaticos
 
catec catalog 2016
catec catalog 2016catec catalog 2016
catec catalog 2016
 
Insider_s_Tips_to_NYC
Insider_s_Tips_to_NYCInsider_s_Tips_to_NYC
Insider_s_Tips_to_NYC
 
Curriculum Vitae.VAISALA.14.08.2015
Curriculum Vitae.VAISALA.14.08.2015Curriculum Vitae.VAISALA.14.08.2015
Curriculum Vitae.VAISALA.14.08.2015
 
The animal world!!!
The animal world!!!The animal world!!!
The animal world!!!
 
DELITOS INFORMÁTICOS
DELITOS INFORMÁTICOS  DELITOS INFORMÁTICOS
DELITOS INFORMÁTICOS
 
History Brochure
History BrochureHistory Brochure
History Brochure
 
Usa politics News
Usa politics NewsUsa politics News
Usa politics News
 
Rmi ppt
Rmi pptRmi ppt
Rmi ppt
 

Similar to Jdbc2016

Lecture 1. java database connectivity
Lecture 1. java database connectivityLecture 1. java database connectivity
Lecture 1. java database connectivity
Waheedullah Suliman Khail
 
Jdbc Complete Notes by Java Training Center (Som Sir)
Jdbc Complete Notes by Java Training Center (Som Sir)Jdbc Complete Notes by Java Training Center (Som Sir)
Jdbc Complete Notes by Java Training Center (Som Sir)
Som Prakash Rai
 
22jdbc
22jdbc22jdbc
22jdbc
Adil Jafri
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
sandeep54552
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
Tanmoy Barman
 
Jdbc drivers
Jdbc driversJdbc drivers
Jdbc drivers
Prabhat gangwar
 
Jdbc
Jdbc   Jdbc
Jdbc
Ishucs
 
Jdbc
JdbcJdbc
Jdbc
lathasiva
 
Jdbc
JdbcJdbc
Jdbc
Ishucs
 
10 J D B C
10  J D B C10  J D B C
10 J D B C
guest04b824
 
java arlow jdbc tutorial(java programming tutorials)
java arlow jdbc tutorial(java programming tutorials)java arlow jdbc tutorial(java programming tutorials)
java arlow jdbc tutorial(java programming tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
JDBC Part - 2
JDBC Part - 2JDBC Part - 2
JDBC Part - 2
Hitesh-Java
 
JDBC
JDBCJDBC
Jdbc
JdbcJdbc
Session 24 - JDBC, Intro to Enterprise Java
Session 24 - JDBC, Intro to Enterprise JavaSession 24 - JDBC, Intro to Enterprise Java
Session 24 - JDBC, Intro to Enterprise Java
PawanMM
 
Slide Latihan JDBC
Slide Latihan JDBCSlide Latihan JDBC
Slide Latihan JDBC
Bayu Rimba
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
Atul Saurabh
 
Jdbc day-1
Jdbc day-1Jdbc day-1
Jdbc day-1
Soham Sengupta
 
JDBC ppt
JDBC pptJDBC ppt
JDBC ppt
Rohit Jain
 
Jdbc
JdbcJdbc

Similar to Jdbc2016 (20)

Lecture 1. java database connectivity
Lecture 1. java database connectivityLecture 1. java database connectivity
Lecture 1. java database connectivity
 
Jdbc Complete Notes by Java Training Center (Som Sir)
Jdbc Complete Notes by Java Training Center (Som Sir)Jdbc Complete Notes by Java Training Center (Som Sir)
Jdbc Complete Notes by Java Training Center (Som Sir)
 
22jdbc
22jdbc22jdbc
22jdbc
 
Jdbc ppt
Jdbc pptJdbc ppt
Jdbc ppt
 
JDBC: java DataBase connectivity
JDBC: java DataBase connectivityJDBC: java DataBase connectivity
JDBC: java DataBase connectivity
 
Jdbc drivers
Jdbc driversJdbc drivers
Jdbc drivers
 
Jdbc
Jdbc   Jdbc
Jdbc
 
Jdbc
JdbcJdbc
Jdbc
 
Jdbc
JdbcJdbc
Jdbc
 
10 J D B C
10  J D B C10  J D B C
10 J D B C
 
java arlow jdbc tutorial(java programming tutorials)
java arlow jdbc tutorial(java programming tutorials)java arlow jdbc tutorial(java programming tutorials)
java arlow jdbc tutorial(java programming tutorials)
 
JDBC Part - 2
JDBC Part - 2JDBC Part - 2
JDBC Part - 2
 
JDBC
JDBCJDBC
JDBC
 
Jdbc
JdbcJdbc
Jdbc
 
Session 24 - JDBC, Intro to Enterprise Java
Session 24 - JDBC, Intro to Enterprise JavaSession 24 - JDBC, Intro to Enterprise Java
Session 24 - JDBC, Intro to Enterprise Java
 
Slide Latihan JDBC
Slide Latihan JDBCSlide Latihan JDBC
Slide Latihan JDBC
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
 
Jdbc day-1
Jdbc day-1Jdbc day-1
Jdbc day-1
 
JDBC ppt
JDBC pptJDBC ppt
JDBC ppt
 
Jdbc
JdbcJdbc
Jdbc
 

Recently uploaded

Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
Hitesh Mohapatra
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
abbyasa1014
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
UReason
 
Hematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood CountHematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood Count
shahdabdulbaset
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
bijceesjournal
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
171ticu
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
KrishnaveniKrishnara1
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
co23btech11018
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
ecqow
 
Introduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptxIntroduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptx
MiscAnnoy1
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
Roger Rozario
 
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
ydzowc
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
Madan Karki
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
Yasser Mahgoub
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
LAXMAREDDY22
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
gerogepatton
 

Recently uploaded (20)

Generative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of contentGenerative AI leverages algorithms to create various forms of content
Generative AI leverages algorithms to create various forms of content
 
Engineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdfEngineering Drawings Lecture Detail Drawings 2014.pdf
Engineering Drawings Lecture Detail Drawings 2014.pdf
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
 
Hematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood CountHematology Analyzer Machine - Complete Blood Count
Hematology Analyzer Machine - Complete Blood Count
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...Comparative analysis between traditional aquaponics and reconstructed aquapon...
Comparative analysis between traditional aquaponics and reconstructed aquapon...
 
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样学校原版美国波士顿大学毕业证学历学位证书原版一模一样
学校原版美国波士顿大学毕业证学历学位证书原版一模一样
 
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.pptUnit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
Unit-III-ELECTROCHEMICAL STORAGE DEVICES.ppt
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Computational Engineering IITH Presentation
Computational Engineering IITH PresentationComputational Engineering IITH Presentation
Computational Engineering IITH Presentation
 
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
一比一原版(CalArts毕业证)加利福尼亚艺术学院毕业证如何办理
 
Introduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptxIntroduction to AI Safety (public presentation).pptx
Introduction to AI Safety (public presentation).pptx
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
 
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
原版制作(Humboldt毕业证书)柏林大学毕业证学位证一模一样
 
Manufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptxManufacturing Process of molasses based distillery ppt.pptx
Manufacturing Process of molasses based distillery ppt.pptx
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
2008 BUILDING CONSTRUCTION Illustrated - Ching Chapter 02 The Building.pdf
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
BRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdfBRAIN TUMOR DETECTION for seminar ppt.pdf
BRAIN TUMOR DETECTION for seminar ppt.pdf
 
International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...International Conference on NLP, Artificial Intelligence, Machine Learning an...
International Conference on NLP, Artificial Intelligence, Machine Learning an...
 

Jdbc2016

  • 1. Java Tutorial JAVA DATA BASE CONNECTIVITY USING ORACLE Prepared By Dr. G Jena Mr. B S N Murthy
  • 2. JDBC Connection using Java • Install JDK 1.5 and JRE 1.5 or later version • Install Oracle 9i or later versions • Crate data source name ‘dsn’ using following steps: 1. Got Control Panel-> Administrative Tools-> Data Sources(ODBC)
  • 4. Contd… 2. Selest ‘Add’ -> Microsoft ODBC for Oracle
  • 5. Contd… 3. Click ‘Finish’ and enter Data source name ->Ok.
  • 6. Contd…. step 4: Go to Connection pooling tab-> Enable->Apply->Ok
  • 7. Contd… Write the Java source Code: import java.sql.*; class jdbc { public static void main(String args[]) { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:dsn3","scott","tiger"); Statement st=con.createStatement(); String sq="create table student(roll number(4),name varchar2(10))";
  • 8. Contd… st.executeUpdate(sq); st.executeUpdate("insert into student values(501,'Murthy1')"); st.executeUpdate("insert into student values(502,'Murthy2')"); System.out.println("table created ..."); st.close(); con.close(); } catch(Exception e) { System.out.println(e.getMessage()); } } }
  • 9. Cont…. • Compile the source code C:> javac jdbc.java • Run the java code C:> java jdbc.