This is the code that I use to connect with the Oracle database that is on my pc:
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection co = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:etecsa", "system", "asd");
It works but if I change localhost for an ip it can not connect to the database. I already deactivated the firewall but nothing.
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection co = DriverManager.getConnection("jdbc:oracle:thin:10.8.6.50:1521:etecsa", "system", "asd");
Where can I configure the oracle database to accept the connection from a specific ip and not only from localhost?
答案 0 :(得分:0)
JDBC:预言:driver_type:[用户名/密码] @database_specifier
所以在你的情况下(如果 etecsa 是SID
),网址将为@host:port:SID
jdbc:oracle:thin:@10.8.6.50:1521:etecsa
如果 etecsa 是服务名称,请使用@//host:port/service_name
jdbc:oracle:thin:@//10.8.6.50:1521/etecsa