oracle.sql.BLOB blob=(oracle.sql.BLOB)(((oracle.jdbc.driver.OracleResultSet)rs).getBlob("content")); 就是这句产生异常的但用String user="testuser";
String password="password";
String url="jdbc:oracle:thin:@192.168.0.60:1521:ORACLEDB";
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
conn=DriverManager.getConnection(url,user,password);
这个就不会产生异常,我用的是tomcat自带的连接池代码如下
InitialContext ctx=new InitialContext();
DataSource ds=(DataSource)ctx.lookup("java:comp/env/jdbc/myoracle");
conn = ds.getConnection();
连接池绝对没有问题,我其他类也是用这个连接的同时oracle.jdbc.OracleResultSet rs=(oracle.jdbc.OracleResultSet )stmt.executeQuery也会产生同样异常,跪求解决之道,分数不够,可以再开贴
------解决方法--------------------------------------------------------
这样看不出什么,你最好把xml也粘出来.
Context ctx = new InitialContext();
if(ctx == null ) throw new Exception("Boom - No Context");
javax.sql.DataSource ds=(javax.sql.DataSource)ctx.lookup("java:comp/env/jdbc/oracle");
Connection conn = ds.getConnection();
Statement stmt = conn.createStatement();
ResultSet rst = stmt.executeQuery("select * from yuyu.test");
------解决方法--------------------------------------------------------
这是我的tomcat连接oracle的连接池你看那里和你的不一样!
<Resource name="szf" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="szf">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@192.168.70.111:1521:mydb</value>
</parameter>
<parameter>
<name>username</name>
<value>zgsx</value>
</parameter>
<parameter>
<name>password</name>
<value>zgsx</value>
</parameter>
<parameter>