SQL Server Plugin - script fails
Posted: Wed Jan 02, 2008 4:32 pm
The script creates a new database, its associated tables, users, logins, etc. When it executes, or fails, that is, I get nothing useful from IA - just "ERROR". However, the SQL log is interesting...
I use a variable in the SQL Script - $TARGETDIR$. I do this to have SQL Express create a database in a specific location. In my case, I've got the following:
CREATE FILE encountered... error 5 (Access is denied)... the physical file 'C:\\Program Files\\My AppDirectory\\Database\\MyDB_Data.MDF'.
The script section of the SQL plugin reads:
USE [master]
GO
/****** Object: Database [Coda] Script Date: 01/01/2008 16:56:22 ******/
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = N'MyDB')
BEGIN
CREATE DATABASE [MyDB] ON PRIMARY
( NAME = N'MyDB_Data', FILENAME = N'$TARGETDIR$\\Database\\MyDB.MDF' ,
SIZE = 2880KB , MAXSIZE = UNLIMITED, FILEGROWTH = 80KB )
LOG ON
( NAME = N'MyDB_Log', FILENAME = N'$TARGETDIR$\\Database\\MyDB_Log.LDF' , SIZE
= 10176KB , MAXSIZE = UNLIMITED, FILEGROWTH = 10%)
END
GO
The rest of the config is as follows:
Server: $SERVERNAME$
Instance: $SQLCHECK$
Database: master
Create database if absent: FALSE
User: blank - want to use Windows Auth
Password: blank
Return result in variable: SQLRESULT
Abort execution on script error: TRUE
If I run the script in Management Studio (after changing $TARGETDIR$ to the appropriate value), everything is fine.
Lastly - I'm running this on a stock XP SP 2 VM. It takes a while because I have to load both .NET 2.0, then SQL Express, and finally - run the script.
Please help...
Thanks,
M.
I use a variable in the SQL Script - $TARGETDIR$. I do this to have SQL Express create a database in a specific location. In my case, I've got the following:
CREATE FILE encountered... error 5 (Access is denied)... the physical file 'C:\\Program Files\\My AppDirectory\\Database\\MyDB_Data.MDF'.
The script section of the SQL plugin reads:
USE [master]
GO
/****** Object: Database [Coda] Script Date: 01/01/2008 16:56:22 ******/
IF NOT EXISTS (SELECT name FROM sys.databases WHERE name = N'MyDB')
BEGIN
CREATE DATABASE [MyDB] ON PRIMARY
( NAME = N'MyDB_Data', FILENAME = N'$TARGETDIR$\\Database\\MyDB.MDF' ,
SIZE = 2880KB , MAXSIZE = UNLIMITED, FILEGROWTH = 80KB )
LOG ON
( NAME = N'MyDB_Log', FILENAME = N'$TARGETDIR$\\Database\\MyDB_Log.LDF' , SIZE
= 10176KB , MAXSIZE = UNLIMITED, FILEGROWTH = 10%)
END
GO
The rest of the config is as follows:
Server: $SERVERNAME$
Instance: $SQLCHECK$
Database: master
Create database if absent: FALSE
User: blank - want to use Windows Auth
Password: blank
Return result in variable: SQLRESULT
Abort execution on script error: TRUE
If I run the script in Management Studio (after changing $TARGETDIR$ to the appropriate value), everything is fine.
Lastly - I'm running this on a stock XP SP 2 VM. It takes a while because I have to load both .NET 2.0, then SQL Express, and finally - run the script.
Please help...
Thanks,
M.