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

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.

Related

Trying to connect to database, getting error ORA-12154: TNS:could not resolve the connect identifier specified

I am new to oracle, I just installed oracle when I am trying to connect to the database I got this error.ORA-12154: TNS: could not resolve the connect identifier specified.
To connect onn Oracle DB you should configure the file tnsnames.ora wich define DNS to your oracle server.
After configure file, you can test your connection with tnsping DNS_NAMED_SERVER
if you never heard about tns names, you can read more on Oracle Docs https://docs.oracle.com/database/121/NETRF/tnsnames.htm#NETRF260

"ORA-12154:TNS:could not resolve the connect identifier specified" on Mac in SQL Developer

Connecting through Oracle SQL Developer(version 18.2.0.183) using wallet files(cwallet.sso and ewallet.p12) we are getting the following error “ORA-12154:TNS:could not resolve the connect identifier specified “when we test the connection via Advanced connection type in SQL Developer. We are using “jdbc:oracle:oci:/#NAME”. We are able to connect using SQLPLUS using “sqlplus /#NAME”. This is on a Mac(High Sierra) with the Instant Client Version 12.2.0.1.0.
https://www.oracle.com/technetwork/topics/intel-macsoft-096467.html
We have the TNSNAMES.ora and SQLNET.ora files configured and the wallet is set and working fine with SQLPLUS.
Is there anything we should look at to troubleshoot this further? Or any workarounds you might suggest?
Thanks,
Tom
Same advice I gave on the OTN forums -
make sure SQL Developer is reading the TNSNAMES file you think it is.
show tns
connect hr/oracle#orcl -- execute in a sqlworksheet with F5
TNS Lookup locations
--------------------
1. USER Home dir
C:\Users\jdsmith
Location used:
-------------
C:\Users\jdsmith
Available TNS Entries
---------------------
LISTENER_ORCL12C
ORCL
ORCL12C
Connected.
Connection created by CONNECT script command disconnected
If that fails, try EZCONNECT syntax
connect hr/oracle#server:port/SID
Also, there is a TNS connection type you can use. If OCI is enabled in preferences, your connection will be 'thick' and use sqlnet and tnsnames ora files.

ORA-12560: TNS: protocol adapter error

I have installed oracle client winx64_12102_client and configured tnsnames.ora . when I try to login with connect with sqlplus /nolog and then connect enter username and password.
It gives me error
ORA-12560: TNS: protocol adapter error.
I have been through many forums and have set ORACLE_HOME, PATH and TNS_ADMIN, but I am still getting the error.
In the Oracle net configuration assistant when i test if I am able to connect to database. the test succeeds, but in sqlplus I get this error
For client
I used username as username#servicename and password and then it worked.

connecting to oracle database on Windows

I have two machines on my network:
pc-1 is running on Windows XP SP3, IP 192.168.1.15
pc-2 is running on Windows Vista, IP 192.168.1.16
Now I have loaded Oracle 11gR2 on pc-2 (Vista) and the listener is running with the following settings: address=192.168.1.16 and port=1065.
I am trying to connect to Oracle database via pc-1 (XP) using jdbc thin driver but I get the error The network adapter could not establish the connection.
My JDBC url: jdbc:oracle:thin:#192.168.1.16:1065:ora
The pc-2 is reachable, I checked it by ping 192.168.1.16
I tried a few things from PC-1:
TELNET 192.168.l.16 1065 gives error Connecting To 192.168.1.16...Could not open connection to the host, on port 1065: Connect failed.
The firewall on pc-2 (vista+oracle) is turned off so I don't think firewall is blocking port 1065.
tnsping 192.168.1.16:1065 gives error TNS-12535: TNS:operation timed out
sqlplus sys/sys#//192.168.1.16:1065/ora as sysdba but it gives error
ERROR:ORA-12170: TNS:Connect timeout occurred
Some of the commands output on PC-2
netstat -a
LOCAL ADDRESS------------ FOREIGN ADDRESS-------------- STATE
192.168.1.16:1065----------------- PCNAME -------------------LISTENING
Can anyone please specify in details what shall I do? I am trying to do this first time so no idea about what is going wrong?
You have to give the proper SID details in the tnsnames.ora file located under
for Linux:
/home/oracle/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
You don't say how you're connecting - I am assuming through TNS?
Did you specify the port of 1065 in your TNSNAMES.ORA file on the XP system?
Can you connect from your XP system using EZCONNECT? That takes tnsnames.ora out of the equation.
sqlplus user/pw#//192.168.1.16:1065/db_name
ERROR:ORA-12170: TNS:Connect timeout occurred
this error usually means failure network connection
It's simple
shut down your windows firewall

Error in Toad - ora 12154

I am trying to make a connection using Toad to a database (xe10 free edition) and it givea me a error:
ORA-12154
I tried changing the sqlnetORA to:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
and still the same error.
1st check to make sure you can ping the database, if yes move to next step if not resolve firewall/network issues.
2nd check to see if you can connect via SQL*plus. If you can connect with SQL+ then your TNS is fine and Toad seems to be the issue, if you cannot then there is an issue with your TNS file.
Be sure to try and connect directly using the following method:
In Toad click "Session" > "New Connection"
There are 3 options TNS, Direct, LDAP (Shown as Tabs) . Select "Direct"
User: sys
Password : <passwd>
Host: 127.0.0.1
Port: 1521
Service Name: XE
Connect as: SYSDBA
If you are unable to connect via SQL+ or Toad then fix your .tns, I have attached a few helpful links below which should help resolve your problem.
http://www.dba-oracle.com/t_ora_12154_tns_resolve_service_name.htm
http://www.orafaq.com/wiki/Tnsnames.ora
try to comment the following line in sqlnet.ora
#names.default_domain = world
otherwise, Oracle will append .world to your host string
Often, it's a typographical error in your connexion string or in your tnsnames.ora file. More information here : 11g/ORA-12154.

Resources