Connect to Teamcity to OCI Autonomous Transaction Processing Database - oracle

I am trying to migrate my Teamcity database from internal to external, and I registered a free tier ATP database. I am not sure how to how to set the connection URL in the teamcity database property files to access the database.
The tnsnames I am referencing is from the following:
teamcitytestdb_medium = (description= (retry_count=20)(retry_delay=3)(address=(protocol=tcps)(port=1522)(host=adb.us-phoenix-1.oraclecloud.com))(connect_data=(service_name=rhhea6hkgj2saju_teamcitytestdb_medium.atp.oraclecloud.com))(security=(ssl_server_cert_dn="CN=adwc.uscom-east-1.oraclecloud.com,OU=Oracle BMCS US,O=Oracle Corporation,L=Redwood City,ST=California,C=US")))
The command I ran for the tests below are using this command:
bin/maintainDB.sh migrate -T $(pwd)/database.oracle.autodb.properties.dist
Here is a list of commands and output I tried:
Test1:
connectionUrl=jdbc:oracle:thin:#//adb.us-phoenix-1.oraclecloud.com:1522/rhhea6hkgj2saju_teamcitytestdb_high.atp.oraclecloud.com
driverName=oracle.jdbc.driver.OracleDriver
connectionProperties.user=<username>
connectionProperties.password=<password>
--------- output ---------
Cannot proceed with 'migrate' command: Could not connect to the target database: Could not connect to Oracle server.
IO Error: Got minus one from a read call: java.sql.SQLRecoverableException: IO Error: Got minus one from a read call. Caused by: oracle.net.ns.NetException: Got minus one from a read call
Test2:
connectionUrl=jdbc:oracle:thin:#tcps://adb.us-phoenix-1.oraclecloud.com:1522/rhhea6hkgj2saju_teamcitytestdb_high.atp.oraclecloud.com?wallet_location=/Users/jiuwang/Documents/Spectra/3rd-jars/teamcity-tests/Wallet_TeamCityTestDB
driverName=oracle.jdbc.driver.OracleDriver
connectionProperties.user=<username>
connectionProperties.password=<password>
--------- output ---------
Cannot proceed with 'migrate' command: Could not connect to the target database: Could not connect to Oracle server.
IO Error: The Network Adapter could not establish the connection: java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection. Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
Test3:
connectionUrl=jdbc:oracle:thin:#adb.us-phoenix-1.oraclecloud.com:1522:rhhea6hkgj2saju_teamcitytestdb_medium.atp.oraclecloud.com
driverName=oracle.jdbc.driver.OracleDriver
connectionProperties.user=<username>
connectionProperties.password=<password>
--------- output ---------
Cannot proceed with 'migrate' command: Could not connect to the target database: Could not connect to Oracle server.
IO Error: Got minus one from a read call: java.sql.SQLRecoverableException: IO Error: Got minus one from a read call. Caused by: oracle.net.ns.NetException: Got minus one from a read call
How should I setup this correctly so the migration tool can connect to the database? Thanks

You need to provide the TNS_ADMIN to point to the path where you have downloaded the wallet credentials to connect to Autonomous Database.
Also, the JDBC version is important. You can use pass TNS_ADMIN as part of the connection URL only if you are using JDBC driver version 18.3 and above.
I would suggest to try a DataSourceSample.java to make sure if the connection works.
DB_URL ="jdbc:oracle:thin:#wallet_dbname?TNS_ADMIN=/Users/test/wallet_dbname";
Also, refer to this page for more details.

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-00604. I create connection pool and I trying to ping in glassfish

I create Connection pool with this parameters:
I try to ping in glassfish web-interface and I have got this exceprion:
Ping Connection Pool failed for MyPool.
Connection could not be allocated because: ORA-00604: error occurred
at recursive SQL level 1 ORA-12705: Cannot access NLS data files or
invalid environment specified Please check the server.log for more
details. An error has occurred Ping Connection Pool failed for MyPool.
Connection could not be allocated because: ORA-00604: error occurred
at recursive SQL level 1 ORA-12705: Cannot access NLS data files or
invalid environment specified Please check the server.log for more
details.
I add ojdbc6.jar(download from official oracle web site) in C:\glassfish5\glassfish\domains\domain1\lib\ext (I have Oracle Database Express Edition 11g Release 2)
1) Please try by changing : Resource Type to javax.sql.ConnectionPoolDataSource and Database driver vender to oracle.jdbc.pool.OracleConnectionPoolDataSource
2) Try again a Ping

Connecting to Oracle 12 on remote server using Python 2.7.12 results into ORA-12170

Both databases are on remote server and I can get connected to and query on them using TOAD.
When connecting to database configured with OraClient11g_Home1 from Python on my desktop the connection is established successfully. However, trying to connect to database which is using OraClient12Home1 results into ORA-12170 error,i.e. TNS: Connect timeout occurred. Below are configurations.
Edited to contain more information:
I connect to the database using a remote desktop connection. The code is written to automate part of my testing activities by querying two databases and checking whether a single command has been successful on multiple systems(e.g. Ericsson and Huawei)
Output of one query is the input to another one (I can get output from the 11g DB and have previously wrote scripts for it, but this is the first time we're getting connected to the DB on Ora12 using python. I can access both DBs using TOAD on the remote desktop or connect and query 11g DB using python on my desktop but Ora12 throws time out for the same code.
the connection part of the code and how they are queried is as below:
#Get chrono number, action code and status from provisioning table
ip = '********'
port = *****
service_name = '*****'
dsn = cx_Oracle.makedsn(ip, port, service_name)
connection = cx_Oracle.connect("********","********",dsn)
cursor = connection.cursor()
totalChronoList = list()
myQuery=list()
inputData = list()
myQuery = ("select CHRONO_NUM_N, ACTION_CODE_V, STATUS_V from gsm_subs_provisioning where ACTION_DT_DT > SYSDATE - 2 order by ACTION_DT_DT desc")
cursor.execute(myQuery)
inputData.append(cursor.fetchall())
The configurations are as below:
OraClient11g_home1 (11.2.0.1)
ORACLE_HOME:C:\Oracle\product\11.2.0\client_1
ORACLE_HOME_NAME:OraClient11g_home1
ORACLE_HOME_KEY:HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraClient11g_home1
ORACLE_SID:
NLS_LANG:AMERICAN_AMERICA.WE8MSWIN1252
SQLPATH:C:\Oracle\product\11.2.0\client_1\dbs
LOCAL:
Client DLL:C:\Oracle\product\11.2.0\client_1\oci.dll
TNSNames.ora:C:\Oracle\product\11.2.0\client_1\Network\Admin\tnsnames.ora
SQLNet.ora:C:\Oracle\product\11.2.0\client_1\Network\Admin\sqlnet.ora
LDAP.ora:C:\Oracle\product\11.2.0\client_1\Network\Admin\ldap.ora
Login.sql:
GLogin.sql:
In system PATH:Yes
Home is valid:Yes
OraClient12Home1 (12.1.0.2)
ORACLE_HOME:E:\app\client\Oracle\product\12.1.0\client_1
ORACLE_HOME_NAME:OraClient12Home1
ORACLE_HOME_KEY:HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\KEY_OraClient12Home1
ORACLE_SID:
NLS_LANG:AMERICAN_AMERICA.WE8MSWIN1252
SQLPATH:E:\app\client\Oracle\product\12.1.0\client_1\dbs
LOCAL:
Client DLL:E:\app\client\Oracle\product\12.1.0\client_1\bin\oci.dll
TNSNames.ora:
SQLNet.ora:E:\app\client\Oracle\product\12.1.0\client_1\Network\Admin\sqlnet.ora
LDAP.ora:
Login.sql:
GLogin.sql:E:\app\client\Oracle\product\12.1.0\client_1\sqlplus\admin\glogin.sql
In system PATH:Yes
Home is valid:Yes
ORA-12170: TNS:Connect timeout occurred means you can't access the host and/or port of the DB. I bet in your case it is some restriction on firewalls (most reason, but may be others). First of all try to check is the port accessible. Easiest way - run powershell statement:
Test-NetConnection <host-or-ip> -port <port>
Then go with findings to sysadmin/dba.
Update: As you connect to DB using easy access method (ip, port, service name), you don’t have to care about tnsnames.ora.
In your 12c client we can see that no tnsnames.ora file is found.
Copy this file from the 11g client directory.

on using oracle database link theres an error "ORA-12154 TNS Could not resolve the connect identifier specified"

I'm trying to define a database link on oracle 10.2 with connection identifier that throws the error in the question header.
I have the connection identifier (service name) in my tnsnames.ora file.
I can connect with sqlplus using this service name. no problem.
This is the creation sql:
create database link dev1.REGRESS.RDBMS.DEV.US.ORACLE.COM
connect to user1 identified by pass1
using 'dev1';
select using the link:
select * from t_users#dev1;
I get: ORA-12154: TNS:could not resolve the connect identifier specified
connecting to oracle with sqlplus to the 'unidentified' service (with no problem):
sqlplus user1/pass1#dev1
I defined another link to the same database I'm woking in (loopback) - works OK.
I read and tried anything I could find about the subject but did not solve this.
Any suggestions?
Try:
create database link dev1 connect to user1 identified by pass1 using 'dev1';
Also note that a tnsnames.ora entry for dev1 has to exist on the database server that you're linking from.

Resources