Question: I'm having trouble getting a connection established to my OracleDB that resides on a different system. From what I've learned from the [Oracledb Node module Documentation](https://github.com/oracle/node-oracledb/blob/master/doc/api.md#connectionhandling), the connection setup should look like this: 

```
oracledb.getConnection(
  {
    user          : "hr",
    password      : "welcome",
    connectString : "localhost/XE"
  }
  //fun querying goes here

```

I've reviewed the oracledb module documentation, however I cannot seem to find the syntax by which I need to follow when given certain variables. In order for me to secure a connection to the DB, I need to provide on the connection:

```
dbUserID: blah blah (maps to 'user' in Object),
dbPassword: Blahblahblah (maps to 'password' in Object),
oraclePort: (1521 as standard, but not sure where this goes in the object),
dbHostName: db.server.com (maps to 'localhost' in Object),
dbInstance: DBINSTANCENAME (not sure where this goes in object)

```

I'm fairly certain the hostname, port and instance are to be used in the 'connectString' section of the object, however I'm unsure how it should be formatted. 

Any help and suggestions on how I might go about getting myself connected would be greatly appreciated! 

EDIT: Im also receiving this error when the server is started up for the first time: `[Error: ORA-12162: TNS:net service name is incorrectly specified]` I thought I had solved this error but apparently I have not! Any suggestions would be appreciated.

Answer: 
I would use [NumPy](http://www.numpy.org/) for this. You can use `np.meshgrid` to create the `(X, Y)` axes and use NumPy's vectorized functions to create the function on these coordinates. The array `f` below is your two-dimensional array, here containing the product of `exp(-X/4)` and `exp(-((Y-2)/1.5)**2)`. (Substitute your own normalized functions here.)

```
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0,10,100)
y = np.linspace(0,5,100)
X, Y = np.meshgrid(x, y)
f = np.exp(-X/4.) * np.exp(-((Y-2)/1.5)**2)

fig = plt.figure()
ax = fig.add_subplot(111)
ax.imshow(f)
plt.show()

```

[![enter image description here](https://i.stack.imgur.com/CyEgy.png)](https://i.stack.imgur.com/CyEgy.png)

If you can't or don't want to use NumPy, you'll have to loop by hand and use conventional `math` functions:

```
import math
dx, dy = 0.1, 0.05
nx, ny = 101, 101
f = [[None]*nx for i in range(ny)]
for ix in range(nx):
    x = xmin + dx*ix
    for iy in range(ny):
        y = ymin + dy*iy
        f[iy][ix] = math.exp(-x/4.) * math.exp(-((y-2)/1.5)**2)

```
I would use numpy for this, because numpy makes it very simple to do what you want. If you can't use it, then something like the following should work:

```
import math

def gauss(x, mu=0.0, sigma=1.0):
    return 1.0 / math.sqrt(2.0*math.pi*sigma**2) * math.exp(-0.5*(x-mu)**2/sigma**2)

def exponential(x, lam=1.0):
    return lam * math.exp(-lam * x)

# X values from -10 to 10 with 0.01 step size
xvals = [x * 0.01 for x in range(-1000, 1001)]
# Y values from 0 to 10 with 0.01 step size
yvals = [y * 0.01 for y in range(0, 1001)]
# Calculate your function at the grid points
f = [[gauss(x)*exponential(y) for x in xvals] for y in yvals]

```