What database name should I use to connect Tomcat with my database I have a dump file in Oracle and I should use Oracle 12c.

I installed it, created a database and imported the dump into a tablespace,
but I can't connect it with my application on Tomcat.

I'm lost between all the names in Oracle 12c. What username should I use to configure the Tomcat server.xml?
In Oracle 12c there are 4 key name-related concepts you need to know:


SID, or instance ID.
Database name / database unique name
Container / Pluggable database names
Service names


The instance ID is an ID that uniquely identifies one database instance running on one server.  On a Linux server, this is normally specified in the $ORACLE_SID variable, but also combined with $ORACLE_HOME to uniquely identify the binaries and data files that make up that database.

Database name is defined at database creation time (and can also be changed later with the nid tool).  This is embedded within the data files for this database.  The DB name can be the same as, or different to the instance ID.  It's possible to have multiple databases of the same name running on one host.  Database unique name can be the same or different to database name in a standalone setup, but in a data guard setup, each database must have a different unique name.

CDBs/PDBs. Oracle 12c introduced the concept of Pluggable DataBases.  With these, you have one "master" database (the container) into which you can plug/unplug one or more PDBs.  This matters because you can't use the SID any more to connect to a pluggable DB - there may be many PDBs open within that same SID.

Service names are a little more ephemeral in nature.  They're a construct which can be used to separate, monitor, control and report on database traffic.  They can be dynamically created or destroyed.  To connect to a PDB you must use (one of) the database's service(s).  They're useful because no matter what the database instance is called, the available services can remain the same.

An example of why services can be useful.  In dev/test/prod environments, if we used SIDs to connect to a database, we'd need to have either all our database instances named the same, or we'd have to change configuration files between environments.  Because we use service names, we can name the instance what we like but ensure the same services are running in all 3 environments.

By default when you create an instance, you end up with an service the same name as the SID + domain.

e.g.:

SID = orcl
domain = oracle.com
default service name = orcl.oracle.com


So, to get back to your question, you will almost certainly need to know the service name.  This can normally be found (on a Linux instance, anyhow) by running (as the oracle user, or equivalent in your environment):

lsnrctl status


e.g.

Service "devcdb.xxxx.national" has 1 instance(s).
  Instance "devcdb", status READY, has 1 handler(s) for this service...
Service "devpdb1.xxxx.national" has 1 instance(s).
  Instance "devcdb", status READY, has 1 handler(s) for this service...