日期:2014-05-18  浏览次数:20850 次

关于jsp连oracle的问题?
我用的jsp连oracle的类是conn.java

package   com.qingsoft.ga.utils;

import   java.sql.DriverManager;
import   java.sql.ResultSet;
import   java.sql.SQLException;
import   java.sql.Statement;

public   class   conn   {

        java.sql.Connection       Conn       =       null;      
        javax.sql.DataSource       ds       =       null;      
        java.sql.ResultSet       rs       =       null;

public     conn()   {
try   {
Class.forName( "oracle.jdbc.driver.OracleDriver ");
String   user   =   "system ";
String   password   =   "manager ";
Conn   =   DriverManager.getConnection( "jdbc:oracle:thin:@192.168.1.18:1521:MYORACLE ",user,   password);
}   catch   (Exception   e)   {
Conn   =   null;
System.out.print( "Error       To       Create       Connection ");
}
}

public   ResultSet   executeQuery(String   sql)   {
rs   =   null;
try   {
Statement   stmt   =   Conn.createStatement();
rs   =   stmt.executeQuery(sql);
}   catch   (SQLException   ex)   {
Conn   =   null;
rs   =   null;
System.err.println( "aq.execute-Query:       "   +   ex.getMessage());
}
return   rs;

}

}
主页index.jsp中的3个iframe是
dwml.jsp
  <%@   page     language= "java "   contentType= "text/html;charset=gb2312 "   import= "java.sql.* "%>          
<jsp:useBean   id= "dbconn "   class= "com.qingsoft.ga.utils.conn "   scope= "page "/>
<link   href= "images/css.css "   rel= "stylesheet "   type= "text/css "   />
<SCRIPT   language=JavaScript>  
function   openwin(code)
{
var   wincode;
wincode=code;
//window.open( "khfa.jsp?id= ' "+wincode+ " ' ", "khfa ", " ");                    
//window.open( "khjg.jsp?id= ' "+wincode+ " ' ", "khjg ", " ");  
document.getElementById( "khfa ").src   =   "khfa.jsp?id= ' "+wincode+ " ' ";
document.getElementById( "khjg ").src   =   "khjg.jsp?id= ' "+wincode+ " ' ";
}  
</script>
  <%!  
ResultSet   rst=null   ;
%>
  <%
try
    {
      String   code=request.getParameter( "id ");
      if(code==null){