我建立一個Grails應用程序將連接到Sybase SQL Anywhere數據庫和我得到一個非常令人沮喪的錯誤,說:Grails的「數據源名稱未找到和指定默認驅動程序」的錯誤
URI: /Booklist/user/authenticate
Class: java.sql.SQLException
Message: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified`
我使用的代碼不工作是:
def sql = Sql.newInstance("jdbc:ianywhere://localhost:1234/dbName", "user", "password", "ianywhere.ml.jdbcodbc.jdbc3.IDriver")
我的堆棧跟蹤是:
Line | Method
->> 490 | connect in ianywhere.ml.jdbcodbc.jdbc3.IDriver
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 579 | getConnection in java.sql.DriverManager
| 221 | getConnection in ''
| 16 | getBooks in Book.groovy
| 11 | authenticate in UserController.groovy
| 195 | doFilter in PageFragmentCachingFilter.java
| 63 | doFilter . . in AbstractFilter.java
| 1110 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 603 | run . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 722 | run in java.lang.Thread
任何想法?謝謝!
感謝您的信息,Beckwith先生。所以,如果我添加依賴到我的'BuildConfig.groovy',它會看起來像'runtime'mysql:mysql-connector-java:5.1.20''?我如何找到我將使用的驅動程序的語法?我懷疑它會像'運行時'iAnywhere:某事'',但我不知道如何找到該語法。 – grantmcconnaughey
我使用http://mvnrepository.com/並使用他們的搜索。它們不顯示Grails語法,但很容易弄清楚。例如。請參閱http://mvnrepository.com/artifact/com.lowagie/itext/4.2.0 - grails語法是'groupId:artifactId:version',因此它會是''com.lowagie:itext:4.2。 0'' –
非常感謝您的幫助!同時,恭喜新的Grails書籍,我期待着閱讀它。 – grantmcconnaughey