Skip to content

Commit 42fc8ee

Browse files
committed
update READEME.md
1 parent bf6e164 commit 42fc8ee

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

README.md

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,31 @@
22

33
The GORM Driver for Oracle provides support for Oracle databases, enabling full compatibility with GORM's ORM capabilities. It is built on top of the [Go DRiver for ORacle (Godror)](https://github.com/godror/godror) and supports key features such as auto migrations, associations, transactions, and advanced querying.
44

5-
## Prerequisite
5+
## Prerequisite: Install Instant Client
66

7-
### Install Instant Client
7+
To use ODPI-C with Godror, you’ll need to install the Oracle Instant Client on your system. Follow the steps on [this page](https://odpi-c.readthedocs.io/en/latest/user_guide/installation.html) to complete the installation.
88

9-
To use ODPI-C with Godror, you’ll need to install the Oracle Instant Client on your system.
9+
After that, you can connect to the database using the `dataSourceName`, which specifies connection parameters (such as username and password) using a logfmt-encoded parameter list.
1010

11-
Follow the steps on [this page](https://odpi-c.readthedocs.io/en/latest/user_guide/installation.html) complete the installation.
11+
The way you specify the Instant Client directory differes by platform:
1212

13-
After that, use a logfmt-encoded parameter list to specify the instant client directory in the `dataSourceName` when you connect to the database. For example:
13+
- macOS and Windows: You can set the `libDir` parameter in the dataSourceName.
14+
- Linux: The libraries must be in the system library search path before your Go process starts, typically configured using the `LD_LIBRARY_PATH` environment variable. The libDir parameter does not work on Linux.
1415

15-
```go
16-
dsn := `user="scott" password="tiger"
17-
connectString="[host]:[port]/cdb1_pdb1.regress.rdbms.dev.us.oracle.com"
18-
libDir="/Path/to/your/instantclient_23_8"`
16+
### Example (macOS/Windows)
17+
18+
``` go
19+
dataSourceName := `user="scott" password="tiger"
20+
connectString="dbhost:1521/orclpdb1"
21+
libDir="/Path/to/your/instantclient_23_26"`
22+
```
23+
24+
### Example (Linux)
25+
26+
Make sure the Instant Client libraries are installed and discoverable:
27+
28+
```sh
29+
export LD_LIBRARY_PATH=/path/to/instantclient_23_26:$LD_LIBRARY_PATH
1930
```
2031

2132
## Getting Started
@@ -24,15 +35,14 @@ dsn := `user="scott" password="tiger"
2435
package main
2536

2637
import (
27-
"github.com/oracle-samples/gorm-oracle/oracle"
28-
"gorm.io/gorm"
38+
"github.com/oracle-samples/gorm-oracle/oracle"
39+
"gorm.io/gorm"
2940
)
3041

3142
func main() {
32-
dsn := `user="scott" password="tiger"
33-
connectString="[host]:[port]/cdb1_pdb1.regress.rdbms.dev.us.oracle.com"
34-
libDir="/Path/to/your/instantclient_23_8"`
35-
db, err := gorm.Open(oracle.Open(dsn), &gorm.Config{})
43+
dataSourceName := `user="scott" password="tiger"
44+
connectString="dbhost:1521/orclpdb1"`
45+
db, err := gorm.Open(oracle.Open(dataSourceName), &gorm.Config{})
3646
}
3747
```
3848

0 commit comments

Comments
 (0)