客户端连接oracle服务器!!
import java.sql.*;
本地只有oracle驱动classes12.zip
现在classpath已经没有问题了。但是
执行以后的出错信息如下
ddddddIo 异常: The Network Adapter could not establish the connectionException in thread "main" java.lang.NullPointerException
at conndb.main(conndb.java:30)
public class conndb
{
public static void main (String args [])
throws SQLException
{
// Load the Oracle JDBC driver
Connection conn=null;
Statement stmt=null;
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
}catch(java.lang.ClassNotFoundException e){
System.err.println("aaaaa"+e.getMessage());
}
try{
conn=DriverManager.getConnection("jdbc:oracle:thin:@10.150.6.168:1521:hotmail","scott","tiger");
}catch(SQLException e){
System.err.print("dddddd"+ e.getMessage());
}
stmt=conn.createStatement();
// Select the ENAME column from the EMP table
ResultSet rset = stmt.executeQuery ("select ENAME from EMP");
}
}
问题点数:100、回复次数:3Top
1 楼packy_li()回复于 2002-04-10 14:53:14 得分 50
建议你把oracle安装目录下的jdbc目录下的jar、zip放入classpath,你如果用jbuilder开发的话,加入Libraries...中,其放置路径为:
../oracle/ora81/jdbc/lib/*.zip或*.jar;
另外还有可能使oracle的datasource server未启动引起!Top
2 楼xmvigour(微电-THINKING IN APP)回复于 2002-04-10 15:06:22 得分 50
try{
conn=DriverManager.getConnection("jdbc:oracle:thin:@10.150.6.168:1521:hotmail","scott","tiger");
stmt=conn.createStatement();
// Select the ENAME column from the EMP table
ResultSet rset = stmt.executeQuery ("select ENAME from EMP");
}catch(SQLException e){
System.err.print("dddddd"+ e.getMessage());
}
看看打印出来的是什么?
检查一下你的classpath!
Top
3 楼ExplorerBoy()回复于 2002-04-10 19:10:08 得分 0
问题结束!!原来同事的oracle有问题,,
散分Top
相关问题
- oracle 9i的客户端可以连接oracle 8.0.0.5的服务器端吗?
- (c#+ORACLE)客户端连接服务器端,软件连接失败!!
- Oracle 8.16 for Nt4客户端用Named Pipes协议连接服务器失败!
- ORACLE 8.0.5 客户端连接8.1.7的数据库服务器出错。
- pb8+oracle9i连接服务器不想装oracle客户端怎么办
- Oracle 8i客户端如何配置可以连接上Oracle10i服务器??
- ▲TADOConnection连接ORACLE,如何使服务器了解客户在线情况?▲
- oracle 客户端 可能以SYSDBA连接到服务器上吗? 确定一下
- 怎样在客户端实现连接服务器的数据库,不装oracle的客户端
- ASP能否在没有安装oracle(客户端和服务器均无)的情况下,远程连接别的机子上的ORACLE数据库服务器?




