Oracle tnsping ok, spring JdbcTemplate TNS: listener does not currently know of SID given in connect descriptor

0

I'm facing a problem, I hope they can help me, I'm developing a web application running on tomcat using Spring-mvc and data access with JdbcTemplate, the database is Oracle 11g. Within this scenario as a prache, I have two environments, in the development environment everything works perfectly, access to data, pages etc. At the production environment I can not connect to the database in any way, testing by external tools (tnsping, plsql) connects right when squeeze the tomcat and I try to access the page, I get the following error message:

ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

)] with root cause oracle.net.ns.NetException: Listener refused the connection with the following error: ORA-12505, TNS: listener does not currently know of SID given in connect descriptor        at oracle.net.ns.NSProtocol.connect (NSProtocol.java:399)

The data access settings are saved in tomcat's context and server.xml, following the list of settings:

context.xml

<ResourceLink name="jdbc/OracleDB"
                global="jdbc/OracleDB"
                auth="Container"
                type="javax.sql.DataSource" /> 

Server.xml within the GlobalNamingResources node

<Resource auth="Container" driverClassName="oracle.jdbc.OracleDriver"
        global="jdbc/OracleDB" maxActive="100" maxIdle="20" maxWait="10000"
        minIdle="5" name="jdbc/OracleDB" password="SGC" type="javax.sql.DataSource"
        url="jdbc:oracle:thin:@NB-ATROMBETONE:1521:xe" username="SGC" />

The two settings mentioned above are from the development environment, in the production environment I only change the attributes, url, username and password of the resource.

Already check firewall rules, door lock, antivirus, but nothing solved. Anyone have any suggestions or went through this?

Thanks for any help.

    
asked by anonymous 11.12.2014 / 16:25

1 answer

1

problem solved. With the help of a professional from the database, we find in the Oracle documentation (see link: link ) the solution.

Resolution: Run TNSPing with the desired SID. After getting the positive answer from the test, get the block from the TNSNAMES that was used to solve the nickname. see image:

Okay, now that you already have the return, change the connection string by removing all the final part from the hostname of the server, then add the block that is highlighted in the image.

Before- > jdbc:oracle:thin:@NB-ATROMBETONE:1521:xe

Then- > jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = NB-ATROMBETONE)(PORT = 1521))(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE)))

Thank you all.

    
17.12.2014 / 17:29