I am not being able to stablish the connection to an Oracle Spatial server in QGIS.
Apparently I have the connection configured accordingly with QGIS documentation, but it stills gives me an error:
ORA-12514:TNS_listener does not currently know service requested in connect descriptor
Here are my connection parameters as set in QGIS:
I have used the same parameters that I have set in the connection settings in SQL Developer (that works fine):
I have tried to use tnsping command to check the connection parameters and it is successful, regardless use:
tnsping [server_ip]:[port_number]/[SID]
or
tnsping [tnsname]
where [tnsname] is defined in the tnsnames.ora file with the same connection parameters indicated above:
[tnsname] = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (HOST = XXX.XXX.XX4.95) (PORT = 1521)) ) (CONNECT_DATA = (SID = anza1) (SERVER = DEDICATED) ) )
I am really running out of options… Can anyone help?
NOTE: I'am using QGIS 2.0.1-Dufour
Best Answer
The fact that tnsping completes is no indication that the database is actually accessible. All it does is tell that the TNS listener is up and running and listening on the port you expect. To illustrate that, just try something like this:
and you will still get a successful result.
A better way is to test using sqlplus, for example:
Your problem is most likely because you are mixing up the SID (= a physical identifier of a particular database instance) and the service (= a logical identifier that can be common to all instances of a database). Connections should really be done via a service name.
Some tools (like sqldeveloper) clearly offer you the choice to connect via a SID or a service names. Others, like QGIS are not so clear: what does "base de dados" means ? Is it supposed to be a service name ? Or a SID ? Probably a service name, considering the error message you get.
First try and connect using sqlplus:
Here
anza1
means a service name. If that fails too like QGIS, then your problem is just that the database has a service name different than anza1. A very common cause is that the service name for your database is a fully qualified dns name, for exampleanza1.db.oracle.com
. So you may want to try that as a service name for sqlplus (and then also QGIS).sqlplus /@XXX.XXX.XX4.95:1521/anza1.db.oracle.com
You can find out the services your database advertises by looking at the
service_names
parameter (must be DBA to do that):Here I can connect to the database using any of the offered service names.
You can also ask the listener about the services it knows about for each database instance:
As you can see, I can connect to that database using any of the offered services.
You can change the names of the services offered by doing this (as DBA):
That has an immediate effect.