无法在java存储过程中连接远程Oracle DB
我试图用传统的方式连接到java存储过程中的远程oracle数据库。我能够成功地调用java存储过程。但我在建立连接时收到异常“在索引1处缺少In或Out参数”。我不确定这个错误与建立连接有什么关系。但我没有其他java代码
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection(
"jdbc:oracle:thin:@host:port:servicename","user","pwd");
}catch(Exception e){
//(Missing In or Out parameter at index 1)
//logged the error in the local database table
}
有人能帮我更改连接到另一个oracle数据库的位置吗
# 1 楼答案
servicename
和sid
的连接URL不同格式:
服务名称:
jdbc:oracle:thin:@//host:port/ServiceName
有SID:
jdbc:oracle:thin:@host:port:SID