2013-10-26 47 views
2

我不能讓我的這個簡單的Grails應用程序通過,我創建了一個用戶做一個插入到我的表,即使我是能夠運行在SQL Management Studio中就好了查詢插入到MSSQL。無法通過Grails應用程序

我得到這個錯誤:

The INSERT permission was denied on the object 'mini_user', database  'Mini_test', schema 'dbo' 

InvalidDataAccessResourceUsageException: could not insert: [com.grailsinaction.MiniUser]; SQL [insert into mini_user (version, date_created, password, profile_id, user_id) values (?, ?, ?, ?, ?)]; 

我能夠沒有任何錯誤,運行管理工作室上面的查詢。

這裏是我的Grails的配置,但這個問題似乎是在SQL服務器端。

dataSource { 
    pooled = true 
    driverClassName = "net.sourceforge.jtds.jdbc.Driver" 
    dialect = "org.hibernate.dialect.SQLServerDialect" 
}  

test { 
    dataSource { 

     url = "jdbc:jtds:sqlserver://127.0.0.1:1433/Mini_test;instance=SQLEXPRESS;user=tester2;password=tester2" 
    } 

我也被放置在JTDS-1.3.1.jar在「LIB」(如果我能想出解決辦法,可能生病切換到Maven的依賴),並放置在運行時字符串buildconfig.groovy。

dependencies { 

    runtime 'net.sourceforge.jtds:jtds:1.3.1' 

} 

這是我嘗試給 「tester2」 任何和所有的訪問:

enter image description here

enter image description here

enter image description here

enter image description here 我不知道還有什麼嘗試。看起來我已經爲該用戶提供了無限訪問權限,所以我不確定這些權限問題來自哪裏。

回答

1

我沒有仔細看足夠的權限。我檢查了「db_denydatareader」和「db_denydatawriter」。很簡單...

1

我注意到你是不是在你的conf文件中指定的數據庫名。

這是我的樣子:

dataSource { 
     url = "jdbc:jtds:sqlserver://server1:1433;databaseName=MyDbName" 
     username = "user" 
     password = "*******Pass" 

     // logSql=true 
    } 

同時,確保用戶映射已經在服務器級別剛下在DB級別的安全性已設立了安全和不。

+0

我指定的數據庫名稱的URL字符串/ Mini_test。根據jtds文檔,這似乎是好的。 http://jtds.sourceforge.net/faq.html#urlFormat – jcd

相關問題