# Mac platform

### Connect using SQL developer tool <a href="#connect-using-sql-developer-tool" id="connect-using-sql-developer-tool"></a>

1. Download the SQL Developer.
2. Download SSL/TLS certificate from Service Overview page.
3. Import `crt/pem` to JKS file.

   `keytool -import -alias testalias -file TessellCA.crt -keypass keypass -keystore test.jks -storepass test@123`
4. Update JKS path in SQL Developer JVM command-line

   File path `~/.sqldeveloper/22.2.1/product.conf`

   `AddVMOption -Djavax.net.ssl.trustStore=/Users/<user>/Desktop/test.jks`\
   `AddVMOption -Djavax.net.ssl.trustStoreType=JKS`\
   `AddVMOption -Djavax.net.ssl.trustStorePassword=test@123`
5. Restart the SQL Developer.
6. Add a new connection and select options like below.

   <figure><img src="https://3421475909-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXNKiIctERJykfezXfUU2%2Fuploads%2F8T8VU9vHNSG5BcaRI6EK%2Fimage.png?alt=media&#x26;token=34e80d73-865c-413d-b0e1-43dd9c9c8b39" alt=""><figcaption></figcaption></figure>
7. Add Custom JDBC url.

   `jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(PORT=1521)(HOST=oraclesi19c<service name>-ppmno.qabyoaupg001.tsl-barc.cloud))(CONNECT_DATA=(SERVICE_NAME=orcl))(SECURITY=(ssl_server_cert_dn="CN=oraclesi19c<service name>-ppmno.qabyoaupg001.tsl-barc.cloud")))`
8. Verify the connection mode.

   `SELECT sys_context('USERENV', 'NETWORK_PROTOCOL') as network_protocol, sys_context('USERENV', 'AUTHENTICATION_METHOD') as authentication_method FROM dual;`

   <figure><img src="https://3421475909-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXNKiIctERJykfezXfUU2%2Fuploads%2FkId2RxxZhRtnBUWbH8UE%2Fimage.png?alt=media&#x26;token=c107e171-42cf-43f4-9644-f4d4e5408142" alt=""><figcaption></figcaption></figure>

### Connect using python code <a href="#connect-using-python-code" id="connect-using-python-code"></a>

#### x86 platform <a href="#x86-platform" id="x86-platform"></a>

The steps are same as Linux setup.

#### Apple M\* Chip <a href="#apple-m-chip" id="apple-m-chip"></a>

#### **Tools/Lib**

Latest Oracle instant libraries are not available for Apple M\* platform so we have to use Rosetta to use x86\_64 libraries.

#### **Run the terminal with Rosetta support**

1. Download Mac x86 Oracle instant libraries from    <https://www.oracle.com/cis/database/technologies/instant-client/macos-intel-x86-downloads.html> and unzip it.
2. Download and unzip *SQLcl* [*https://www.oracle.com/database/sqldeveloper/technologies/sqlcl/download/*](https://www.oracle.com/database/sqldeveloper/technologies/sqlcl/download/)*.*

#### **Setup oracle wallet**

Steps are same as Linux.

Now you can connect to DB using either `sqlplus` or python. `sqlplus` steps are same as Linux but make sure you run x86 `sqlplus` client from Rosetta enabled terminal.

#### **Connect using Python (Rosetta enabled terminal)**

<pre class="language-python" data-line-numbers><code class="lang-python">import oracledb
import cryptography
import os

cs = '''&#x3C;user>/&#x3C;password>@(DESCRIPTION = (ADDRESS = (PROTOCOL = TCPS)(HOST = oraclessl&#x3C;service name>dnd-efwyu.qarel.tsl-barc.cloud)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = &#x3C;service name>))(SECURITY = (SSL_SERVER_CERT_DN = "CN=oraclessl&#x3C;service name>dnd-efwyu.qarel.tsl-barc.cloud")))'''
<strong>
</strong><strong>oracledb.init_oracle_client(lib_dir="/Users/&#x3C;user>/orainscli/instantclient_19_8/")
</strong>
connection = oracledb.connect(user="&#x3C;user>", password="&#x3C;password>", dsn=cs)

cursor = connection.cursor()

cur = cursor.execute("SELECT sys_context('USERENV', 'NETWORK_PROTOCOL') as network_protocol, sys_context('USERENV', 'AUTHENTICATION_METHOD') as authentication_method FROM dual")

print(cur.fetchall())

connection.close()

</code></pre>
