I just created my first test application with Grails 2.0RC1 and used SQL Server 2008 as the database.
Here are the quick steps:
1. Install JDK/JRE (I used 1.6.latest)
2. Unzip Grails 2.0RC1 to an C:\grails2rc1\ directory
3. Create environment variables for JAVA_HOME(point to jdk install)
4. Create environment variables for GRAILS_HOME(point to grails directory)
5. Add the following to PATH environment variable: ";%JAVA_HOME%\bin;%GRAILS_HOME%\bin"
6. Test that you can call "javac" and "grails --help" from C:\
7. Create a database for grails from Management Studio
8. Create a user/pass and give it access to this database(I usually give it dbo and sysadmin during the initial install phase. You should dial it back after that)
9. ** TRICK ** Make sure TCP/IP is ENABLED using SQL Server Configuration Manager, under SQL Server Network Configuration -> Protocols for MSSQLSERVER
10. Create a directory for your app (C:\work\apps)
11. Open a command prompt and "cd" to that directory
12. "grails create-app myapp" (This creates the Grails structure)
13. Download the latest jTDS Driver and extract the files to a temp directory
14. Copy the jtds-1.2.x.jar file to the directory C:\mayapp\lib
15. Your conf/DataSource.groovy should look something like this:
dataSource {
pooled = true
driverClassName = "net.sourceforge.jtds.jdbc.Driver"
dialect = "org.hibernate.dialect.SQLServerDialect"
}
... other stuff
development {
dataSource {
dbCreate = "create-drop" // one of 'create', 'create-drop', 'update', 'validate', ''
url = "jdbc:jtds:sqlserver://127.0.0.1:1433;databaseName=grails2rc1"
username = "grailsadmin"
password = "your-Pass123"
// logSql=true
}
}
... more
16. Create your 1st controller: "grails create-controller dashboard"
17. Save, then run "grails run-app"
Showing posts with label Grails. Show all posts
Showing posts with label Grails. Show all posts
Thursday, October 27, 2011
Friday, September 17, 2010
SqlServer 2008 Connection Refused to Grails
I was setting up a test application on my development machine and I had everything configured, but the application would not start. After reviewing the error message, somewhere near the bottom, it said "Connection Refused".
The machine was running Windows 7, Sql Server 2008, and Grails 1.3.4. I was using the jTDS JDBC Driver 1.2.5 to connect to the database (just drop the jar in the lib directory). After searching for about 30 minutes, I found that TCP/IP access in SQL Server 2005/2008 is disabled by default.
To enable it, you can do this:
You'll need to enable it, set the port, set the IP, then restart the SQLServer service.
Here is what my DataSource.groovy looks like:
The machine was running Windows 7, Sql Server 2008, and Grails 1.3.4. I was using the jTDS JDBC Driver 1.2.5 to connect to the database (just drop the jar in the lib directory). After searching for about 30 minutes, I found that TCP/IP access in SQL Server 2005/2008 is disabled by default.
To enable it, you can do this:
SQL Server Configuration Manager-->SQL Server 2005 Network Configuration -->TCP/IP-->IP Address -->TCP portYou'll need to enable it, set the port, set the IP, then restart the SQLServer service.
Here is what my DataSource.groovy looks like:
dataSource {
pooled = true
driverClassName ="net.sourceforge.jtds.jdbc.Driver"
dialect = "org.hibernate.dialect.SQLServerDialect"
}
hibernate {
cache.use_second_level_cache=true
cache.use_query_cache=true
cache.provider_class="com.opensymphony.oscache.hibernate.OSCacheProvider"
connection.pool_size=10
}
// environment specific settings
environments {
development {
dataSource {
url = "jdbc:jtds:sqlserver://laptop_win7:1433;databaseName=gpay_DEV"
username = "GPayAdmin"
password = "MyPassword123!"
}
}
}
native2ascii error in Grails
When I create a new Grails app, I always get the native2ascii error.
In the past, I've always on into Config.groovy and changed this line to false:
Now, I've found a way to make sure the error does not show up at all.
Copy the tools.jar file from the JDKPATH/lib directory to the JREPATH/lib/ext directory.
copy %Java_Home%/lib/tools.jar to %Java_Home%/jre/lib/ext/tools.jar fixed this problem..
Thanks to grailslog!
In the past, I've always on into Config.groovy and changed this line to false:
grails.enable.native2ascii = trueNow, I've found a way to make sure the error does not show up at all.
Copy the tools.jar file from the JDKPATH/lib directory to the JREPATH/lib/ext directory.
copy %Java_Home%/lib/tools.jar to %Java_Home%/jre/lib/ext/tools.jar fixed this problem..
Thanks to grailslog!
Subscribe to:
Posts (Atom)