Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  


» Java开发网 » Application Server  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 如何在Oracle9iAS Containers for J2EE中使用oci8 driver

发贴: 0
积分: 0
于 2003-07-18 17:31 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在Oracle9iAS Containers for J2EE中使用oci8 driver查询oracle数据库时jsp页面无显示。我先修改config下的data-sources.xml如下所示:
<?xml version="1.0"?>
<!DOCTYPE data-sources PUBLIC "Orion data-sources" "">

    An example/default DataSource that uses
    Oracle JDBC-driver to create the connections.
    This tag creates all the needed kinds
    of data-sources, transactional, pooled and EJB-aware sources.
    The source generally used in application code is the "EJB"
    one - it provides transactional safety and connection
    pooling. Oracle thin driver could be used as well,
    like below.


<%@ page contentType="text/html; charset=shift_jis" %>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="javax.sql.*" %>
<%@ page import="javax.naming.*" %>
<%@ page import="*" %>

  Connection conn = null;
  Context ic = new InitialContext();
  Statement sttSql = null;
  ResultSet rs = null;
  out.println("<font size=8 color=red>start!</font>");
    DataSource ds = (DataSource) ic.lookup("jdbc/OracleDS");
    conn = ds.getConnection();
    sttSql = conn.createStatement();
    rs = sttSql.executeQuery("select emp_name from employee");
      out.println(rs.getString("emp_name") + "<br>");
    out.println("<font size=8 color=red> end! </font>");
  catch(Exception e){
    out.println("<font size=8 color=red>error!</font>");

flat modethreaded modego to previous topicgo to next topicgo to back
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱    客服QQ 714923