grails安裝部署 Grails資料庫及中文配置

2021-10-13 07:48:01 字數 1450 閱讀 2931

你的位置:

技術文件

-> web

-> 文件詳情

grails資料庫及中文配置

1.資料庫配置檔案內容:

datasource {

pooled = false

driverclassname = "com.mysql.jdbc.driver"

username = "root"

password = "123456"

hibernate {

cache.use_second_level_cache=true

cache.use_query_cache=true

cache.provider_class='org.hibernate.cache.ehcacheprovider'

// environment specific settings

environments {

development {

datasource {

dbcreate = "update" // one of 'create', 'create-drop','update'

url = "jdbc:mysql://localhost:3306/disc_dev?useunicode=true&characterencoding=utf-8"

//logsql=true

test {

datasource {

dbcreate = "create"

url = "jdbc:mysql://localhost:3306/disc_test?useunicode=true&characterencoding=utf-8"

production {

datasource {

dbcreate = "create"

url = "jdbc:mysql://localhost:3306/disc_res?useunicode=true&characterencoding=utf-8"

這個配置說明開發使用的是mysql資料庫,因為驅動程式是com.mysql.jdbc.driver, 使用者名稱:root,密碼:123456。

在配置檔案裡配置了三個資料來源,分別對應grails的開發(development),測試(test)和部署(production)資料庫。在datasource裡使用logsql的原因是在控制台輸出sql語句方便除錯。

2. 關於grails的中文配置

(1)對grails生成的檔案不作任何編碼上的改動。

(2)資料庫需要配置使用utf-8編碼。如果使用mysql資料庫,需要修改my.ini檔案,在client section, mysql section 以及mysqld section裡把default-character-set的屬性改為utf8.

(3)要在頁面中使用文字,應該建立grails字串資源,同時在頁面中使用標籤來訪問。這樣可以保證頁面的跨語言屬性。

Eclipse安裝Grails元件

1.安裝groovy grails 2.安裝groovy外掛程式 http groovy.codehaus.org eclipse plugin 3.配置eclipse 如何在eclipse中開發grails專案 並茂 eclipse整合 官方文件 在eclipse裡使用grails類建立工具 使用...

grail安裝和建立乙個簡單的例子

1.安裝jdk,並配置環境變數 grails home f grails 2.3.11 path grails home bin 3.grails version 檢視版本號,檢驗是否安裝成功 2.建立資料表 grails create domain class org.training.stude...

安裝部署redis redis 安裝部署

wget redis 3.2.12.tar.gz 第二步 上傳軟體並解壓 解壓tar xzf redis 3.2.12.tar.gz改名稱 mv redis 3.2.12 redis第三步 安裝依賴軟體 yum y install gcc automake autoconf libtool make...