Two Ways to Connect to Oracle8 - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Two Ways to Connect to Oracle8

Description:

Use TCP/IP Port to access database. UserId, Password, Host name and database SID are ... Support for Oracle-specific datatypes such as ROWIDs and REFCURSORs ... – PowerPoint PPT presentation

Number of Views:19
Avg rating:3.0/5.0
Slides: 10
Provided by: XM4
Learn more at: https://www.utdallas.edu
Category:
Tags: cobra | connect | oracle8 | two | ways

less

Transcript and Presenter's Notes

Title: Two Ways to Connect to Oracle8


1
Two Ways to Connect to Oracle8
  • Note We are going to use Thin Driver

2
JDBC -Thin Driver(Oracle)
  • Use TCP/IP Port to access database
  • UserId, Password, Host name and database SID are
    required to connect database
  • The driver is written completely in Java,
    requires NO pre-installation of any software.
  • Support for Oracle-specific datatypes such as
    ROWIDs and REFCURSORs
  • Supports all Oracle7 database versions and can
    also access Oracle8 databases

3
JDBC -Thin Example
  • Connection dbConnectionnull
  • String driver"oracle.jdbc.driver.OracleDriver"
  • try
  • Class.forName(driver)
  • dbConnection DriverManager.getConnection("jdbc
    oraclethin_at_hostname1521SID",
  • userid",passwd")
  • Statement statement dbConnection.createSta
    tement()
  • ResultSet results statement.executeQuery(q
    uery)
  • while(results.next())
  • .
  • catch(Exception e)..

hostname orabox.utdallas.edu SID last
4
Big Picture to Save Java Object
Oracle8
Java Beans
Java Class
XML Doc.
Class
DTD Parser Middleware
JOX
JDBC
  • Original 4 classes
  • need be modified
  • as Java Beans
  • Place
  • Transition
  • Arch
  • (Token)
  • Using JOX
  • Convert Beans to XML
  • Using XML-DBMS (Ronald Bourret) or XDK(Oracle),
    JDBC-Thin

Lib
Lib
  • Jox115.jar
  • Jaxp.jar
  • Xmldbms.jar (XML-DBMS)

DTD Parser(Oracle)
XML Parser(Oracle)
  • Xmlparserv2.jar
  • Xmlparserv2.jar

Ronald Bourret is a freelance programmer
5
Beans to XML JOX
JOX is a set of Java libraries that make it easy
to transfer data between XML documents and Java
beans.
  • You must use Java Beans (get/set methods
    specifically). JOX uses introspection to figure
    out the property names.
  • XML tag names must match bean property names
    within reason. JOX compares XML tags to bean
    properties ignoring capitalization, dashes,
    underscores, colons and dots. The XML tag
    ltfirst-namegt will map successfully to firstName,
    first_name and fIrSTn_aME.
  • Because XML data is in the form of a tree
    structure, JOX can't handle bean structures that
    have circular references unless you use a DTD
    when writing the XML.
  • JOX tries to convert XML data to the type of the
    bean property. There is no facility for custom
    conversions.
  • Without a DTD, JOX uses bean property names as
    XML tag names.

6
JOX - Example
Top Level Java Bean
Nested Java Bean
public class TestSubbean
implements java.io.Serializable
protected String name protected int
age public TestSubbean()
public String getName() return name
public void setName(String aName)
name aName public int
getAge() return age public void
setAge(int anAge) age anAge
public class TestBean implements
java.io.Serializable protected int foo
protected String bar protected TestSubbean
subbean //Nested Class public
TestBean() public int getFoo()
return foo public void setFoo(int aFoo)
foo aFoo public String getBar() return
bar public void setBar(String aBar) bar
aBar public TestSubbean getSub()
return subbean public void
setSub(TestSubbean aSub) subbean aSub
7
JOX Example (Contd)
Application to Convert
Bean.xml
public class TestSer public static void
main(String args) try
TestBean b new TestBean()
b.setFoo(5) b.setBar("This is the bar value")
TestSubbean sub new TestSubbean()
sub.setName("Mark") sub.setAge(35)
b.setSub(sub) FileOutputStream
fileOut new FileOutputStream("bean.xml")
JOXBeanOutputStream joxOut new
JOXBeanOutputStream(fileOut)
joxOut.writeObject("MarkTest", b)
joxOut.close() catch (Exception exc)
exc.printStackTrace()
?xml version"1.0" encoding"ISO-8859-1"?gt ltMarkTe
stgt ltfoogt5lt/foogt ltBARgtThis is the bar
valuelt/BARgt ltS-U-B name"Joon"gt ltagegt35lt/agegt
lt/S-U-Bgt lt/MarkTestgt
8
XML to/from Oracle8
To be researched I am going to use XML-DBMS and
DTD Parser(Oracle)
Web resources to be researched Please visit and
download related Libraries. http//www.utdallas.e
du/hojch/independentStudy.html
9
JDBC/XML Team Schedule
JOX Test Bean to/from XML
Joon/Hitendra
XML-DBMS/XDK Test XML to/from
Oracle8
Joon/Terence
Modify 4 classes to Beans and JOX Test
Joon
Place/ JOX Test
Hitendra
Transition/ JOX Test
Terence
Arch/ JOX Test
(Token)/ JOX Test
Joon
Place/ XML-DBMS/XDK Test
Hitendra
Transition/ XML-DBMS/XDK Test
Terence
Arch/ XML-DBMS/XDK Test
(Token)/ XML-DBMS/XDK Test
Joon/Hitendra
JOX Test Bean to Java Object
GUI/System Test
All Members
6/30
7/30
8/10
Write a Comment
User Comments (0)
About PowerShow.com