JDBC Connection failing with ORA-12505 on Win8, Oracle 11g XE - jdbc

I'm having an error that goes beyond what I see in TNS-12505: TNS:listener does not currently know of SID given in connect descriptor
I'm using Windows 8, Oracle 11.2 XE, java 1.7.15, and Eclipse Juno SR2.
The error I receive is:
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
I have the driver registered properly, and I've edited the listener.ora to make the service explicit, in both ways I've seen given as exampled - under SID_LIST_LISTENER, I added:
(SID_DESC =
(SID_NAME = XE)
(ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
)
and under LISTENER = (DESCRIPTION_LIST I added
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
tnsnames.ora contains, as its first entry:
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
The source code making the calls is:
Class.forName(JDBC_DRIVER);
String connectionString = "jdbc:oracle:thin:localhost:1521/XE";
myConnection = DriverManager.getConnection(connectionString, "myuser", "myuserpw");
I've also been through the following permutations on the connectionString. with results noted here:
jdbc:oracle:thin:#localhost:1521:XE // java.sql.SQLException: ORA-01017: invalid username/password; logon denied
jdbc:oracle:thin:localhost:1521:XE // error ORA 12505
jdbc:oracle:thin:#//localhost:1521:XE // error java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection
jdbc:oracle:thin:#localhost:1521/XE // error ORA-01017
jdbc:oracle:thin:#//localhost:1521/XE // error ORA-01017
Anyone have ideas?

I have an Answer! (Bloody-minded stubbornness is its own reward, I guess)
I changed which Connection call I made and restructured the connection string thataway, as in:
String connectionString = "jdbc:oracle:thin:myuser/mypw#localhost:1521:XE";
myConnection = DriverManager.getConnection(connectionString);
THAT works! Now the next guy can Google it. The version of the call with three parameters blows up every time I try it, but the same fundamental string with the username/pw embedded works in the single-parameter call.
I believe this is a bug in the driver provided with the XE database - oh Oracle, will you let us know?

OPEN cmd
execute the lsnrctl command.
Type start in the LSNRCTL> prompt.

Related

'TNS:could not resolve the connect identifier specified' when connecting to oracle instance through cx_Oracle

I have an Oracle instance on a AWS EC2 instance. When I run this in the AWS linux terminal, it is successful.
ubuntu#ip-xxx-xx-xx-xxx:~$ sqlplus user101/pass101#ip-xxx-xx-xx-xxx:1521/XE
However, when I run the same arguments when connecting through cx_Oracle I get a:
"ORA-12154: TNS:could not resolve the connect identifier specified" error
I know some common problems are with the tnsnames.ora file. I've placed that below.
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ip-172-xx-xx-xx)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
~
At the moment the full Easy Connect syntax is being interpreted as a TNS entry.
According to the Connect() documentation, you can use your current code if you specify that you are passing the user argument:
If the user parameter is passed and the password and dsn parameters are not passed, the user parameter is assumed to be a connect string in the format user/password#dsn, the same format accepted by Oracle applications such as SQL*Plus.
So this should work:
connection = cx_oracle.Connect(user="user101/pass101#ip-172-xx-xx-xx:1521/XE")
According to the Oracle connection handling documentation, you could also split that out:
connection = cx_oracle.Connect(
user="user101",
password="pass101",
dsn="ip-172-xx-xx-xx:1521/XE",
encoding="UTF-8"
)
Or if you want to use tnsnames.ora then just give that alias as the DSN value:
connection = cx_oracle.Connect(
user="user101",
password="pass101",
dsn="XE",
encoding="UTF-8"
)

SQL developer : Listener refused the connection

Dear stackoverflow community,
I know this question was already asked, but I tried to find a solution and unfortunately I'm blocked since 3 days now.
I installed Oracle 12c in Linux centos 7 server. When I try to access to the Oracle DB with SQL developer I have the following error:
Listener refused the connection with following error: ORA-12514, TNS:listener does not currently know of service requested in connect descriptor
What I do not understand is that if I restart the database I can connect. But Once I disconnect a try a reconnect I got the same error. Here is my listener.ora file
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ns3008269.ip-151-80-45.eu)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
And my tnsnames.ora is :
rspdata =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ns3008269.ip-151-80-45.eu)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rspdata)
)
)
oraclepdb =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = ns3008269.ip-151-80-45.eu)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oraclepdb)
)
)
And finally you can fin in attachment a screenshot of my Installation configuration.
I tried lot of and lot of thing... but still blocked.
Hello Stackoverflow community,
I was able to solve this issue. I re-installed Oracle 12c in Linux server and I used the tools netmgr and catmgr in order to configure the listener for the global DBname and also configure the services for PDB. This will automatically will modified the listener.ora and tnsnames.ora.
So my conclusion is that when installing Oracle12c do not modify by hand the listener.ora and tnsnames.ora.
Thank you all for your help and for the tips.

BizTalk ORA-12154: TNS:could not resolve the connect identifier specified

I am having issue with the new TNS connection. I have added the below code in to the tnsnames.ora file. I can verify the connection using the SQL Oracle developer, it is perfect.
c0xlxx =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxxxxxxxx)(PORT=xxxxxxxxx))
)
(CONNECT_DATA =
(SERVICE_NAME = xxxxxxx )
)
)
I did the sameway in the BizTalk application dev environment, it is working perfectly.But when I use in the BizTalk application in test environment using WCF-Custom adapter for OracleDBBinding with URI oracledb://c0xlxx/ it is throwing error
The adapter failed to transmit message going to send port "WcfSendPort_LTMDBBindingtoAX_View_VW_JOB_DEPT_Custom" with URL "oracledb://c0xlxx/". It will be retransmitted after the retry interval specified for this Send Port. Details:"Microsoft.ServiceModel.Channels.Common.ConnectionException: ORA-12154: TNS:could not resolve the connect identifier specified ---> Oracle.DataAccess.Client.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified Help me out.
Have some diferent properties to conection strings on TNS, you must need to seek the correct for your situation Example:
xxxxxx =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = xxxx)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = xxxx)
(SID = xxxx)
)
)
Can you send a properties who you entered to connect in SQL Oracle developer. Are you sure if you connect over TNS protocol in SQL Oracle developer
Try tnsping on windows cmd, command tnsping servername yours is c0xlxx. This command look like a ping, but its for oracle db server ping

TNS:listener does not currently know of SID given in connect descripton

When i am tring to access my oracle instance using basic connection type. It gives me an error telling "TNS:listener does not currently know of SID given in connect descripton",
But i can connect to the same user using Sqlplus
tnsping orcl =
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhos
t)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl.007gu
ard.com)))
OK (0 msec)
i even tried to use the service name instead of the sid to connect and it doesn't work !
yesterday everything was fine .. i have restarted my laptop and i got this problem .. ( all my oracle services work fine )

ODBC connection to oracle time-out

I'm new here so I introduce myself, my name is Ettore Giallaurito and my job is in the IT services in Italy.
My question:
I'm trying to connect to an Oracle DB instance through an odbc (System DNS) connections under XP but I get an error ORA1254 TNS:could not resolvethe connect identifier specified.
I'm using oracle instant client 11.2 and I've my tnsnames properly configured, since I can get connected with DBVisualizer using the TNS method.
To be honest I do get connected in this case, but I need to insert the full connect string:
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = repsit01.sit.sor)(PORT = 1521))
(CONNECT_DATA = (SERVICE_NAME = REPSIT01))
)
since it doesn't get me in if I use just the SID, in my case REPSIT01 as showed below.
My tns entry is as follow:
REPSIT01 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.1)(PORT = 1521))
(CONNECT_DATA = (SERVICE_NAME = REPSIT01))
)
Any help would be much apprecciated.
Thanks in advance Ettore.
Try setting the environment variable TNS_ADMIN to the directory where your tnsnames.ora file resides.

Resources