Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/erikwegner/rust-oracle-database-poc
Access Oracle database from Rust application
https://github.com/erikwegner/rust-oracle-database-poc
oracle-database rust-lang
Last synced: 18 days ago
JSON representation
Access Oracle database from Rust application
- Host: GitHub
- URL: https://github.com/erikwegner/rust-oracle-database-poc
- Owner: ErikWegner
- Created: 2023-01-15T09:01:09.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-15T10:51:50.000Z (about 2 years ago)
- Last Synced: 2024-11-12T04:34:50.124Z (3 months ago)
- Topics: oracle-database, rust-lang
- Language: Rust
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# rust-oracle-database-poc
Access Oracle database from Rust application
Inspired by https://blogs.oracle.com/timesten/post/using-rust-with-oracle-databases
## Driver setup
See https://oracle.github.io/odpi/doc/installation.html#linux
```bash
# To be the root user, use sudo -i
apt install libaio1
mkdir -p /opt/oracle
cd /opt/oracle
wget https://download.oracle.com/otn_software/linux/instantclient/218000/instantclient-basiclite-linux.x64-21.8.0.0.0dbru.zip
unzip instantclient-basiclite-linux.x64-21.8.0.0.0dbru.zip
echo /opt/oracle/instantclient_21_8 > /etc/ld.so.conf.d/oracle-instantclient.conf
ldconfig
```## Database setup
```
docker exec -it rust-oracle-database_devcontainer-db-1 /bin/bashsqlplus / as sysdba
ALTER SESSION SET CONTAINER = XEPDB1;
CREATE USER rustapp IDENTIFIED BY kuMxNAZ2xYSh CONTAINER=CURRENT;
GRANT ALL PRIVILEGES TO rustapp CONTAINER=CURRENT;exit
export NLS_LANG=GERMAN_GERMANY.UTF8
sqlplus rustapp/kuMxNAZ2xYSh@XEPDB1CREATE TABLE Persons (
PersonID int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);INSERT INTO Persons (PersonID, LastName, FirstName, Address, City) VALUES (1, 'Wegner', 'Erik', 'Blumenstraße 1', 'Neustadt');
INSERT INTO Persons (PersonID, LastName) VALUES (2, '++anonymized');
```## Run
To run the application: `SVC_NAME=//db/XEPDB1 cargo run`
Output:
Service Name is //db/XEPDB1
Oracle Client Version: 21.8.0.0.0
Database Server Version: 21.3.0.0.0
Server Banner: Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0PERSONID LASTNAME FIRSTNAME ADDRESS CITY
1,Wegner,Erik,Blumenstraße 1,Neustadt
2,++anonymized,NULL,NULL,NULLBye