EM 431 ASA and the new SQLJ standards Shannon White Software Developer iAnywhere Solutions

Slides:



Advertisements
Similar presentations
Java Network Programming Vishnuvardhan.M. Dept. of Computer Science - SSBN Java Overview Object-oriented Developed with the network in mind Built-in exception.
Advertisements

Copyright  Oracle Corporation, All rights reserved. 2 Java and Databases: An Overview.
Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
Database programming in Java An introduction to Java Database Connectivity (JDBC)
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13 Introduction to SQL Programming Techniques.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
Distributed Application Development B. Ramamurthy.
1 JDBC Java Database Connectivity. 2 c.pdf
Principles of Object-Oriented Software Development The language Java.
1 C. Shahabi Application Programming for Relational Databases Cyrus Shahabi Computer Science Department University of Southern California
Session-02. Objective In this session you will learn : What is Class Loader ? What is Byte Code Verifier? JIT & JAVA API Features of Java Java Environment.
L EC. 01: J AVA FUNDAMENTALS Fall Java Programming.
Java Security Updated May Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security.
SEMESTER 1, 2013/2014 DB2 APPLICATION DEVELOPMENT OVERVIEW.
Object Oriented Databases by Adam Stevenson. Object Databases Became commercially popular in mid 1990’s Became commercially popular in mid 1990’s You.
JAVA v.s. C++ Programming Language Comparison By LI LU SAMMY CHU By LI LU SAMMY CHU.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
Getting connected.  Java application calls the JDBC library.  JDBC loads a driver which talks to the database.  We can change database engines without.
Database System Concepts and Architecture Lecture # 3 22 June 2012 National University of Computer and Emerging Sciences.
Common Object Request Broker Architecture (CORBA) CS-328.
Lecturer PEN PHIROM Tel : Web site: Lecturer PEN PHIROM Tel :
Oracle8 JDBC Drivers Section 2. Common Features of Oracle JDBC Drivers The server-side and client-side Oracle JDBC drivers provide the same basic functionality.
Beginning Databases with JDBC Mike Bradley Adapted from and notes by Kevin Parker, Ph.D.
Native Support for Web Services  Native Web services access  Enables cross platform interoperability  Reduces middle-tier dependency (no IIS)  Simplifies.
Enterprise Java Beans Java for the Enterprise Server-based platform for Enterprise Applications Designed for “medium-to-large scale business, enterprise-wide.
Cli/Serv.: rmiCORBA/131 Client/Server Distributed Systems v Objectives –introduce rmi and CORBA , Semester 1, RMI and CORBA.
1 22 August 2001 The Security Architecture of the M&M Mobile Agent Framework P. Marques, N. Santos, L. Silva, J. Silva CISUC, University of Coimbra, Portugal.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 38 Advanced Java Database.
11 September 2008CIS 340 # 1 Topics To examine the variety of approaches to handle the middle- interaction (continued) 1.RPC-based systems 2.TP monitors.
Crossing The Line: Distributed Computing Across Network and Filesystem Boundaries.
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
CS 405G: Introduction to Database Systems Database programming.
Object-Oriented Software How does it differ from procedural? How is it similar to procedural? Why has it become so popular? Does it replace or supplement.
Java 2 security model Valentina Casola. Components of Java the development environment –development lifecycle –Java language features –class files and.
Stored procedures1 Stored procedures and functions Procedures and functions stored in the database.
Chapter 18 Object Database Management Systems. McGraw-Hill/Irwin © 2004 The McGraw-Hill Companies, Inc. All rights reserved. Outline Motivation for object.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 33 Advanced Java.
RMI remote method invocation. Traditional network programming The client program sends data to the server in some intermediary format and the server has.
Java Database Connectivity (JDBC). Topics 1. The Vendor Variation Problem 2. SQL and Versions of JDBC 3. Creating an ODBC Data Source 4. Simple Database.
1 CS 430 Database Theory Winter 2005 Lecture 14: Additional SQL Topics.
1 Java Servlets l Servlets : programs that run within the context of a server, analogous to applets that run within the context of a browser. l Used to.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
JDBC CS 260 Database Systems. Overview  Introduction  JDBC driver types  Eclipse project setup  Programming with JDBC  Prepared statements  SQL.
Access Databases from Java Programs via JDBC Tessema M. Mengistu Department of Computer Science Southern Illinois University Carbondale
Java Network Programming Network Programming Spring 2000 Jeffrey E. Care
Java – in context Main Features From Sun Microsystems ‘White Paper’
Basics of JDBC Session 14.
Chapter 18 Object Database Management Systems. Outline Motivation for object database management Object-oriented principles Architectures for object database.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Advanced Java Session 5 New York University School of Continuing and Professional Studies.
Intro to JDBC Joseph Sant Applied Computing and Engineering Sciences Sheridan ITAL.
Review IS Overview: Data  Inside the application Collections  Outside the application Database XML  Getting/displaying Swing  Communicating.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
JDBC.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Database: JDBC Overview
DEPTT. OF COMP. SC & APPLICATIONS
ODBC, OCCI and JDBC overview
Web Technologies IT230 Dr Mohamed Habib.
Database JDBC Overview CS Programming Languages for Web Applications
What is RMI? Remote Method Invocation
Knowledge Byte In this section, you will learn about:
Network and Distributed Programming in Java
Mr. Harish Sharma Asst. Professor Dept. of CA & IT SGRRITS Dehradun
Programming in Java Text Books :
Interacting with Database
Presentation transcript:

EM 431 ASA and the new SQLJ standards Shannon White Software Developer iAnywhere Solutions

What is SQLJ? SQLJ1: ANSI NCITS Calling java methods from SQL SQLJ2: ANSI NCITS Mapping java types to SQL types To be merged in SQL/JRT for SQL/2000 Not covered here: SQLJ0: The Java language bindings

Why SQLJ? SQL PSM (Persistent Stored Modules) Not object-oriented Small standard library Only usable within a database server Small developer community Vendor specific variations Java Object-oriented Large library of standard packages Ubiquitous from client tier to server tier Large developer community

SQLJ1 Overview Java classes in SQL Installing/updating/removing classes Name resolution path within java classes Privileges for accessing java classes Calling java static methods from SQL Returning out and inout parameters Returning SQL result sets from java

SQLJ2 Overview Syntax for mapping SQL types to java classes: Creating/dropping of mapping Instantiation of java objects from SQL Calling methods on java objects from SQL Ordering of java objects referenced from SQL Persistence of java objects Java class must implement Serializable or SQLData

Support for Java in the ASA database server Java supported in the database server since ASA 6.0 Java VM runs in-process Java support fully integrated throughout Access to java from SQL Access to SQL through JDBC Persistence of java object data in the database Transfer of java objects between client and server Support for JDK 1.3 in upcoming ASA 8.0 release

Mapping java classes to SQL types Install a java class using the install statement: install java {new|update} [jar ‘jar-name’] from {file | } Corresponding SQL type(s) automatically created SQL type name is same as fully qualified java name Ex. Java class BigDecimal in package java.math Corresponding SQL type: java.math.BigDecimal

Installing from a file Install a class from a file install java new from file ‘d:\\java\\myClass.class’ Creates the SQL type myClass Install a class from a jar file install java new jar ‘testjar’ from file ‘d:\\mytest.jar’ Creates a SQL type for each class in mytest.jar

Installing from a variable Example: create long binary; = 0xCAFEBABE…; install java update Useful in several circumstances: Class file not accessible from server Class byte code not stored in file Used in ASA unload/reload, dbtran and SQL Remote

Java methods and fields Java static and instance methods callable from SQL Java static and instance fields SQL-accessible Method and field names map to same name in SQL Syntax for accessing static methods and fields: The java SQL type name prefixes the method or field Accessing instance methods and fields: Java instance reference prefixes the method or field Instance references include Java-typed column references Java-typed SQL variables Java-typed expressions

Calling a java method Examples: Converting from decimal to hexadecimal select java.lang.Integer.toString( 90, 16 ) produces row: 5a Setting a standard scale create variable bd java.math.BigDecimal; set bd = new java.math.BigDecimal( ‘ ’ ); select bd.setScale( 1, ROUND_UP ); produces row: 123.5

Out and inout parameters Not naturally a part of java Uses java arrays of unit length Example: void myMethod( int[] myout ) { myout[0] = 123; } Maps to: create variable out_var int; call myInstance.myMethod( out_var ); Value of out_var is 123

Returning SQL result sets Not naturally a part of java Uses arrays of java.sql.ResultSet Example: void getRSet( ResultSet[] rset ) { rset[0] = …; } Maps to: select myInstance.getRSet();

Accessing SQL from java Server-side JDBC 2.0 driver Full access to power of SQL Prepared statements Batch statements Result sets Scrollable cursors Updateable cursors Database and result set meta data

Persistence of java objects Java objects stored in Java-typed table columns Live across server shutdown and restart Compact binary representation create table ttt ( bd java.math.BigDecimal ); insert into ttt values (new java.math.BigDecimal(‘ ’)); select bd.negate() from ttt; Produces row:

Java objects between client and server JDBC ASA JDBC driver JConnect setObject() and getObject() methods ODBC/OLEDB, OpenClient, DBLIB Objects sent as long binary SQL type Object must be java.io.Serializable Sun serialization SQLRemote Objects sent as long binary Serialization used is more compact

Is Java worth the trouble? Is it worth switching development from SQL to java? Java is the considered “better” language Object-oriented, standard Exploding development community Large pre-existing code base Is that enough to justify a switch? Switch costs Acquiring java programmer experience Maintenance of legacy SQL procedures

Java cons Starting the java VM Can take a couple seconds to create first VM Garbage collection Can occur at inopportune times Can make it difficult to predict execution time Java is all unicode Unicode to/from native character set costs Sun serialization is slow and bulky Persisting java object usually slower than storing constituent data

More than just a better language The ASA support provides dramatic new capabilities not required by SQLJ and not available in SQL ASA 7.0 Multi-threading within a connection Access to the file system (java.io.*) Access to the internet (java.net.*) ASA 8.0 Remote procedure calls (java.rmi.*) Enhanced security features (ASA 8.0) JDK 1.3 support

Multi-threading Use standard java.lang.Thread API Java threads can be spawned, interrupted, and killed Threads execute concurrently on the same connection Only single-threaded access to JDBC Child threads killed when parent thread exits VM Daemon threads not allowed

File I/O Support for JDK’s java.io package Access to file system from perspective of server Features abstraction of file and pathnames Access restricted by default Access granted via database option and SecurityManager

Socket support Support for JDK’s java.net package Provides classes for implementing network apps Access restricted by default Access granted via database option and SecurityManager

RPC Support for JDK’s java.rmi package Provides classes for distributed programming JDK 1.3 includes support for CORBA’s IIOP Access restricted by default Access granted via database option and SecurityManager

Security SecurityManager Java object that governs access to permission- sensitive resources Ex. file I/O, sockets Extend to enterprise-specific resources DBA can associate user with a SecurityManager Limits user’s access to resources accessible from java Default restricts access to file I/O and sockets

JDK 1.3 support Previous support based on JDK ASA 8.0 beta provides JDK1.3.0 support ASA 8.0 release will likely provide JDK support New capabilities Collections framework JDBC 2.0 Reference Objects JNDI RMI over IIOP Reflection enhancements

Future development Just-in-time (JIT) compiler Already in ASE 12.5 Dynamic class loading JDK 1.4 J2ME

Conclusion Java in the database server can be useful Has to be more than a “better” language Must provide capabilities not available in SQL ASA provides java in the database server Multi-threading I/O, sockets, RPC JDK 1.3