使用plsqldeveloper:
scott,tiger连接GAOCONG库可以成功。
java程序语句:
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:localhost:1521:GAOCONG", "scott", "tiger");
程序连接报错:
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:orcl主要问题:无论在程序里指定什么库名,程序就要去连接orcl库。我本机没有orcl库。自从拿了别人一个项目运行后就出现了这个问题,至今没有解决,请教各位了,谢谢。
scott,tiger连接GAOCONG库可以成功。
java程序语句:
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:localhost:1521:GAOCONG", "scott", "tiger");
程序连接报错:
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:orcl主要问题:无论在程序里指定什么库名,程序就要去连接orcl库。我本机没有orcl库。自从拿了别人一个项目运行后就出现了这个问题,至今没有解决,请教各位了,谢谢。
解决方案 »
- 请问一下, 引用同一个表的字段的值,修改后赋值给另一个字段,SQL语句怎么写?
- 请教oracle导出到sql server2005
- oracle安装不上啊???求救!!
- oracle 数字+字母排序问题
- 截掉字符串"HelloWorldh"中首尾的"H"和"h"
- sql语句在PL/SQL中能检索出数据,但在应用程序中执行该语句时就没有数据了???
- oracle 建用户的问题
- 为什么我的对象里的VARCHAR2字段中文串不能正常显示
- oracle 8i进数据库,怎么老是提示“没有监听器”啊!
- 怎么查询 ORACLE 用户最后一次登录的时间。
- oracle的任务调度与触发器。。
- 模糊查找的索引在什么情况下有效?
改成
DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:GAOCONG",
正解,谢谢,我还是太马虎了。确实要写个@。不过不写@居然数据库会自己去连orcl