# TNSNAMES.ORA Network Configuration File: /opt/oracle/product/9.2.0.4/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
EGO.LOCALDOMAIN =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.104)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ego)
)
)
这里注意host端口和SERVICE_NAME应为后面要用到
还有一个listener.ora文件
# LISTENER.ORA Network Configuration File: /opt/oracle/product/9.2.0.4/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = ego)
(ORACLE_HOME = /opt/oracle/product/9.2.0.4)
(PROGRAM = extproc)
)
)
这里注意你的数据库名称SID_NAME
然后重启
>lsnrctl stop
>lsnrctl start
或者reload一下 >lsnrctl reload
然后在我本机安装数据库客户端 特别简单按照步骤走就可以记住上面的名称内容不要填写错误 这样就可以链接了一个企业管理器就可以用了 还有要记住配置linux防火墙不然连接不上
这时启动plsqldevelopment这时出现了一个登录状态选择 表示成功
就可以用你的用户链接了
username: egostore
password: egostore
Database: EGO_192.168.1.104(这里开始我用报错tns 超时错误)
Connectas: normal
这样就可以利用plsql来创建咱们需要的东西了
还有只配置listener就可以通过客户端语言链接我用JAVA连接的很简单
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.104:1521:ego","dbauser","dbapassword");
PreparedStatement ps = conn.prepareStatement("select '智慧医学网' from dual");
ResultSet rs = ps.executeQuery();
rs.next();
System.out.println(rs.getObject(1));
我这里测试是否支持中文 结果通过了...