简体   繁体   中英

JDBC Connection from MAC OS(EL Capitan) to Prebuilt Oracle VM

I must have searched the entire net for a solution but no success. I have installed a DeveloperDay prebuilt Oracle Linux 7.3 form the following site: http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html

I am able to connect to the database through SQL Developer using configurations like

  • Connection type : Basic
  • Username : scott
  • Password : oracle
  • hostname : localhost
  • Port : 1521
  • Service name : orcl

Connection is successful and I am able to query properly. But while trying to connect from jdbc from eclipse I am unable to connect. I am getting various errors for various attempts like

  • jdbc:oracle:thin:@localhost:1521:orcl

    Listener refused the connection with the following error: ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

  • jdbc:oracle:thin:@localhost:1521:orcl12c

java.sql.SQLException: ORA-01017: invalid username/password; logon denied

(username and password is entered as scott and oracle respectively)

  • jdbc:oracle:thin:@127.0.0.1:1521:orcl12c

java.sql.SQLException: ORA-01017: invalid username /password; logon denied

Please help to resolve this issue.

Because you try to access to a distance database, you consider VM like it is localhost and this is wrong, in fact it is another machine.

To solve this problem you should to use the IP Address of this VM not localhost, and this not easy you should to make some configuration of your VM you can follow this manuals here:

How to access Oracle DB in VirtualBox from Host (windows) and How to access localhost on Virtualbox host machine

and here

Connecting to Oracle from Your Host to a VirtualBox Guest Hope this can help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM