SSIS For Loop ODBC - oracle

I’m extracting data from a table in Oracle.
I have an ODBC connection manager to the Oracle database and the query for extraction should include a where clause because the table contain transactional data and there is no reason to extract it all every time.
I want initialize the table once and do it in with a For Loop which will iterate the whole table.
Since it’s an ODBC connection I can’t just put a where clause because I need to use a variable hence I realized I need to parameterize the DataFlow task and write my query at the sqlcommand property containing the ODBC source.
The property value is:
SELECT *
FROM DDC.DDC_SALES_TBL
WHERE trunc(CALDAY) between to_date('"+ #[User::vstart]+"','MM/DD/YYYY')
and to_date('"+ #[User::vstop]+"','MM/DD/YYYY')
Where the #vstart and #vstop are variables containing the ‘from/to’ dates to be extracted based on a DATEADD function and another variable (#vcount) which supposed to be the iterator as follows:
(DT_WSTR, 2) MONTH( DATEADD( "day", #[User::vcount] , GETDATE() ) )+"/"+
(DT_WSTR, 2) DAY( DATEADD( "day", #[User::vcount] , GETDATE() ) )+"/"+
(DT_WSTR, 4) YEAR( DATEADD( "day", #[User::vcount] , GETDATE() ) )
What’s happening is that the first iteration works fine but the second one generates an error and the package fails.
I marked the variable as EvaluateAsExpression=True
I also marked the DelayValidation=True in both the For Loop and the DataFlow tasks.
The errors are:
(1)Data Flow Task:Error: SQLSTATE: HY010, Message: [Microsoft][ODBC Driver Manager] Function sequence error;
(2) Data Flow Task:Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "ODBC Source.Outputs[ODBC Source Output]" failed because error code 0xC020F450 occurred, and the error row disposition on "ODBC Source" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
(3) Data Flow Task:Error: SSIS Error Code DTS_E_PRIMEOUTPUTFAILED. The PrimeOutput method on ODBC Source returned error code 0xC0209029. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing. There may be error messages posted before this with more information about the failure.
Please assist.

I don't know why initially i didn't use OLEDB, as I thought it doesn't work.
What i tried was to use create an OLEDB via oracle driver and the connection manager worked so i used it.
As this way you can parameterize the source directly and the loop worked just fine.
Don't know what cause the conflict with the OBDC source but that's my workaround.
I didn't find a way to setup the sqlcommand property in ODBC source and using it in a loop which should change the the command every iteration. It crashed after the first iteration ni matter what i tried.
Thanks,

I was having the same issue when using Oracle Source, updating the Attunity Connectors for Oracle as well as the OLEDB driver for SQL Server worked to fix the problem.

Related

Error in SQL statement Arithmetic operation resulted in an overflow

I am trying to connect ODBC 64bit Driver to allow me execute query to extract data from JDE 8.12
After building open SQL Connection and execute simple query it appear an error "Error in SQL statement Arithmetic operation resulted in an overflow."
Could you please advise what is missing in order to allow the query to be execute?
Steps which I did:
1 - I selected Microsot OLE DB Provider for ODBC Driver
2- Selected Driver (Driver - Oracle in OraClient 11g64_home1)
3 -Test The connection and show successful
4 - Build simple query to test the Flow
5- After run the Flow I get error
"Error in SQL statement Arithmetic operation resulted in an overflow."
After successful connection , I was expecting simple query to be executed without issue.
It is possible that your Orale client is 32-bit only and the application using it is not x86 compiled.
Also, it's possible that you have a numeric field of certain limitation and a value is being computed arithmetically and then attempted to be stored into the field, overflowing its bounds.

SQLSTATE HY104; INVALID PRECISION VALUE. ERROR IN PARAMETER

I am using SSIS for ETL. Source and destination databases are Oracle.
When I run job through SQL agent its prompts me with the following error:
This table contains 5 date columns which are creating this issue.
I have tried all possible solution but it didn't work. It does not seems data issue as I rerun job on those selective dates which worked perfectly. On full load it failed.
The bottom error message is:
Data Flow: Task:Error: SQLSTATE 22007, Message: [Microsoft][ODBC Oracle Wire Protocol driver]Invalid datetime format. Error in parameter 17.
You have an Invalid datetime format. You need to fix it by correcting either the data or the format model you are using but, since you haven't included any code, we can't help further.
I have a similar issue, the difference is my source is the SQL Server database and the destination is Oracle database.
I converted the source DateTime columns to type String first and then they were loaded to destination date columns successfully.

"The statement did not return a result set" on Create table (JDBC) [duplicate]

My original environment is SQL server 2005 + WebSphere v6.0(JDBC 3.0). When I run the program as below and it works well.
ResultSet rs=stmt.executeQuery(sql);
rs.next();
However, when I upgrade the environment to SQL server 2005 + WebSphere v8.5(JDBC 4.0), I get the error message:
com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not
return a result set.
From this forum's information, it seems that I have multiple resultsets, so I try to change the program as follows and it works fine.
stmt.execute(sql);
stmt.getMoreResults();
stmt.getMoreResults();
ResultSet rs=stmt.getResultSet();
rs.next();
My questions is that is there any approach that I can keep my program unchanged and works well with JDBC 4.0 driver(WAS v8.5) or any combination like SQL svr 2000 + WAS v8.5, etc.
Please give me any pointer and your recommendation is valuable to me, thank you.
Ann
You are attempting to execute a query that either produces multiple resultsets or that does not produce a resultset (eg UPDATE, INSERT etc) using executeQuery. The Javadoc for this method explicitly says:
Throws: SQLException - if a database access error occurs, this method is called on a closed Statement, the given SQL statement produces anything other than a single ResultSet object
You either need to use the executeUpdate method (if it is actually an update/insert/delete, or execute and then use the resulting boolean and that of getMoreResults() to decide how to proceed.

Oracle destination in SSIS data flow is failing with Error- ORA-01405: fetched column value is NULL

I have one SSIS package in which there is one DFT. In DFT, I have one Oracle source and one Oracle destination.
In Oracle destination I am using Data Access Mode as 'Table Name - Fast Load (Using Direct Path)'
There is one strange issue with that. It is failing with the following error
[Dest 1 [251]] Error: Fast Load error encountered during
PreLoad or Setup phase. Class: OCI_ERROR Status: -1 Code: 0 Note:
At: ORAOPRdrpthEngine.c:735 Text: ORA-00604: error occurred at
recursive SQL level 1 ORA-01405: fetched column value is NULL
I thought it is due to NULL values in source but there is no NOT NULL constraint in the destination table, so it should not be an issue. And to add into this, the package is working fine in case of 'Normal Load' but 'Fast Load'.
I have tried using NVL in case of NULL values from source but still no luck.
I have also recreated the DFT with these connections but that too in vain.
Can some one please help me with this?
It worked fine after recreating the oracle table with the same script

NHibernate Transaction fails with Insert and Update on Oracle

Post Update: I have tracked down the problem at the command "ExecuteNonQuery". That's the one that fails during an update or hangs during an insert. Trying a simple example using plain ADO.NET and their transactions works perfect. Also... it works great on my local home computer connection an Oracle Express edition. Pointing it again in some kind of server config??
It would be nice to step into the NHibernate code while debuging, but so far I'm still not able to set this up, even if I have rebuild the source and use those dll and pdb files. Was anyone able to do this before?
I've been scratching my head on this for a while now. I've been developing with NHibernate and an Oracle 10g database for a few days now, so far only using select statements which are all working great with the mapping.
I now started to implement my first insert (save) and update statements, but the tests all fail.
They all fail on the transaction.commit() part.
When performing an INSERT (Save), the code reaches transaction.commit(), but then got "stucked". The test keeps on running without moving forward.
This is the output of the test (note that the test keeps running)
NHibernate: select hibernate_sequence.nextval from dual
NHibernate: INSERT INTO MOB_PL_MAPPING_TEST (DES, TEST_ID) VALUES (:p0, :p1);:p0 = 'This is a test!', :p1 = 161
When performing an UPDATE, the transaction.commit() fails and I receive following error stack:
NHibernate: SELECT test0_.TEST_ID as TEST1_10_0_, test0_.DES as DES10_0_ FROM MOB_PL_MAPPING_TEST test0_ WHERE test0_.TEST_ID=:p0;:p0 = 61
NHibernate: UPDATE MOB_PL_MAPPING_TEST SET DES = :p0 WHERE TEST_ID = :p1;:p0 = 'Changed!', :p1 = 61
TestCase 'Data.Tests.Test_Update_on_Test_Table'
failed: NHibernate.TransactionException : Rollback failed with SQL Exception
----> System.InvalidOperationException : This OracleTransaction has completed; it is no longer usable.
c:\CSharp\NH\nhibernate\src\NHibernate\Transaction\AdoTransaction.cs(260,0): at NHibernate.Transaction.AdoTransaction.Rollback()
E:\SubVersion\Application\Src\Data\UnitOfWork\Data.UnitOfWork\GenericTransaction.cs(26,0): at Data.UOW.GenericTransaction.Rollback()
E:\SubVersion\Application\Src\Data\UnitOfWork\Data.UnitOfWork\UnitOfWorkImplementor.cs(49,0): at Data.UOW.UnitOfWorkImplementor.TransactionFlush(IsolationLevel isolationLevel)
E:\SubVersion\Application\Src\Data\UnitOfWork\Data.UnitOfWork\UnitOfWorkImplementor.cs(36,0): at Data.UOW.UnitOfWorkImplementor.TransactionFlush()
E:\SubVersion\Application\Src\Data\Data.Tests\Repositories\LoyaltyRepositoryTests.cs(159,0): at Data.Tests.Test_Update_on_Test_Table()
--InvalidOperationException
at System.Data.OracleClient.OracleTransaction.AssertNotCompleted()
at System.Data.OracleClient.OracleTransaction.Rollback()
c:\CSharp\NH\nhibernate\src\NHibernate\Transaction\AdoTransaction.cs(246,0): at NHibernate.Transaction.AdoTransaction.Rollback()
I must say I'm unknown to oracle, but it seems that establishing the transaction causes the problem. Though the same code (using transactions) for a select statement (GET) works fine.
Could this be an oracle config problem (blocking insert/update transactions) or do I have to configure something else at application level?
Can anybody help me out here or shed more light on the problem that may occure?
Thanks in advance.
After managing to hook up the NHibernate code to my debuger, I was able to step through the code up to the point where the Command object is executed.
There, the problem was to be found in the parameter types. Parameters that where a string had the type set to "String", where they where suposed to be "AnsiString".
Turned out, I already ran into this article when I was mapping a string to an id
http://www.jameskovacs.com/blog/NHibernateAndTheCaseOfTheCrappyOracleErrorMessage.aspx
but didn't thought more of it.
Either way, adding the type to each string property in the mapping resolved the problem.
<property name="Description" column="DES" type="AnsiString" />
A hectic 3 days... but it's solved :D

Resources