Jdom Reading and Reading XML database generation insert XML database

  1. First revenue package is intended to http://jdom.org. Download, the latest version is the current jdom-1.0.zip. 

  2. Then its extract, and the build folder jdom.jar, its copy to your jdk installation directory lib Below, also copied to the installation directory jdk jre folder under the ext lib, This directory will be added to the classpath environment variables.    Such as: d: / jdk1.4/jre/lib/ext/jdom.jar and d: / jdk1.4/lib/jdom.jar. Addition to the attention of the problem is that you document storage java path to be added to the classpath As java environment variable settings, I do introduced here. 

  3. In this example I used in the database is mysql, I prefer because it is open-source and free things, so select it.    As for the specific version is as follows: 

  Mysqlcc-0.9.4-win32.zip / / graphical control interface 
  Mysql-5.0.0a-alpha-win.zip 
  Mysql-connector-java-3.0.17-ga.zip / / connect Driver In fact, the jar packets can be other versions.    I installed concrete here not say, If we do not understand, will be to find a goole relevant information can be:) 

  First I look at the design of the database table: for the sake of simplicity I only thoughtful a database containing two tables jdomdb, including a table of user information is stored userinfo table, and is used to store a demonstration of documents to read xml insert data inside the database table tmpinfo. 

  Below started to create a database table of information as below: 


  Table userinfo is part of the left field information.    At the same time table tmpinfo field information is the same.    I am also here to provide a database table structure jdomdb.sql document, as long as you establish a good name jdomdb database, and then can be introduced into the. 

  We must be prepared to demonstrate the basic data, here we have adopted a document testdb.jsp jsp to insert some data.    You can either direct hand in the table inserted several data. 

  4. Download package in the document: 

  Reading database and data export to XML documents in the document: ExtraXml.java guided by the document which called userinfo.xml; 
  Reading XML documents and data into the database file: ReadXml.java; 
  Packaging operations, such as the database connection JavaBean documents: DBConn.java; 
  There is a good example of this is ExtraXml3.java package, as long as the corresponding call javabean call on it. 
  I jdomdb.sql guided by the basic structure of the database tables can be imported directly. 
  There must be used by the jdom.jar package. 

  Download link: Attachments: javaXML.rar (150K) 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • DotNetKicks
  • DZone
  • Netvouz
  • Propeller

Tags: ,

Releated Java Articles

Comments

Leave a Reply