奇怪!!

mzer mzer 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
ORACLE难道和网卡有关系!!错误如下:
the network adapter could not establish the connection

JAVABEAN的代码如下:

package net.cnnic.midwest;

import java.io.*;
import java.sql.*;
import java.util.*;

public class ConnectionBean
{
private static Connection conn = null;
// The machine on which the database resides
public static String hostname="123.123.123.123";
// The TNS listener port
public static String port="1521";
// The database name (SID)
public static String dbSID="mian";
// The database User ID
public static String username="test";
// The database user password
public static String password="test";

public static Connection getConnection()
{
if (conn == null)
{
try
{
hostname=System.getProperty("s_hostName","123.123.123.123");
System.out.println("dbsid:"+hostname);
port=System.getProperty("s_tnsPort","1521");
dbSID=System.getProperty("s_databaseSID","main");
System.out.println("dbsid:"+dbSID);
username=System.getProperty("s_userName","test");
System.out.println("user:"+username);
password=System.getProperty("s_Password","test");
System.out.println("pass:"+password);
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn = DriverManager.getConnection("jdbc:oracle:thin:@"+hostname+":"+port+":"+dbSID,username,password);
} catch(SQLException e)
{
e.printStackTrace();
return null;
}
}
return conn;

}

}
...全文
评论 2
收藏 已收藏
分享
返回顶部
mzer
Web 开发 81,107 成员 341,720 内容