node-persist icon indicating copy to clipboard operation
node-persist copied to clipboard

Connection is undefined or null

Open RobertZito opened this issue 11 years ago • 1 comments

I am new to this package, I have worked with Hibernate so I kind of understand the ORM. But the document indicates that if the dB is specified it assumes the connection is made. So I have the below in my database.json but I keep getting connection is null or undefined if I attempt just the basic sample. Can someone show me a connection example with node Oracle?

"oracle": {
    "driver": "oracle",
    "hostname": "localhost",
    "port": 1521,
    "database": "hr",
    "user": "xxxe",
    "password": "password"
}  

RobertZito avatar Mar 14 '14 21:03 RobertZito

Do you have a TNSNAMES.ora file already? I had to set the environment variable TNS_ADMIN and point it to my projects TNS name file - http://stackoverflow.com/questions/5568342/how-can-i-configure-my-oracle-tnsnames-file-location

Here is my example of the connection string:

persist.setDefaultConnectOptions({ "driver": "oracle", "tns": "SHR3STAG", "user": "redacted", "password": "redacted" });

Outside of a tns file try assigning the connection details with persist.setDefaultConnectOptions or make sure your database.json file is as the example (in terms of structure) and at the ROOT level of your project (seems like this should be configurable).

ioneyed avatar Mar 31 '14 18:03 ioneyed