如何在grails 3.0.7中配置ojdbc6驱动程序?

时间:2015-12-04 16:17:52

标签: grails-3.0

这是我的application.yml

from lmfit import minimize, Parameters, Parameter, report_fit
import numpy as np

xdata = np.array([177.,180.,183.,187.,189.,190.,196.,197.,201.,202.,203.,204.,206.,218.,225.,231.,234.,
      252.,262.,266.,267.,268.,277.,286.,303.])

ydata = np.array([0.81,0.74,0.78,0.75,0.77,0.81,0.73,0.76,0.71,0.74,0.81,0.71,0.74,0.71,
      0.72,0.69,0.75,0.59,0.61,0.63,0.64,0.63,0.35,0.27,0.26])

def fit_fc(params, x, data):
    n1 = params['n1'].value
    n2 = params['n2'].value
    n3 = params['n3'].value
    n4 = params['n4'].value
    n5 = params['n5'].value

    model = n1 + (n2 * x + n3) * 1./ (1. + np.exp(n4 * (n5 - x)))

    return model - data #that's what you want to minimize

# create a set of Parameters
# 'value' is the initial condition
# 'min' and 'max' define your boundaries
params = Parameters()
params.add('n1', value= 0.2, min=0.2, max=0.8)
params.add('n2', value= -0.005, min=-0.3, max=10**(-10))
params.add('n3', value= 1.0766, min=-1000., max=1000.)
params.add('n4', value= -0.36379, min=-1000., max=1000.)
params.add('n5', value= 274.0, min=0., max=1000.)

# do fit, here with leastsq model
result = minimize(fit_fc, params, args=(xdata, ydata))

# write error report
report_fit(params)

xplot = np.linspace(min(xdata), max(xdata), 1000)
yplot = result.values['n1'] + (result.values['n2'] * xplot + result.values['n3']) * \
                              1./ (1. + np.exp(result.values['n4'] * (result.values['n5'] - xplot)))
#plot results
try:
    import pylab
    pylab.plot(xdata, ydata, 'k+')
    pylab.plot(xplot, yplot, 'r')
    pylab.show()
except:
    pass
dataSources:
  dataSource:
    loggingSql: true
    pooled: true
    jmxExport: true
    driverClassName: org.h2.Driver
    username: sa
    password:

    environments:
     development:
      dataSources:
        dataSource:
            dbCreate: validate
            url: jdbc:oracle:thin:@hostname:1521/mydb            driverClassName: oracle.jdbc.OracleDriver
            dialect: org.hibernate.dialect.Oracle10gDialect
            jndiName: java:comp/env/jdbc/devapp

这是我的build.gradle条目:

grails.naming.entries:

    jdbc:
          devapp:
            type: javax.sql.DataSource
            driverClassName: oracle.jdbc.OracleDriver
            url: jdbc:oracle:thin:@hostname:1521/mydb
            username: "username"
            password: "password"
            properties:
              maxActive: 20
              maxIdle: 4
              initialSize: 4
              maxWait: -1

构建失败,出现以下错误。

  

错误无法解析配置':testRuntime'的所有依赖项。键入' gradle依赖'了解更多信息

1 个答案:

答案 0 :(得分:1)

当我在build.gradle中放置以下依赖项时,它可以工作。

编译'com.oracle:ojdbc6:11.2.0.3'