Getting a "Not a recognized ODBC scalar function option" error while trying to perform an OUTER JOIN on Source Qualifier transformation using User Defined Join property? Make sure you're not running the process with auto-generated SQL Query Override after using the {} (curly braces) syntax in User Defined Join :)
Worth reading:
Outer joins in MS SQL
Execution of ODBC Extensions to SQL
Friday, December 2, 2016
Thursday, June 9, 2016
MS SQL Server - Exception vs RaiseError
Below is just an observation that needs further investigation.
It appears that while using ODBC to connect to MS SQL Server there's a difference between RAISERROR and an occurence of an exception.
Performing a SELECT 1/0 within a stored procedure called as Post-SQL query results in an error like:
Database driver error...
...
FnName: Execute Direct -- [Informatica][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Divide by zero error encountered.]
Now, this is perfectly fine. An error occured, the session has failed. But what if we need to store some audit information in a log table in case of error in stored procedure? It's possible with TRY...CATCH. Whenever an error occurs, the CATCH block is executed. We can log the information and do a RAISERROR afterwards to fail the session.
But the session never fails. There's no track of RAISERROR in session log, the session completes successfully.
UPDATE:
The issue is caused with returning any dataset. Any print statement or result set seems to cover the error. Even the information about number of affected rows. Hence, the solution is to:
It appears that while using ODBC to connect to MS SQL Server there's a difference between RAISERROR and an occurence of an exception.
Performing a SELECT 1/0 within a stored procedure called as Post-SQL query results in an error like:
Database driver error...
...
FnName: Execute Direct -- [Informatica][ODBC SQL Server Wire Protocol driver][Microsoft SQL Server]Divide by zero error encountered.]
Now, this is perfectly fine. An error occured, the session has failed. But what if we need to store some audit information in a log table in case of error in stored procedure? It's possible with TRY...CATCH. Whenever an error occurs, the CATCH block is executed. We can log the information and do a RAISERROR afterwards to fail the session.
But the session never fails. There's no track of RAISERROR in session log, the session completes successfully.
UPDATE:
The issue is caused with returning any dataset. Any print statement or result set seems to cover the error. Even the information about number of affected rows. Hence, the solution is to:
- remove any SELECT / PRINT statements from within the Stored Procedure
- suppressing the information about affected rows by using the SET NOCOUNT ON
Friday, June 3, 2016
The mapping is potentially unsafe and cannot be imported.
So, you got this error while trying to import your mapping to Powercenter:
What is wrong and how can it be fixed? What's the root cause? Hard to tell - the error message does not explain a lot.
The Cause
Most likely the XML file has been altered outside Powercenter. It's quite common to export and to some edits in XML before importing. Some renaming, replacing some paths or parameters. However some transformations or mappings have this
The Solution
While importing the XML try to use the "-s" option. It can't be found in the Informatica Command Reference (at least in all versions I've tried) but it seems to work. Instead of the usual command:
pmrep objectimport -i /pathtoyourxmlfile/m_your_mapping.xml -c controlFile.txt - l output.log
try using
pmrep objectimport -s -i /pathtoyourxmlfile/m_your_mapping.xml -c controlFile.txt - l output.log
Remarks
This worked in my case. And I have no idea what the "-s" stands for and what actually happens here...
The mapping m_your_mapping is potentially unsafe and cannot be imported.
What is wrong and how can it be fixed? What's the root cause? Hard to tell - the error message does not explain a lot.
The Cause
Most likely the XML file has been altered outside Powercenter. It's quite common to export and to some edits in XML before importing. Some renaming, replacing some paths or parameters. However some transformations or mappings have this
CRCVALUE="123123123"
property. If the XML file has been altered, it's very much possible the CRC is no longer correct.The Solution
While importing the XML try to use the "-s" option. It can't be found in the Informatica Command Reference (at least in all versions I've tried) but it seems to work. Instead of the usual command:
pmrep objectimport -i /pathtoyourxmlfile/m_your_mapping.xml -c controlFile.txt - l output.log
try using
pmrep objectimport -s -i /pathtoyourxmlfile/m_your_mapping.xml -c controlFile.txt - l output.log
Remarks
This worked in my case. And I have no idea what the "-s" stands for and what actually happens here...
Tuesday, April 21, 2015
Hash in output header
When using Output Field Names as Header for a Flat File target, a hash symbol [#] is put as the first one in header.
And the result in the file looks like this:
To get rid of the hash sign, the following custom property has to be set:
And the result in the file looks like this:
To get rid of the hash sign, the following custom property has to be set:
Tuesday, September 2, 2014
MS SQL Server: Stored Procedure error not failing parent Workflow
Stored Procedure error not failing parent Workflow
There's an issue I'm investigating: I have a workflow with a stored procedure executed as a post-load. It fails without failing the parent workflow. I've decided to come up with a simple test that would narrow down the cause.
Stored procedure
Here's the stored procedure I'll use for testing:CREATE PROCEDURE RaiseErrorTest AS
BEGIN
--PRINT 'started'
--SELECT 1
IF 1=1
BEGIN
RAISERROR ('The servers are busy at this time. Please try again later', 16, 1)
RETURN 1
END
PRINT 'Completed'
SELECT 2
END
All it does is perform the RAISERROR that should fail the whole process. There are also two disabled statements - we'll get to those later.
Workflow
I've created a simple workflow that executes SELECT 1 on source and uses a FALSE filter, so nothing gets written to target. It also includes a Post-load stored procedure call to the above SP:Test 1: Native connector, disabled statements before raising error
Ok, lets start it and see what happens:Great, session has failed as expected raising the defied error. The workflow has failed.
Test 2: Native connector, enabled statements before raising error
Now, let's enable the two statements back:ALTER PROCEDURE RaiseErrorTest AS
BEGIN
PRINT 'started'
SELECT 1
IF 1=1
BEGIN
RAISERROR ('The servers are busy at this time. Please try again later', 16, 1)
RETURN 1
END
PRINT 'Completed'
SELECT 2
END
Test 3: ODBC, disabled statements before raising error
Let's revert the stored procedure to have disabled lines 3 & 4 and try the ODBC connection:
Test 4: ODBC, enabled statements before raising error
Now for the final test: using ODBC connection for the stored procedure that runs some statements before raising error:
Session (and worflow) executed successfully! Great, right? Well, not quite... The stored procedure fails but this is not escalated to PowerCenter.
Conclusion
While this is handled correctly by Native SQL Server connector, any first result set returned by the stored procedure fools the ODBC into treating this a successful execution. Whatever happens later on is discarded and you may never know your stored procedure failed.
Unfortunatelly I have no idea how to overcome this issue.
Wednesday, May 7, 2014
Repository cleanup
The Idea
Inpired by a post on Stackoverflow I've decided to come up with some solution to find unused objects in PowerCenter Repository.So, the idea is to find all unused objects in Repository, like for example sources and targets not used by any mapping or mappings not used by any session or sessions that do not exist in any workflows. Doing that manually would require a lot of work and even more time. Doing it using Reository Queries is highly complex - if feasible at all.
Therefore I've created a simple app that uses pmrep tool to find all objects and check their dependencies. It is still time consuming, but once configured requires no manual effort at all.
Download link is available at the bottom.
Setup
All you need to do to run the tool after downloading is edit the config file. The properties are quite simple
#Common parameters[Common]infaDir = C:\Informatica\9.0.1Repository = RepositoryName#Specify Domain OR Host and Port. By default Domain will be used if specified.Domain = Domain_NameHost = your.hostPort = 6005Folder = InformaticaFolderNameUser = UserName#User security domain. By default Native is used.UserSecurityDomain =#Object list - sample below#objectTypeList = mapplet, mapping, session, source, target, workletobjectTypeList = mapplet, mapping, session, source, target, worklet
The last one - objectTypeList - can contain any number of object types that should be checked.
Please keep in mind that looking for all possible object types might be really time consuming!
Running
Once set up, you just need to run the executable. It will prompt for repository password (note: the password is not stored anywhere and must therefore be provided on each run).
During runtime the progress is indicated by listing all steps and the number of objects of each type. Here's a sample:
Finally you'll find a folder named UnusedObjectsReport with the output:
- ListOfUnusedObjects.txt - file containing list of all the unused objects found in the repository
- DeleteUnusedObjects.bat - prepared batch to remove all the unused objects. For safety reasons all the lines in the batch are commended with 'rem ' prefix. You should review and choose which objects to remove. Once executed, all the objects should be removed. Note: this works only with unversioned repositories.
In addition there will be two files per each object type defined in the list, e.g.:
- mapping.txt - list of all the mappings found in the repository
- mapping_dep - list of all dependencies found for each mapping
But these are just temporary files not intended for any further use. Feel free to inspect them if you like.
The tool requires no installation - simply download, unzip, setup and run.
It can be downloaded from the following download page.
Thursday, January 30, 2014
Numeric identity ODBC error
Using Numeric Identity for MS SQL Server target causes ODBC error when trying to update rows.
While running the session you might get an error as follows:
FATAL ERROR : An unexpected condition occured in file [/export/home/builds/pc8x_root/910HF/build/powrmart/common/odl/msodbc/odbcdriver.cpp] line [495].
This reads: I'm sorry, but loading data via ODBC to Numeric Identity port type for MS SQL Server target port is not supported. Please disconnect the port.
Here is a sample mapping causing the error:
All you need to do is disconnect the port or change it's type.
While running the session you might get an error as follows:
FATAL ERROR : An unexpected condition occured in file [/export/home/builds/pc8x_root/910HF/build/powrmart/common/odl/msodbc/odbcdriver.cpp] line [495].
This reads: I'm sorry, but loading data via ODBC to Numeric Identity port type for MS SQL Server target port is not supported. Please disconnect the port.
Here is a sample mapping causing the error:
All you need to do is disconnect the port or change it's type.
Subscribe to:
Posts (Atom)










