请教:jsp用oci方式连接oracle

[复制链接]
查看11 | 回复1 | 2004-3-15 10:54:00 | 显示全部楼层 |阅读模式
请问:在jsp下,如果用oci的方式连接oracle?能否说得详细一些,或者给一个例子。谢谢!
回复

使用道具 举报

千问 | 2004-3-15 10:54:00 | 显示全部楼层
import java.sql.*;
class dbAccess {
public static void main (String args []) throws SQLException
{
try {

Class.forName ("oracle.jdbc.driver.OracleDriver&quot

;
} catch (ClassNotFoundException e) {

e.printStackTrace();
}
Connection conn = DriverManager.getConnection

("jdbc

racle

ci8:@hostname_orcl", "scott", "tiger&quot

;

// or oci7 @TNSNames_Entry,userid,password
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION&quot

;
while (rset.next())

System.out.println (rset.getString(1)); // Print col 1
stmt.close();
}
}
Back to top of file
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行