<% @ Page ContentType = "text / html; charset = GB2312"%>
<% @ Page Info = "Database Handler"%>
<% @ Page Import = "java.io. *"%>
<% @ Page Import = "java.net. *"%>
<% @ Page Import = "java.lang. *"%>
<% @ Page Import = "java.util. *"%>
<% @ Page Import = "java.sql. *"%>
<% @ page import = "javax.servlet. *"%>
<% @ page import = "javax.servlet.http. *"%>
<% @ page import = "Oracle.sql.clob"%>
<% @ page import = "Oracle.jdbc.driver.OracleResultset"%>
hEAD>
<%
INT i = 0;
String Parid = Request.getParameter ("ID_NO");
String strsql;
String content = "";
Try {
String Xmlfile = "/usr/local/tomcat/webapps/Vehicles/test.xml";
Class.Forname ("Sun.jdbc.odbc.jdbcodbcdriver");
String dburl = "JDBC: Oracle: Thin: @ 192.168.15.250: 1521: ycdb";
Connection Con = DriverManager.getConnection (DBURL, "Training", "DEEP1704SEA");
Statement Stmt = con.createstatement ();
// Read the CLOB or BLOB column using the stream
strsql = "SELECT XMLGEN.GETXML ('SELECT * from account_holder where id_no =' '0001' ') from dual";
ResultSet RS = Stmt.executeQuery (strsql);
IF (rs.next ()) {
Clob Clob = ((ORACleResultset) RS) .GETCLOB (1);
IF (clob! = null) {
Reader is = clob.getcharacterstream ();
BufferedReader Br = New BufferedReader (IS);
String s = br.readline ();
While (s! = null) {
// byte [] temp = s.getbytes ("ISO-8859-1"); // s = new string (temp);
Content = S;
S = Br.Readline ();
}
}
}
//out.println (t);
// Write it from the content read from the database to the file
FileOutputStream fo = new fileoutputstream (XMLFile);
PrintStream SO = New PrintStream (fo);
So.println (Content);
So.close ();
Rs.close ();
Stmt.close ();
C. close ();
} catch (exception e) {
Out.println (e);
}
%>
body>
html>