JDBC. It is connected by Native Module of dependent form of H/W like.dll or.so. ex) OCI driver for local connection to Oracle

Similar documents
JDBC. It is connected by the Native Module of dependent form of h/w like.dll or.so. ex) OCI driver for local connection to Oracle

Supplement IV.D: Tutorial for MS Access. For Introduction to Java Programming By Y. Daniel Liang

Querying Databases Using the DB Query and JDBC Query Nodes

Supplement IV.C: Tutorial for Oracle. For Introduction to Java Programming By Y. Daniel Liang

How To Use The Database In Jdbc.Com On A Microsoft Gdbdns.Com (Amd64) On A Pcode (Amd32) On An Ubuntu (Amd66) On Microsoft

Java and Databases. COMP514 Distributed Information Systems. Java Database Connectivity. Standards and utilities. Java and Databases

What is ODBC? Database Connectivity ODBC, JDBC and SQLJ. ODBC Architecture. More on ODBC. JDBC vs ODBC. What is JDBC?

DATABASDESIGN FÖR INGENJÖRER - 1DL124

SQL and Java. Database Systems Lecture 19 Natasha Alechina

Database Access from a Programming Language: Database Access from a Programming Language

Database Access from a Programming Language:

Using Netbeans and the Derby Database for Projects Contents

Microsoft SQL Server Features that can be used with the IBM i

Apéndice C: Código Fuente del Programa DBConnection.java

General Tips: Page 1 of 20. By Khaled Elshaer.

Voyager Reporting System (VRS) Installation Guide. Revised 5/09/06

MAKING ORACLE AND SQLJ WORK FOR YOU John Jay King, King Training Resources

CHAPTER 3. Relational Database Management System: Oracle. 3.1 COMPANY Database

CS/CE 2336 Computer Science II

Connect to MySQL or Microsoft SQL Server using R

CIMHT_006 How to Configure the Database Logger Proficy HMI/SCADA CIMPLICITY

How to Connect to CDL SQL Server Database via Internet

How to Install Java onto your system

FileMaker 8. Installing FileMaker 8 ODBC and JDBC Client Drivers

Chapter 9 Java and SQL. Wang Yang wyang@njnet.edu.cn

FileMaker 11. ODBC and JDBC Guide

Installation Instruction STATISTICA Enterprise Small Business

FileMaker 14. ODBC and JDBC Guide

OpenScape Business V2

Java Software Development Kit (JDK 5.0 Update 14) Installation Step by Step Instructions

Install MS SQL Server 2012 Express Edition

STATISTICA VERSION 12 STATISTICA ENTERPRISE SMALL BUSINESS INSTALLATION INSTRUCTIONS

Database Programming. Week *Some of the slides in this lecture are created by Prof. Ian Horrocks from University of Oxford

Introduction to Hadoop on the cloud using BigInsights on BlueMix Feb , 2014

SonicWALL Global Management System Installation Guide Entry Edition. Version 2.1

MS SQL Server Database Management

The JAVA Way: JDBC and SQLJ

INTRODUCTION: SQL SERVER ACCESS / LOGIN ACCOUNT INFO:

OPENRULES. Database Integration. Open Source Business Decision Management System. Release 6.2.1

RE:Open for SQL Anywhere. Installation Guide. RE:Open for SQL Anywhere Installation Guide 1

Migrating helpdesk to a new server

APIS CARM NG Quick Start Guide for MS Windows

2. Follow the installation directions and install the server on ccc

Connecting to SQL server

Installation of IBM DB2 9.1.x and Q-Monitor 3.x.x

Aradial Installation Guide

Installation of MSSQL Server 2005 Express Edition and Q-Monitor 3.x.x

CS2506 Operating Systems II Lab 8, 8 th Tue/03 /2011 Java API

JDBC (Java / SQL Programming) CS 377: Database Systems

for Networks Installation Guide for the application on the server August 2014 (GUIDE 2) Lucid Exact Version 1.7-N and later

4D v1x ODBC Driver INSTALLATION GUIDE

for Networks Installation Guide for the application on the server July 2014 (GUIDE 2) Lucid Rapid Version 6.05-N and later

Kony MobileFabric. Sync Windows Installation Manual - WebSphere. On-Premises. Release 6.5. Document Relevance and Accuracy

Supplement I.B: Installing and Configuring JDK 1.6

Installing Java (Windows) and Writing your First Program

Part IV: Java Database Programming

Using the DataDirect Connect for JDBC Drivers with the Sun Java System Application Server

CS 377 Database Systems SQL Programming. Li Xiong Department of Mathematics and Computer Science Emory University

AWS Schema Conversion Tool. User Guide Version 1.0

Converting InfoPlus.21 Data to a Microsoft SQL Server 2000 Database

AWS Schema Conversion Tool. User Guide Version 1.0

Installation of MSSQL Server 2008 Express Edition and Q-Monitor 3.x.x

Installation Guide for Websphere ND

How-to configure Auditing for IDENTIKEY Authentication Server 3.2 to a remote Oracle Database on a standalone Microsoft machine.

Supplement I.B: Installing and Configuring JDK 1.6

ORACLE BUSINESS INTELLIGENCE WORKSHOP. Prerequisites for Oracle BI Workshop

ODBC Driver Version 4 Manual

NGASI AppServer Manager SaaS/ASP Hosting Automation for Cloud Computing Administrator and User Guide

Witango Application Server 6. Installation Guide for Windows

FileMaker 12. ODBC and JDBC Guide

CONFIGURATION AND APPLICATIONS DEPLOYMENT IN WEBSPHERE 6.1

HP Client Automation Standard Fast Track guide

Installation Instruction STATISTICA Enterprise Server

ODBC (Open Database Connectivity) for MS-Excel Microsoft OLE DB Provider for ODBC Drivers (Legitronic v3.6.2 & Later)

Setting Up a Windows Virtual Machine for SANS FOR526

Security Module: SQL Injection

Installing The SysAidTM Server Locally

COSC344 Database Theory and Applications. Java and SQL. Lecture 12

FileMaker 13. ODBC and JDBC Guide

Dell Statistica Statistica Enterprise Installation Instructions

Migrating a Database from Legi for Windows 2.X to MS Access

Millennium Drive. Installation Guide

Creating an Open Catalog Extension (OCE)

STATISTICA VERSION 9 STATISTICA ENTERPRISE INSTALLATION INSTRUCTIONS FOR USE WITH TERMINAL SERVER

Matisse Installation Guide for MS Windows. 10th Edition

IceWarp Server Windows Installation Guide

Download Path for 7 Zip : ( Username & Password to download = sqlutility ) **Make sure install the right one or else you can t find 7 Zip to Extract.

PowerSchool Student Information System

Matisse Installation Guide for MS Windows

Source A.Kishore SAP 4.7 Installation Guide (Part-2)

LAB 6: Code Generation with Visual Paradigm for UML and JDBC Integration

Microsoft Business Intelligence 2012 Single Server Install Guide

Appendix A Using the Java Compiler

LAB 1. Familiarization of Rational Rose Environment And UML for small Java Application Development

Crystal Reports Installation Guide

WA1826 Designing Cloud Computing Solutions. Classroom Setup Guide. Web Age Solutions Inc. Copyright Web Age Solutions Inc. 1

Microsoft SQL Server Features that can be used with the IBM i

NovaBACKUP xsp Version 15.0 Upgrade Guide

WebSphere Business Monitor V7.0 Installation and stand-alone server profile creation

Transcription:

JDBC 4 types of JDBC drivers Type 1 : JDBC-ODBC bridge It is used for local connection. ex) 32bit ODBC in windows Type 2 : Native API connection driver It is connected by Native Module of dependent form of H/W like.dll or.so. ex) OCI driver for local connection to Oracle Type 3 : Network connection driver Type 4 : Database Protocol driver It is independent from H/W because this driver is %100 java. ex) thin driver for local/global connection to Oracle *** Type1, type 2, and type 3 are usually used. Examples of type1 and type 4 are available now. Example of JDBC-ODBC Bridge OS: Window 2000 DBMS: MS Access 1. Open control panel

2. Open ODBC ( Window 95 and Window 98 are slightly different) 3. If you double-click on ODBC... Click on Add button.

4. Then... Click Microsoft Access Driver(*.mdb) and click on Finish button. 5. Then... Insert your own Data Source Name and click on Select button.

6. Then... Choose your Database Access file like above and click OK button. *** note: before these procedures, we must have Database Access file. We can make this file by using MS Access. This Access file should have a table named by tb_address. 7. Now, we can test our JDBC program with MS Access. Here is a simple java code that executes SELECT statement. Here is our table,tb_address.

8. Here is the result. *** Here is a simple code import java.sql.*; public class connect_msaccess { public static void main(string[] args) { int i; Connection conn = null; // register jdbc driver Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); catch(classnotfoundexception e) { System.out.println(e); // connect to DB conn = DriverManager.getConnection("jdbc:odbc:my_database"); catch(sqlexception se) { System.out.println(se); System.out.println("connection is successful!!!"); String selectsql = "select ID, NAME, ADDRESS from tb_address"; Statement stmt = conn.createstatement(); ResultSet rset = stmt.executequery(selectsql); while(rset.next()){ System.out.println("ID: " + rset.getstring(1) + " NAME: " +

rset.getstring(2) + " ADDRESS:" + rset.getstring(3)); stmt.close(); catch(sqlexception se) { System.out.println(se); Example of thin driver - OS: Window 2000 - DBMS: Personal Oracle 8.1.6. (download freeware from Oracle website) After the installation, check your Port and SID of Personal Oracle. 1. Download a suitable thin driver from Oracle website If you installed Personal Oracle 8.1.6, it had already thin driver in.../oracle81/jdbc/lib directory. Usually, classes111.zip for JDK 1.1.x and classes12.zip for JDK 1.2.x or more 2. Set your classpath (environment variable) If your OS is window 2000, open control panel and open system and go to Advanced tag. Then, choose Environment variable and add classpath. Restart your computer. If your OS is window 98/95, add classpath into autoexec.bat. Restart your computer. ex) classpath=.;c:\jdk1.3\lib;c:\winter2001\cs701\classes12.zip 3. Set your path (environment variable) Java path precedes oracle path. ex) path= c:\jdk1.3\bin;c:\oracle\...; 4. Test with a simple java code. Before implement of this code, you should create a table, tb_address, by using SQL plus in Oracle and insert some values.

Then test this code. 5. Result of a simple java code. *** Here is a simple code import java.sql.*; public class connect_thin { public static void main(string[] args) { int i; Connection conn = null; // register jdbc driver Class.forName("oracle.jdbc.driver.OracleDriver"); // in order to use Oracle thin/oci driver catch(classnotfoundexception e) { System.out.println(e); // connect to DB conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:datacafe", "scott","tiger"); // thin: driver // @127.0.0.1 for local connection. @xxx.xxx.xxx.xxx for global // 1521: port number. This should be match to Oracle network port. // datacafe: SID of Oracle database // scott: username of Oracle database // tiger: password of Oracle database catch(sqlexception se) { System.out.println(se);

System.out.println("connection is successful!!!"); String selectsql = "select ID, NAME, ADDRESS from tb_address"; Statement stmt = conn.createstatement(); ResultSet rset = stmt.executequery(selectsql); while(rset.next()){ System.out.println("ID: " + rset.getstring(1) + " NAME: " + rset.getstring(2) + " ADDRESS:" + rset.getstring(3)); stmt.close(); catch(sqlexception se) { System.out.println(se);