Showing posts with label path. Show all posts
Showing posts with label path. Show all posts

Tuesday, March 27, 2012

Configuration File not always used

I have a simple SSIS package (stored in the file system) that gets a file path from a configuration file.The configuration type is an indirect XML configuration file that uses an environment variable to store the location of the configuration file.

When I run the package using dtexecui, or just dtexec from a command line, the package successfully picks up the file path from the configuration file (for verification I am writing out the variable containing the path to the log file).However when I run the package from a SQL Agent job it appears that the configuration file is not being used (the path is set to the same dummy path that I used during development).I have tried running the job as both a CmdExec and an Integration Services job and both fail on the same thing (invalid file path).

Both the SQL Server Agent service and the Integration Services service use a domain account as their start up account.This domain account has been included in the local administrators group on the server (in case it was having trouble accessing the environment variables).

What is the problem here – surely changing the way in which the package runs should not affect the configuration file settings!Any help would be appreciated…

Seems like it should work. Maybe your Security ProtectionLevel setting? It's not set to EncryptSensitiveWithUserKey, is it? And even so, I couldn't explain to you why that would cause the problem.|||

Are you using relative paths?

Sounds like you are.

Needs to be full path.

Can you show what the configuration values are?

|||The protection level on the package is set to DontSaveSensitive. I don't think that is the problem though because the configuration value is saved locally in an XML file not in a database...|||

The configuration value I am using is not a relative path, it is a full path i.e. "D:\LandingArea\Daily\". In my SSIS package I call a number of "child" SSIS packages which are all set as relative paths. I know that this causes trouble so I use the PackagePath that I get from the configuration file to set the relative path to a full path. As I mentioned I am writing out the PackagePath to the log file to verify its value, and when I run the package using dtexecui it writes the correct path to the log file, however when I run it from SQL agent I get the path that was hardcoded in the package during development.

|||

I did some more trouble-shooting for this issue. I created a small test package that has 1 variable and 1 Connection.The package has a script task in which it writes the values for both the variable value and connection string to a SQL log file – that is all that the package does (keeping it simple)...

What I discovered is that when using direct XML configuration files the package picks up the correct settings every time regardless of how the package gets executed.When using Indirect XML Configuration, the package picks up the correct configuration settings when running it using dtexecui or dtexec from the command line, however when running it from a SQL agent job (regardless of whether it is a CmdExec job or not) it ignores the configuration settings and uses whatever the last values were in development.The package does not seem to issue any warning message that it could not access the environment variable or configuration file!

Since I am logged on as local administrator and have system administrator rights on SQL I’m assuming that this is a bug and not by design!

|||

Flamin,

Just in case; Jamie has blogged about a special behavior (issue?) when uisng indirect configuration.

http://blogs.conchango.com/jamiethomson/archive/2005/10/31/2336.aspx


Rafael Salas

|||

I am sure that I logged off after creating the environment variables but just to be safe (and because I had the opportunity to) I rebooted the server - VOILA it all works now! Thanks Rafael!

Configuration File not always used

I have a simple SSIS package (stored in the file system) that gets a file path from a configuration file.The configuration type is an indirect XML configuration file that uses an environment variable to store the location of the configuration file.

When I run the package using dtexecui, or just dtexec from a command line, the package successfully picks up the file path from the configuration file (for verification I am writing out the variable containing the path to the log file).However when I run the package from a SQL Agent job it appears that the configuration file is not being used (the path is set to the same dummy path that I used during development).I have tried running the job as both a CmdExec and an Integration Services job and both fail on the same thing (invalid file path).

Both the SQL Server Agent service and the Integration Services service use a domain account as their start up account.This domain account has been included in the local administrators group on the server (in case it was having trouble accessing the environment variables).

What is the problem here – surely changing the way in which the package runs should not affect the configuration file settings!Any help would be appreciated…

Seems like it should work. Maybe your Security ProtectionLevel setting? It's not set to EncryptSensitiveWithUserKey, is it? And even so, I couldn't explain to you why that would cause the problem.|||

Are you using relative paths?

Sounds like you are.

Needs to be full path.

Can you show what the configuration values are?

|||The protection level on the package is set to DontSaveSensitive. I don't think that is the problem though because the configuration value is saved locally in an XML file not in a database...|||

The configuration value I am using is not a relative path, it is a full path i.e. "D:\LandingArea\Daily\". In my SSIS package I call a number of "child" SSIS packages which are all set as relative paths. I know that this causes trouble so I use the PackagePath that I get from the configuration file to set the relative path to a full path. As I mentioned I am writing out the PackagePath to the log file to verify its value, and when I run the package using dtexecui it writes the correct path to the log file, however when I run it from SQL agent I get the path that was hardcoded in the package during development.

|||

I did some more trouble-shooting for this issue. I created a small test package that has 1 variable and 1 Connection.The package has a script task in which it writes the values for both the variable value and connection string to a SQL log file – that is all that the package does (keeping it simple)...

What I discovered is that when using direct XML configuration files the package picks up the correct settings every time regardless of how the package gets executed.When using Indirect XML Configuration, the package picks up the correct configuration settings when running it using dtexecui or dtexec from the command line, however when running it from a SQL agent job (regardless of whether it is a CmdExec job or not) it ignores the configuration settings and uses whatever the last values were in development.The package does not seem to issue any warning message that it could not access the environment variable or configuration file!

Since I am logged on as local administrator and have system administrator rights on SQL I’m assuming that this is a bug and not by design!

|||

Flamin,

Just in case; Jamie has blogged about a special behavior (issue?) when uisng indirect configuration.

http://blogs.conchango.com/jamiethomson/archive/2005/10/31/2336.aspx


Rafael Salas

|||

I am sure that I logged off after creating the environment variables but just to be safe (and because I had the opportunity to) I rebooted the server - VOILA it all works now! Thanks Rafael!

sqlsql

Sunday, March 25, 2012

Configuration failing: The path is not of a legal form.

When I push Add in the configuration dialog, I cannot even get to the first page of the configuration wizard, due to the following error, in several solutions (but not in several others). All have at least one existing configuration (necessarily, to get passwords for connections).
**
An error occurred while a new configuration was being added.
Additional Information:
The path is not of a legal form. (mscorlib)

**

PS: How have the rest of you been posting? Passport hasn't been working much this week, so I've been unable to post. Is there a way to post without using passport? Please tell me if so :)

What types of configuration (XML configuration file, Environment variable, etc) do your packages use?|||This is a known issue when you edit the package "standalone",
i.e. without creating the SSIS project. A workaround is to create
the project, add the package to the project, and then edit
the configuration.

We plan to fix this issue for SP1 (it was reported too late to
consider changing this for RTM release).

Thanks,
Michael.|||(Sorry, I have to wade through a lot of script errors and bad passport certificate errors to be able to post to this forum.)
The configuration involved is an environment variable pointing at an XML config file.
The package is in a project in a solution.
However, the solution has two packages, one of which calls the other.
Because of the bug that Execute SSIS task cannot handle relative paths, we have to use a mapped drive to call the package, so the target package is called via a mapped drive fully qualified file path.
I've since discovered that the bug here is that if the package is opened from the mapped drive, even though it is the same file, the Package Configuration Wizard will give this mscorlib error. The workaround for this bug is to be careful and be sure to first close the package, then open it by double-clicking it in the solution, when you need to examine or edit package configurations.
Of course, I hope this bug gets fixed, but truly, it is not nearly as bad as the bug that relative paths get wrecked and fail in the Execute SSIS task.
|||I see - this indeed seems like a different bug.
Could you please open a bug on betaplace?|||re: bug on betaplace
I invested some time trying to get into betaplace, which involved waving my cursor around to find an invisible button I had to click, and then getting to a page which said I would be granted access at some point. I tried several times on successive days, but I never got further than that. I posted my travails several times to the newsgroup, but noone had any suggestions, so I finally gave it up as something that only costs me time, and brought no benefit to anyone (as I was never able to get to a point of actually accessing any information, much less posting new bugs).
Could you open the bug on betaplace? I have a suspicion that it probably works much better for people working at Microsoft :)

|||OK, I'll open a bug directly in our bug tracking system.|||Hi,
I know its probably to late for you ( Perry_Rapp )
but
for other who trying to find solution to the "The path is not of a legal form" problem here it is:

1. open a new project/solution
2. copy the old project\s to the new "solution folder"
3. add the old project\s to the new solution from the new "solution folder".
(right click on "solution" -> Add -> Existing Project... )

Note:
if you have virtual folders in your solution first add the old project\s to the new solution root and after saving .. create the virtual folders

Configuration failing: The path is not of a legal form.

When I push Add in the configuration dialog, I cannot even get to the first page of the configuration wizard, due to the following error, in several solutions (but not in several others). All have at least one existing configuration (necessarily, to get passwords for connections).
**
An error occurred while a new configuration was being added.
Additional Information:
The path is not of a legal form. (mscorlib)

**

PS: How have the rest of you been posting? Passport hasn't been working much this week, so I've been unable to post. Is there a way to post without using passport? Please tell me if so :)

What types of configuration (XML configuration file, Environment variable, etc) do your packages use?|||This is a known issue when you edit the package "standalone",
i.e. without creating the SSIS project. A workaround is to create
the project, add the package to the project, and then edit
the configuration.

We plan to fix this issue for SP1 (it was reported too late to
consider changing this for RTM release).

Thanks,
Michael.|||(Sorry, I have to wade through a lot of script errors and bad passport certificate errors to be able to post to this forum.)
The configuration involved is an environment variable pointing at an XML config file.
The package is in a project in a solution.
However, the solution has two packages, one of which calls the other.
Because of the bug that Execute SSIS task cannot handle relative paths, we have to use a mapped drive to call the package, so the target package is called via a mapped drive fully qualified file path.
I've since discovered that the bug here is that if the package is opened from the mapped drive, even though it is the same file, the Package Configuration Wizard will give this mscorlib error. The workaround for this bug is to be careful and be sure to first close the package, then open it by double-clicking it in the solution, when you need to examine or edit package configurations.
Of course, I hope this bug gets fixed, but truly, it is not nearly as bad as the bug that relative paths get wrecked and fail in the Execute SSIS task.
|||I see - this indeed seems like a different bug.
Could you please open a bug on betaplace?|||re: bug on betaplace
I invested some time trying to get into betaplace, which involved waving my cursor around to find an invisible button I had to click, and then getting to a page which said I would be granted access at some point. I tried several times on successive days, but I never got further than that. I posted my travails several times to the newsgroup, but noone had any suggestions, so I finally gave it up as something that only costs me time, and brought no benefit to anyone (as I was never able to get to a point of actually accessing any information, much less posting new bugs).
Could you open the bug on betaplace? I have a suspicion that it probably works much better for people working at Microsoft :)

|||OK, I'll open a bug directly in our bug tracking system.|||Hi,
I know its probably to late for you ( Perry_Rapp )
but
for other who trying to find solution to the "The path is not of a legal form" problem here it is:

1. open a new project/solution
2. copy the old project\s to the new "solution folder"
3. add the old project\s to the new solution from the new "solution folder".
(right click on "solution" -> Add -> Existing Project... )

Note:
if you have virtual folders in your solution first add the old project\s to the new solution root and after saving .. create the virtual folders

Configuration failing: The path is not of a legal form.

When I push Add in the configuration dialog, I cannot even get to the first page of the configuration wizard, due to the following error, in several solutions (but not in several others). All have at least one existing configuration (necessarily, to get passwords for connections).
**
An error occurred while a new configuration was being added.
Additional Information:
The path is not of a legal form. (mscorlib)

**

PS: How have the rest of you been posting? Passport hasn't been working much this week, so I've been unable to post. Is there a way to post without using passport? Please tell me if so :)
What types of configuration (XML configuration file, Environment variable, etc) do your packages use?|||This is a known issue when you edit the package "standalone",
i.e. without creating the SSIS project. A workaround is to create
the project, add the package to the project, and then edit
the configuration.

We plan to fix this issue for SP1 (it was reported too late to
consider changing this for RTM release).

Thanks,
Michael.|||(Sorry, I have to wade through a lot of script errors and bad passport certificate errors to be able to post to this forum.)
The configuration involved is an environment variable pointing at an XML config file.
The package is in a project in a solution.
However, the solution has two packages, one of which calls the other.
Because of the bug that Execute SSIS task cannot handle relative paths, we have to use a mapped drive to call the package, so the target package is called via a mapped drive fully qualified file path.
I've since discovered that the bug here is that if the package is opened from the mapped drive, even though it is the same file, the Package Configuration Wizard will give this mscorlib error. The workaround for this bug is to be careful and be sure to first close the package, then open it by double-clicking it in the solution, when you need to examine or edit package configurations.
Of course, I hope this bug gets fixed, but truly, it is not nearly as bad as the bug that relative paths get wrecked and fail in the Execute SSIS task.
|||I see - this indeed seems like a different bug.
Could you please open a bug on betaplace?|||re: bug on betaplace
I invested some time trying to get into betaplace, which involved waving my cursor around to find an invisible button I had to click, and then getting to a page which said I would be granted access at some point. I tried several times on successive days, but I never got further than that. I posted my travails several times to the newsgroup, but noone had any suggestions, so I finally gave it up as something that only costs me time, and brought no benefit to anyone (as I was never able to get to a point of actually accessing any information, much less posting new bugs).
Could you open the bug on betaplace? I have a suspicion that it probably works much better for people working at Microsoft :)
|||OK, I'll open a bug directly in our bug tracking system.|||Hi,
I know its probably to late for you (

Perry_Rapp )
but
for other who trying to find solution to the "The path is not of a legal form" problem here it is:

1. open a new project/solution
2. copy the old project\s to the new "solution folder"
3. add the old project\s to the new solution from the new "solution folder".
(right click on "solution" -> Add -> Existing Project... )

Note:
if you have virtual folders in your solution first add the old project\s to the new solution root and after saving .. create the virtual folders
sqlsql

Friday, February 10, 2012

Concatenating strings in a CTE

Hi,

I am trying to create a concatenation of strings in a CTE, to show a "breadcrumb" path for a parent-child hierarchy. I get the error message,

Msg 240, Level 16, State 1, Line 3

Types don't match between the anchor and the recursive part in column "path_name" of recursive query "pc_hier_cte1".

Here are some SQL statements to study the situation. The first CTE merely computes the length of the "breadcrumb" string -- and it works. In the second CTE I try to perform the string concatenation, and that's where I get the error message.

Thanks for your help with this.

Dan

drop table #temp

drop table #pc_hier

create table #pc_hier

(

id int,

parent_id int,

name varchar(100)

)

insert into #pc_hier

select 1, 0, 'top level node' union all

select 2, 1, 'second level node 2' union all

select 3, 1, 'second level node 3' union all

select 4, 1, 'second level node 4' union all

select 20, 2, 'third level node 20' union all

select 21, 2, 'third level node 21' union all

select 22, 2, 'third level node 22' union all

select 30, 3, 'third level node 30' union all

select 31, 3, 'third level node 31' union all

select 32, 3, 'third level node 32' union all

select 40, 4, 'third level node 40' union all

select 41, 4, 'third level node 41' union all

select 42, 4, 'third level node 42'

;

with pc_hier_cte (id, parent_id, name, dist_from_parent, path_length) AS

(

select

ph.id,

ph.parent_id,

ph.name,

0 as dist_from_parent,

0 as path_length -- do not include top-level parent name in the path string

from #pc_hier ph

left outer join #pc_hier ph1

on ph.parent_id = ph1.id

where ph1.id is null -- never a parent

union all

select

ph.id,

ph.parent_id,

ph.name,

dist_from_parent + 1,

(phc.path_length + len(' > ' + ph.name)) as path_length

from #pc_hier ph

inner join pc_hier_cte phc

on ph.parent_id = phc.id

)

select

id,

parent_id,

name,

dist_from_parent,

path_length

into #temp

from pc_hier_cte

order by 4, 3, 1, 2

OPTION (MAXRECURSION 10);

select *

from #temp

order by 4,3,1,2

;

-- Here is the part that does not work, where I am trying to concatenate strings.

drop table #temp1

with pc_hier_cte1 (id, parent_id, name, dist_from_parent, path_length, path_name) AS

(

select

ph.id,

ph.parent_id,

ph.name,

0 as dist_from_parent,

0 as path_length, -- do not include top-level parent name in the path string

'' as path_name

from #pc_hier ph

left outer join #pc_hier ph1

on ph.parent_id = ph1.id

where ph1.id is null -- never a parent

union all

select

ph.id,

ph.parent_id,

ph.name,

dist_from_parent + 1,

(phc.path_length + len(' > ' + ph.name)) as path_length,

(phc.path_name + ' > ' + ph.name) as path_name

from #pc_hier ph

inner join pc_hier_cte1 phc

on ph.parent_id = phc.id

)

select

id,

parent_id,

name,

dist_from_parent,

path_length,

path_name

into #temp1

from pc_hier_cte1

order by 4, 3, 1, 2

OPTION (MAXRECURSION 10);

Hmmmm, by reading a post from today I solved this problem: I just needed to use CAST to define the value as a large VARCHAR. (I thank Kent Waldrop My07 for his post.)

Here is the fix.

drop table #temp1

with pc_hier_cte1 (id, parent_id, name, dist_from_parent, path_length, path_name) AS

(

select

ph.id,

ph.parent_id,

ph.name,

0 as dist_from_parent,

0 as path_length, -- do not include top-level parent name in the path string

cast('' as varchar(1000)) as path_name

from #pc_hier ph

left outer join #pc_hier ph1

on ph.parent_id = ph1.id

where ph1.id is null -- never a parent

union all

select

ph.id,

ph.parent_id,

ph.name,

dist_from_parent + 1,

(phc.path_length + len(' > ' + ph.name)) as path_length,

cast((phc.path_name + ' > ' + ph.name) as varchar(1000)) as path_name

from #pc_hier ph

inner join pc_hier_cte1 phc

on ph.parent_id = phc.id

)

select

id,

parent_id,

name,

dist_from_parent,

path_length,

path_name

into #temp1

from pc_hier_cte1

order by 4, 3, 1, 2

OPTION (MAXRECURSION 10);

select *

from #temp1

order by 4,3,1,2

;