Java Naming and Directory Interface Matt. 2 What is JNDI.

Slides:



Advertisements
Similar presentations
5 Copyright © 2005, Oracle. All rights reserved. Accessing the Database with Servlets.
Advertisements

Java II--Copyright © Tom Hunter. Chapter 18 JDBC.
19 augustus 2003augustus 2003 JSP-2. BICT 2JDBC BICT 3Install MySQL Download MySQL daemon – Free – Windows version… Start Daemon – Mysqld-nt.exe Download.
JNDI Java Naming Directory Interface JNDI is an API specified in Java that provides naming and directory functionality to applications written in Java.
Approaches to EJB Replication. Overview J2EE architecture –EJB, components, services Replication –Clustering, container, application Conclusions –Advantages.
Database programming in Java An introduction to Java Database Connectivity (JDBC)
Introduction to Java 2 Enterprise Edition About myself –Neutrinos, Cancer Research, IT Applications Today’s topic: J2EE –Context –Advantages –Components.
Java Naming and Directory Interface JNDI. v001025JNDI2 Topics Naming and Directory Services JNDI Overview Features and Code Samples JNDI Providers References.
Distributed Application Development B. Ramamurthy.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 14: Naming.
EJB Development and Support Services. EJB Development and Support Services Topics to be Covered: EJB Design Bean/Container Interaction Java Naming and.
最新計算機概論 第 5 章 系統程式. 5-1 系統程式的類型 作業系統 (OS) : 介於電腦硬體與 應用軟體之間的 程式,除了提供 執行應用軟體的 環境,還負責分 配系統資源。
1 Lecture 05: Database Programming (JDBC). 2 Outline JDBC overview JDBC API Reading: Chapter 10.5 Pointbase Developer Manual.
Faculty of Information Technology © Copyright UTS Faculty of Information Technology - JNDIJNDI-1 Advanced Java Programming JNDI v2 Chris Wong
Basics of JNDI Alessio Bechini June Naming and Directory Services: Rationale A fundamental element in every application is the capability to find.
網路介紹及其運用 講師陳炯勳. 5-2 IP 協定 ( 一 ) IP 協定運作 (1) – 網路成員:主機 (Host) 與路由器 (Router) – 路由表 – 電報傳輸運作.
J2EE vs..NET Tom Tong. Enterprise Application 1 distributed 2 multiple-platform 3 critical 4 performance 5 security 6 multiple-data sources.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
Database Management Systems 1 Oracle Programming.
JDBC. What is JDBC JDBC is an acronym for –Java Data Base Connectivity. It allows java/jsp program to connect to any database.
CSE470 Software Engineering Fall Database Access through Java.
Corso di Formazione Sodalia “Enterprise Java Beans” JNDI Java Naming and Directory Interface.
JDBC Session 3 Tonight’s topics: 1.Connection Pooling 2.Transaction Processing Redux 3.Distributed Transactions 4.RowSets 5.Yet more lab time! (Design.
Enterprise JavaBeans EJB Container Services. EJB container Enterprise JavaBeans are deployed in an EJB container within the application server EJB container.
© D. Wong  Indexes  JDBC  JDBC in J2EE (Java 2 Enterprise Edition)
Enterprise Java Bean Matt. 2 J2EE 3 J2EE Overview.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
TDDD05 EJB Lab (Part of slides reused from Mikhail’s) Lu Li
Java Transaction API Sean C. Sullivan
MySQL, Java, and JDBC CSE 3330 Southern Methodist University.
Topic : JNDI Kaster Nurmukan. JNDI2(c)CDAC(Formerly NCST) What is JNDI? Naming and Directory Services Naming Concepts Issues JNDI Architecture Programming.
JDBC Tutorial MIE456 - Information Systems Infrastructure II Vinod Muthusamy November 4, 2004.
JAVA Database Access. JDBC The Java Database Connectivity (JDBC) API is the industry standard for database- independent connectivity between the Java.
1 JDBC Resource Registration on WebSphere Console javax.naming.InitialContext ctx = new javax.naming.InitialContext(); javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup("jdbc/DB2UDB");
Struts J2EE web application framework “ Model 2 ” Model View Controller Controller Servlet Key features XML metadata Struts taglib Simplified form validation.
CS 405G: Introduction to Database Systems Database programming.
1 KC Web & Java – 29 november 2005 – Design Patterns – The Template Method AJAX! KC Web & Java 29 november 2005.
Java Naming and Directory Interfaces. A naming service is an entity that performs the following tasks:  It associates names with objects. Similar to.
Chapter 8 Databases.
WEB/DB1 DATABASE PROGRAMMING 3JDBC by the ASU Scholars.
National Taiwan University Department of Computer Science and Information Engineering Introduction to Programming Design by C Algorithms and Computational.
Creating competitive advantage Copyright © 2003 Enterprise Java Beans Presenter: Wickramanayake HMKSK Version:0.1 Last Updated:
RMI CORBA Matt. 2 RMI VS CORBA 3 4 J2EE 5 Sample Application.
Java DataBase Connectivity Matt Driver JDBC calls Database commands Database.
Configuring & Managing Web Services for Joachim Flammer Integration Team EGEE is a project funded by the European Union under contract IST
Java and Databases. JDBC Architecture Java Application JDBC API Data Base Drivers AccessSQL Server DB2InformixMySQLSybase.
COMP 321 Week 4. Overview Normalization Entity-Relationship Diagrams SQL JDBC/JDBC Drivers hsqldb Lab 4-1 Introduction.
UNIT III - JDBC JDBC Overview – JDBC implementation – Connection class – Statements - Catching Database Results, handling database Queries. Networking–
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
CSI 3125, Preliminaries, page 1 JDBC. CSI 3125, Preliminaries, page 2 JDBC JDBC stands for Java Database Connectivity, which is a standard Java API (application.
Basics of JDBC Session 14.
Database Management Systems 1 Raghu Ramakrishnan Database Application Development Chpt 6 Xin Zhang.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Java Naming and Directory Interface. Contents Naming and directory services JNDI RMI Conclusion.
JAVA LDAP Dima Ionut Daniel. Contents What is LDAP? LDAP Operations Directory Service JNDI as LDAP API Pooling Spring LDAP UnboundId LDAP SDK JAVA LDAP.
EJB Enterprise Java Beans JAVA Enterprise Edition
1 Download current version of Tomcat from: g/tomcat/ g/tomcat/ Install it in: C:\Program Files\Apache.
EJB. Introduction Enterprise Java Beans is a specification for creating server- side scalable, transactional, multi-user secure enterprise-level applications.
Java and database. 3 Relational Databases A relational Database consists of a set of simple rectangular tables or relations The column headings are.
Instructor: Jinze Liu Fall /8/2016Jinze University of Kentucky 2 Database Project Database Architecture Database programming.
JDBC and OCCI 10/29/2017.
Master of Information System Management
Advanced Web Automation Using Selenium
Prof: Dr. Shu-Ching Chen TA: Sheng Guan
Knowledge Byte In this section, you will learn about:
Java Messaging Service (JMS)
Web-Services-based Systems Architecture, Design and Implementation
Java Messaging Service (JMS)
Understanding and Designing with EJB
Java API for Database Connectivity
Presentation transcript:

Java Naming and Directory Interface Matt

2 What is JNDI

3 JNDI JNDI 提供了命名 (naming) 與目錄 (directory) 服務,它的功用在於可以對整個環境 中的資源進行命名,並透過命名取得該資源。 The SPI provides a plug−in architecture with which third parties can use to develop support for additional naming and directory services and integrate that support seamlessly into the JNDI framework. The SPI defines the methods they use to hook into the JNDI API. As a developer, all you need to do in order to use the service provider is load the library during runtime or at startup. JNDI is used to find resources (such as EJBs) you have registered via the J2EE server. Advanced use of JNDI supports sophisticated storage and retrieval of Java objects and other information. A Naming Service provides a mechanism for giving names to objects so that you can retrieve and use those objects without knowing the location of the object. Objects can be located on any machine accessible from your network, not necessarily the local workstation. A Directory Service also associates names with objects but provides additional information by associating attributes with the objects.

4 JNDI One of the key tasks in a distributed application is finding items such as components, resources, message queues, and databases. The Java Naming and Directory Interface (JNDI) is an essential part of J2EE applications, providing a mechanism for finding distributed components—but JNDI is good for more than just looking up EJB interfaces. It also allows access to important enterprise systems such as directory servers.

5 JNDI Architecture

6

7 JNDI API

8 JNDI API Package javax.naming  Defines classes and interfaces that enable you to interact with naming services. javax.naming.directory  Defines classes and interfaces that enable you to interact with directory services. javax.naming.event  Defines classes and interfaces that handle event notifications when you’re working with naming and directory services. javax.naming.ldap  Defines classes and interfaces for working with LDAP v3.0. javax.naming.spi  Defines the service−provider interface that vendors of naming and directory service providers must implement.

9 JNDI environment properties

10 The first step in using the JNDI name service is to get a context in which to add or find names.  The context that represents the entire namespace is called the Initial Context and is represented by a class called javax.naming.InitialContext and is a sub-class of the javax.naming.Context class. Context ctx = new InitialContext(); A Context object represents a context that you can use to look up objects or add new objects to the namespace.

11 JNDI example import javax.naming.*; import javax.sql.*; import java.sql.*; //use JNDI(Java Naming and Directory Interface) public class Lookup { public Lookup() { Connection con = null; Statement stmt = null; ResultSet rs = null; try { InitialContext ic = new InitialContext(); Context envCtx = (Context)ic.lookup("java:comp/env"); //java:computer environment DataSource ds = (DataSource)envCtx.lookup("jdbc/music"); // 查找 jdbc/music con = ds.getConnection(); // 得到 connection stmt = conn.createStatement(); // 得到 statement rs = stmt.executeQuery("select * from music"); while (rs.next()) { //do something } rs.close(); stmt.close(); con.close(); } catch (Exception ex) { System.err.println("ERROR"); } } }