XAPool 1.2.2 July 1st, 2003 xapool-public at lists.debian-sf.objectweb.org.

Slides:



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

Connecting to Databases. connecting to DB DB server typically a standalone application Server runs on localhost for smaller sites –i.e. Same machine as.
Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Ed Felt & Sriram Srinivasan BEA Systems, Inc. Advanced Distributed Transaction Processing with BEA WebLogic Server ™ 6.0.
Distributed Transactions in Java EE Nikolai Tankov SAP Labs Bulgaria January 19th, 2008 Sofia, Bulgaria.
19 augustus 2003augustus 2003 JSP-2. BICT 2JDBC BICT 3Install MySQL Download MySQL daemon – Free – Windows version… Start Daemon – Mysqld-nt.exe Download.
Basic JDBC Celsina Bignoli What is JDBC Industry standard for database- connectivity between the Java language and a wide range of.
1 JDBC Java Database Connectivity. 2 c.pdf
1 Design patterns Lecture 4. 2 Three Important skills Understanding OO methodology Mastering Java language constructs Recognizing common problems and.
Three-Tier Architecture Oracle DB Server Apache Tomcat App Server Microsoft Internet Explorer HTML Tuples HTTP Requests JDBC Requests Java Server Pages.
Managing Concurrency in Web Applications. DBI 2007 HUJI-CS 2 Intersection of Concurrent Accesses A fundamental property of Web sites: Concurrent accesses.
Basic JDBC Use Oracle JDBC Drivers must be in the CLASSPATH
1 Copyright © 2005, Oracle. All rights reserved. Introduction.
Advance Computer Programming Java Database Connectivity (JDBC) – In order to connect a Java application to a database, you need to use a JDBC driver. –
Getting connected.  Java application calls the JDBC library.  JDBC loads a driver which talks to the database.  We can change database engines without.
1 CSC 440 Database Management Systems JDBC This presentation uses slides and lecture notes available from
1 Java Database Connection (JDBC) There are many industrial-strength DBMS's commercially available in the market. Oracle, DB2, and Sybase are just a few.
CS178 Database Management “JDBC”. What is JDBC ? JDBC stands for “Java DataBase Connectivity” The standard interface for communication between a Java.
Java Database Connectivity (JDBC) Introduction to JDBC JDBC is a simple API for connecting from Java applications to multiple databases. Lets you smoothly.
Javax.sql and java.sql. java.sql Interface Connection public interface Connection extends WrapperWrapper A connection (session) with a specific database.
JDBC Session 3 Tonight’s topics: 1.Connection Pooling 2.Transaction Processing Redux 3.Distributed Transactions 4.RowSets 5.Yet more lab time! (Design.
DATABASE PROGRAMMING Lecture on 16 – 05 – PREVIOUS LECTURE QUIZ: - Some students were very creative in transforming 2NF to 3NF. Excellent! - Some.
/11/2003 C-JDBC: a High Performance Database Clustering Middleware Nicolas Modrzyk
TDDD05 EJB Lab (Part of slides reused from Mikhail’s) Lu Li
Java Transaction API Sean C. Sullivan
Eurotrace Hands-On The Eurotrace File System. 2 The Eurotrace file system Under MS ACCESS EUROTRACE generates several different files when you create.
JDBC Tutorial MIE456 - Information Systems Infrastructure II Vinod Muthusamy November 4, 2004.
JDBC (Java Database Connectivity) SNU OOPSLA Lab. October 2005.
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");
JDBC Java and Databases, including Postgress. JDBC l Developed by Industry leaders l Three main goals: –JDBC should be an SQL-level API –JDBC should capitalize.
1cs Intersection of Concurrent Accesses A fundamental property of Web sites: Concurrent accesses by multiple users Concurrent accesses intersect.
Stored procedures1 Stored procedures and functions Procedures and functions stored in the database.
Introduction to Derby. RHS – What is Derby…? Derby is a DBMS –Database –GUI for administration –GUI for data maintenance Best part; integrated.
Applications Web et bases de données en grappe Séminaire InTech 3 Février 2005 – Grenoble.
1 JDBC Aum Amriteshwaryai Namah. 2 2 JDBC – Java DataBase Connectivity.
Usenix Annual Conference, Freenix track – June 2004 – 1 : Flexible Database Clustering Middleware Emmanuel Cecchet – INRIA Julie Marguerite.
Sadegh Aliakbary. Copyright ©2014 JAVACUP.IRJAVACUP.IR All rights reserved. Redistribution of JAVACUP contents is not prohibited if JAVACUP.
Hibernate 3.0. What is Hibernate Hibernate is a free, open source Java package that makes it easy to work with relational databases. Hibernate makes it.
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.
Java Database Connectivity. Java and the database Database is used to store data. It is also known as persistent storage as the data is stored and can.
DB-16 : JTA Transactions in the RDBMS, What's Going on Down There? Deb Walz Principal Software Engineer.
DB-1: Understanding and Leveraging the Latest ODBC and JDBC Technology What’s new in OpenEdge® 10.1A? Rob Steward Director of Software Development.
Enterprise Java v040918JBoss DataSource Setup1 Setting up DataSources in JBoss References: JBoss Wiki –
Creating competitive advantage Copyright © 2003 Enterprise Java Beans Presenter: Wickramanayake HMKSK Version:0.1 Last Updated:
JDBC - Connection The programming involved to establish a JDBC connection is fairly simple. Here are these simple four steps − Import JDBC Packages: Add.
JDBC. Java.sql.package The java.sql package contains various interfaces and classes used by the JDBC API. This collection of interfaces and classes enable.
DATABASE CONNECTIVITY TO MYSQL. Introduction =>A real life application needs to manipulate data stored in a Database. =>A database is a collection of.
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool The problem fixed by ORM Advantage Hibernate Hibernate Basic –Hibernate sessionFactory –Hibernate Session.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Data Access with Spring.
JDBC Part II CS 124. More about JDBC Types Statement versus PreparedStatement Timeout NULL values Meta-data close() methods Exceptions Transactions JDBC.
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool Used in data layer of applications Implements JPA.
In the Name Of Almighty Allah. Java Application Connection To Mysql Created by Hasibullah (Sahibzada) Kabul Computer Science Faculty Afghanistan.
Java Object-Relational Layer Sharon Diskin GUS 3.0 Workshop June 18-21, 2002.
Industrial Control Engineering Session 1 Introduction  What is RADE  Technology  Palette  Tools  Template  Combined Example  How to get RADE 
CS422 Principles of Database Systems JDBC and Embedded SQL Chengyu Sun California State University, Los Angeles.
Java and database. 3 Relational Databases A relational Database consists of a set of simple rectangular tables or relations The column headings are.
1 Enabling Grids for E-sciencE Joachim Flammer Service Management Configuration, service instrumentation & service management Joachim Flammer on behalf.
JDBC.
CS320 Web and Internet Programming Database Access with JDBC Chengyu Sun California State University, Los Angeles.
Oracle Database Architectural Components
JTA | Developer Conference JBoss Transactions Ivo Studenský JBoss QA Engineer, Jiří Pechanec JBoss QE Supervisor, Red Hat Sep 10th, 2009.
CS3220 Web and Internet Programming Database Access with JDBC
CS320 Web and Internet Programming Database Access with JDBC
Advanced Web Automation Using Selenium
HW#4 Making Simple BBS Using JDBC
Java Database Connectivity
Bolat Azamat, Kim Dongmin
Storing and Processing Sensor Networks Data in Public Clouds
CS3220 Web and Internet Programming Database Access with JDBC
CS3220 Web and Internet Programming Database Access with JDBC
Presentation transcript:

XAPool July 1st, xapool-public at lists.debian-sf.objectweb.org XAPool is Another Pool :-)

History History: -2000: Lutris asks for a new Database Manager for JOnAS -2003: Experlog proposes XAPool as a new Enhydra project to the Objectweb Community -in the future:... License: EPL: Enhydra Public License

The Generic Pool PoolDataSource: factory of PooledConnection XAPoolDataSource: factory of XAConnection Success Stories and News Sample code Conclusion Generic Pool XA Table of Content not-XA

What is XAPool ? XAPool is a software component which allows to: -Store objects with a Generic Pool -Export a DataSource[1] -Export a XADataSource[2] [1] javax.sql.DataSource [2] javax.sql.XADataSource XAPool

What can I store in the Generic Pool ? Answer: anything! You just need to implement an interface and give it to the Generic pool. With this interface, the pool will be able to create your objects. The pool exports the following methods: -create(s) methods to build your objects -expire method to destroy properly your objects -check(s) methods to verify your objects before using them ! (5 levels of object checking) Generic Pool Generic Pool

Functionalities and properties of the Generic Pool -minimum pool size (and initial number of pooled objects) -maximum pool size -log writer (with commons-logging[1]) -life time of objects (lifetime in the free objects pool) -time to wait until an object (eg. a Connection) is available -garbage collector option(run gc upon pool cleanup) -”generation” concept when problems occurs on objects (upon error, check all objects of current or previous generation, with optional reset). [1] Generic Pool (2) Generic Pool

2 pools inside the Generic Pool: Unlocked pool Locked pool Obj1 Obj3 Obj2 Obj CheckIn CheckOut Pool internals Generic Pool

How to communicate with the Generic Pool ? -start method to initialize the pool -checkout method to get an object from the pool -checkin method to return an object to the pool -stop method to delete all objects and pool activity -administrative methods (eg. get/set min/max size…) The Generic Pool is used by : -the PooledConnection[1] factory -the XAConnection[2] factory [1] javax.sql.PooledConnection [2] javax.sql.XAConnection Main methods Generic Pool

The PooledConnection Factory: the Datasource (StandardPoolDataSource[1]) This object is able to build PooledConnection objects and to store them into the pool. Main methods from DataSource are: -Connection[2] getConnection() -Connection getConnection(String user, String password) -PrintWriter[3] methods (setter/getter) for logging -timeOut methods (setter/getter) [1] org.enhydra.jdbc.pool.StandardPoolDataSource [2] java.sql.Connection [3] java.io.PrintWriter not-XA Datasource

The XAConnection Factory: the XADataSource (StandardXAPoolDataSource[1]) -This object is able to build XAConnection objects and to store them into the pool. -This object extends javax.sql.DataSource to use common getConnection method. -create and close (expire) methods are specific for each object. -A TransactionManager[2] (JOTM) is used to enlist and delist XAResource[3]. [1] org.enhydra.jdbc.pool.StandardXAPoolDataSource [2] javax.transaction.TransactionManager [3] javax.transaction.xa.XAResource XA XA DataSource

XAConnection as XAResource: Our implementation of XAConnection implements XAResource[1] interface: -association between Transaction and the database Main methods of XAResource are: -commit, rollback, prepare (with a specific Xid[2]) -start, end, forget (with a specific Xid) -... Xid = « X id » or « transaction id », given by the Transaction Manager [1] java mapping of the industry standardXA interface based on the X/Open CAE Specification [2] javax.transaction.xa.Xid XA XAResource

(XA)PrepareStatement[1] and (XA)Statement[2]: -These 2 implementations are wrappers to core implementations. -These objects are used to enlist resources ONLY when connections are used ! -Implements a cache of PreparedStatement [1] java.sql.PrepareStatement [2] java.sql.Statement XA XA Statements

Specific development for Databases: Oracle: a special wrapper to XAConnection and XADataSource objects from Oracle driver (jdbc2.0 driver) exists to pool these connections. Informix, Sybase: special wrappers have been done to hack some functionalities InstantDB: a special wrapper has been done to support a full JDBC XA driver. PostgreSQL, MySQL, SAPdb, HSQL,...: it works as is XA DB wrappers

Externals requirements: Mains are: -jotm.jar: Transaction Manager -commons_logging.jar and log4j.jar: Logging -rmiregistry: JNDI, to bind and lookup transaction, XADataSource and XAPoolDataSource -other useful libs: carol.jar, idb.jar, jonas_timer.jar, jotm_jrmp_stubs.jar, jta-spec1_0_1.jar, p6spy.jar... External libs

Where I can find Success Stories: -ExperSHOP: Experlog’s product embeds XAPool since 2001 (the PooledConnection part) -JOTM: uses XAPool as XA Pool DataSource -JettyPlus[1]: XAPool and JOTM are integrated into JettyPlus from MortBay.org Downloads: May: 36 June: 67 Recent news: -XAPool works with C-JDBC for database clustering. [1] Success stories

// create an XA pool datasource with a minimum of 4 objects StandardXAPoolDataSource spds = new StandardXAPoolDataSource(4); spds.setUser(login); spds.setPassword(password); Jotm jotm = new Jotm(true, false); spds.setTransactionManager(jotm.getTransactionManager()); // create an XA datasource which will be given to the XA pool StandardXADataSource xads = new StandardXADataSource(); try { xads.setDriverName(driver); xads.setUrl(url); xads.setUser(login); xads.setPassword(password); } catch (Exception e) { System.err.println("JOTM problem."); } // give the XA datasource to the pool (to create future objects) spds.setDataSource(xads);

Connection conn = spds.getConnection(login, password); try { UserTransaction utx = jotm.getUserTransaction(); utx.begin(); PreparedStatement pstmt0 = conn.prepareStatement(SQL_QUERY); pstmt0.setInt(1, 13); pstmt0.executeUpdate(); utx.commit(); utx.begin(); PreparedStatement pstmt = conn.prepareStatement(SQL_QUERY2); pstmt.setInt(1, 14); pstmt.executeUpdate(); utx.rollback(); } catch (Exception e) { System.err.println("Exception"); } conn.close();

Conclusion: -Reusable Generic Pool -Fully (100%) compliant to the specification -Real time instrumentation -Now used in several products (yes, there was a need!) To be done: -reuse of the Generic Pool for other products -implementation of Connector architecture -JOnAS, back to the source :-) -JMX ? XAPool 1.2.2