cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jrahma
Level 6

MDF file location

I am includin g SQL Express 2005 in my setup package and specefying the MDF & LDF files locations in the SQL script but when running the project it still creating both files in the default SQL Server folder in the Program Files!! why?

this is the create part in SQL Script:
[PHP]/****** Object: Database the_internet_cafe Script Date: 03/11/2009 9:12:58 PM ******/
CREATE DATABASE [the_internet_cafe] ON (NAME = N'the_internet_cafe', FILENAME = N'C:\Program Files\Jassim Rahma\TICS\Database\the_internet_cafe.mdf' , SIZE = 3, FILEGROWTH = 1) LOG ON (NAME = N'the_internet_cafe_log', FILENAME = N'C:\Program Files\Jassim Rahma\TICS\Database\the_internet_cafe_log.LDF' , SIZE = 1, FILEGROWTH = 10%)
GO[/PHP]
Labels (1)
0 Kudos
(27) Replies
hidenori
Level 17

Make sure that you uncheck the "Create Catalog If Absent" option on the Connection | General tab.
0 Kudos
jrahma
Level 6

I uncheck it but now I am getting the attached error!!
0 Kudos
Mrunmayee
Level 5

Make sure that the folder exists before you execute your SQL query.So that your ldf and mdf file will be created in that particular path.

-Mrunmayee
0 Kudos
hidenori
Level 17

Please check out this community thread.
0 Kudos
jrahma
Level 6

how can i make sure folder is created?!

I have already assigned the folder in the project property and created the script n the SQL script!

then what?!
0 Kudos
jrahma
Level 6

please help....
0 Kudos
hidenori
Level 17

If you target a local Microsoft SQL server, you can create the folder by authoring the CreateFolder table of your MSI project. When you create an empty component that targets the folder in the Setup Design view, InstallShield automatically creates that entry for you. If you target a remote server, you have to create the folder manually.
0 Kudos
jrahma
Level 6

ok..in a simple language..

I have created the folders in setup design including my data folder located at C:\Program FIles\Jassim Rahma\TICS\Data

and in my FILENAME in the SQL Script I have refferred to the same folder but it was not creating creating the file in that folder and after unchecking the Create Catalog if Absent I am getting an error..

now what?
0 Kudos
hidenori
Level 17

Sorry, I was refering a wrong other community thread in my earlier post in this thread. Please check it out one more time as I have corrected it. If the folder has already created before running the SQL script, the problem is that you target the database that you are trying to create. So you need to specify an empty string for the Target Catalog setting, or insert the USE master statement before the CRATE DATBASE statement.

Hope that helps.
0 Kudos
jrahma
Level 6

so you mean by just using USE mater before the CREATE my problem should be resolved?

I will give it a try and let you know...
0 Kudos
hidenori
Level 17

After I was thinking a bit more, I realized that inserting the USE master statement will not fix the problem. InstallShield will be trying to connect to the database that you specify for the Target Catalog setting when verifying SQL login credentials. I am assuming that you specify the database that you are trying to create. Please just try specifying an empty string for the Target Catalog setting if it fixes the error.

If you run other scripts that modify that database, please read this community thread.
0 Kudos
jrahma
Level 6

I tried the USE and it didn't work just like you said.

there is one problem if i set empty catelog... the database name in the SQL login dialog will be empty..

my current scenario: i have set the catalog to the_internet_cafe and the server to (local)\JASSIMSQL and then I set the enable property to false for both because I don't want the user to change it which works fine if I want data to be copied to the default MS SQL data folder but when I want data to be copied in my Data folder then I am having this problem?

I even tried creating the Data folder before the running the setup but I am getting the same error I have attached before.

What I need is very simple:

[LIST=1]
  • i want the MDF & LDF files to be copied in my specefic folder
  • I don't want the user to select the server. I want to force my instance.
  • I don't want the use to change the name of the catalog.


    what's the solution?
  • 0 Kudos
    hidenori
    Level 17

    In order to accomplish your requirements, you may need to use two connections as follows:

    [LIST=1]
  • Create a new Basic MSI project.
  • Go to the Property Manager, and create a property named IS_SQLSERVER_DATABASE2 with an empty value.
  • Go to the SQL Scripts view, and add two connections.
  • Uncheck the "Create Catalog If Absent" option on both connections.
  • For the first connection, select IS_SQLSERVER_DATABASE2 for the Target Catalog Property Name in the Advanced tab.
  • Add the script that creates the database to the first connection, and select only the "Run Script During Install" option in the runtime tab.
  • For the second connection, specify (local)\JASSIMSQL for the Target Server setting, and _internet_cafe for the Target Catalog setting.
  • If you have other scripts that modify the database, attach to the second connection.
  • Go to the Dialog Editor, and expand the SQLLogin dialog.
  • Add the following event to the Next button and place it before the DoAction event:
  • [IS_SQLSERVER_CONNECTIONS_TO_VALIDATE] 1
    where is the name of the first connection.
  • Set the Enabled setting to false for the cboServers and edtCatalog controls on the SQLLogin dialog.
  • Build and run the setup.
  • 0 Kudos
    jrahma
    Level 6

    i did the same exactly.. in the last part (the SQLLogin dialog), here is what i did to confirm:

    Event: [IS_SQLSERVER_CONNECTIONS_TO_VALIDATE]
    Argument:
    Condition: 1

    TICS_Connection_ is my first connection name (ends with _) and TICS_Connection is my second connection

    but I am still having the same attached error..
    0 Kudos
    hidenori
    Level 17

    For the Argument setting, you need to specify the name of the first connection without angle brackets as follows:

    Event: [IS_SQLSERVER_CONNECTIONS_TO_VALIDATE]
    Argument: TICS_Connection_
    Condition: 1

    Do you receive the error when you click the Next button on the SQLLogin dialog or when the script is executed? Is the problem reproducible if you run the same script from Microsoft SQL Server Management Studio?
    0 Kudos
    jrahma
    Level 6

    I tried without brackets but it's still the same problem. This problem doesn't exist in the previous scenario as explained when i don't care about the MDF location and the Create Catalog if Absent is checked.

    The error occurs during executing the script.

    I also checked at that level when the error was thrown and found that the folder Data was already created! so where is thr problem?

    now what's the solution?

    and Is there any way to expport my settings in order to show it here?
    0 Kudos
    hidenori
    Level 17

    Could you send me a sample project at hyamanishi@flexerasoftware.com so that I can look into it further?

    Thank you for your patience and cooperation.
    0 Kudos
    jrahma
    Level 6

    which file or folder i should send?
    0 Kudos
    hidenori
    Level 17

    Please send .ism and .sql files.
    0 Kudos
    jrahma
    Level 6

    sent to your email as requested..
    0 Kudos