我是一个ETL / BI / Stats资源,进入Grails(2.4.4)领域构建一个简单的UI:
Column Original Value New Value
> Fld 1 <display from schema.tbl> <Overrides>
> Fld 2 <display from schema.tbl> <Overrides>
=============================================== =========================
以下是我正在进行的工作:
package poc_grails_ao
class FM8 {
float fld1 = 15
String fld2
static mapping = {
table Name :FM8, schema:barsglobal
}
}
关于禁用DDL的dataSource.groovy的片段是:
dataSource {
dbCreate = "none" // one of 'create', 'create-drop', 'update', 'validate', ''
//dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
//url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
pooled = true
driverClassName = "com.ibm.db2.jcc.DB2Driver"
url = "jdbc:db2://hostname:port/DB Name"
dialect = org.hibernate.dialect.DB2Dialect
username = "id"
password = "passwd"
在使用H2的非DB2后端上,能够构建屏幕。但是在DB2后端,在成功连接之后,遇到以下错误:
2016-02-11 14:59:15,144 [http-bio-8080-exec-8] ERROR spi.SqlExceptionHelper - DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=THIS_.ID, DRIVER=3.61.65
Error |
ERROR errors.GrailsExceptionResolver - SqlSyntaxErrorException occurred when processing request: [GET] /POC_Grails_AO/FM8/index
DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=THIS_.ID, DRIVER=3.61.65. Stacktrace follows:
Message: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=THIS_.ID, DRIVER=3.61.65
a.Do the "create-drop","create" etc options for dbCreate impact the live table objects on the DB2 backend or a "copy" of the schema being built within the Grails env?
b. Is it possible to allow only DMLs(updates to data only) and not allow any drop/updates to schemas.
c. How is the implementation( a syntax example for one col is awesome!) to selectively choose few columns(Packed decimal, Strong, Date etc) from the DB2 table that would participate in the UI ?
当我从DWBI世界到前端GUI世界实现重大飞跃时,请跟我一试,到目前为止,我确实非常喜欢Grails的潜力!
由于 Raghu
答案 0 :(得分:0)
首先,欢迎来到SO和Grails!
请注意,在这里,每个帖子只会收到一个问题。前两个是相关的,所以我将介绍这些。
答案隐藏在documentation中,所以这里是 dbCreate 选项的副本:
基于此,dbCreate = 'validate'
将为您提供所需的服务。但是,这意味着您需要自己创建表。您可以使用schema-export命令让Grails帮助您。例如,如果运行:grails prod schema-export
,您将获得一个名为ddl.sql的文件,其中包含DB2 SQL DDL命令。 schema-export 命令还可以运行SQL DDL。您可以使用此功能来创建初始数据库。