Table of Contents
The main prequisite is docker and docker compose.
- Docker
Install Guide: https://docs.docker.com/engine/install/ - Docker Desktop (Optional, but highly recommended)
Windows: https://docs.docker.com/desktop/install/windows-install/
Linux: https://docs.docker.com/desktop/install/linux-install/ - Make (Optional, but recommended for use Makefile commands without copy them)
Below is an example of how to create Oracle Linux container and how to configure Oracle Database FREE.
- Clone the repo
git clone https://github.com/root-hunter/oracle-docker.git
- Download dependencies, build image and initialize container
make build-all
- Enter in the container shell with docker exec command or with Exec menu in Docker Desktop, run following command (Initialize Oracle Database FREE)
/etc/init.d/oracle-free-23c configure
4a.a. Log into database (Shell - Pluggable Database (PDB))
sqlplus sys@localhost:1521/FREEPDB1 as sysdba
4a.b. Log into database (Shell - Container Database (CDB))
sqlplus sys@localhost:1521/FREE as sysdba
4b. Log into database (Java)
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@localhost:1521/FREEPDB1"); // jdbc:oracle:thin@[hostname]:[port]/[DB service name]
ods.setUser("[Username]");
ods.setPassword("[Password]");
Connection conn = ods.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT 'Hello World!' FROM dual");
ResultSet rslt = stmt.executeQuery();
while (rslt.next()) {
System.out.println(rslt.getString(1));
}
4c. Log into database (Python)
import oracledb
conn = oracledb.connect(user="[Username]", password="[Password]", dsn="localhost:1521/FREEPDB1")
with conn.cursor() as cur:
cur.execute("SELECT 'Hello World!' FROM dual")
res = cur.fetchall()
print(res)
4x. For more log snippet visit: https://www.oracle.com/in/database/free/get-started/
Distributed under the MIT License. See LICENSE
for more information.