Selecting LOB using Database Link (OCI) in Postgres - oracle

I have a database link set up to connect to an Oracle 11gR2 database from a Postgres 9.1 server. This uses OCI for the connection.
However, when I try to select any CLOB data I receive the following error:
ERROR: OCI error: ORA-01406: fetched column value was truncated
Is there anything that can be changed in the OCI to allow this to work correctly?

I am noticing that a lot of db's have trouble connecting to text fields in PostgreSQL. Is there a reason it has to be CLOB? Can you wrap in a function that would read the whole field?
My guess is that Oracle uses a streaming interface for CLOBs similar to the LOB postgresql interface but without the escaping. As a result PostgreSQL isnt really sure what to do with the value when it comes over.

Related

HY010 Oracle ODBC Function sequence error in SSIS?

I created an SSIS package to copy data from one Oracle table to another Oracle table. Each table is in a different database.
I'm getting this error for every single column of the source table:
ERROR [HY010] [Oracle][ODBC]Function sequence error
This is the screenshot.
I have no idea what this means. I've also researched but I haven't seen anything that has helped me.
How can I fix this? I did read that an alternative is to create a linked server.
I wanted to add that the ODBC driver was created with a relatively recent Oracle 12 driver, so I'm not sure why VARCHAR2 columns would not be supported.
Also wanted to point out that the Windows server where the Oracle DB is 64-bit (Windows Server 2008) and Visual Studio 2008 (where the SSIS package is created) is 32-bit. That's why the driver has "_32" at the end.
Based on the following documentation:
The error occurs when ODBC functions are called out of the order required by the ODBC Specification.
The error can also occur if an ODBC function call returns an error and the application continues making ODBC calls that require the previous ODBC call to succeed.
I think you should check that all columns data types are supported by the ODBC driver.
Similar questions
MS-Oracle ODBC Driver Function Sequence Error
Update 1
You can refer to the following link to learn more about supported data types:
Oracle® Database Gateway for ODBC User's Guide - Data Type Conversion
Note that in the link above they mentioned that:
If a table contains a column whose data type is not supported by Oracle Database Gateway for ODBC, the column information is not returned to the Oracle database.

NVarchar2 fields inserted as blank/NULL while Importing data from SQL Server to Oracle over dblink

I'm currently importing data from a SQL Server database into an Oracle 11g one and I'm encountering some strange behavior when importing nvarchar2 columns. The charset on the SQL Server db is Unicode (UTF-8), while on Oracle's side it is not (WE8ISO8859P1).
Whenever i try to import SQL Server nvarchar2 values, Oracle inserts them as blank strings. Trying this on a different IDE, the show up as NULL. Whatever I do, the text is not imported.
I've had success using the dbms_hs_passthrough package, yet this seems overkill for such a simple insert/select task.
What am I missing?
Thanks in advance.
EDIT: If i perform a SELECT on the remote table I can see the text values just fine. CTAS also works as expected. I can only replicate the erroneous behavior when i run the package.
EDIT 2: I've narrowed this problem down to a possible bug in the MERGE statement in Oracle with data from SQL Server over DBLink. I solved this problem by performing separate INSERT/UPDATE DML statements.

Issue in WMB message broker insert to a Sybase Database Table

Currently am facing an issue while inserting data in to Sybase database 15.7 with WMB code flow. Am currently using WMB7 Broker and I have written code in our message flow which is trying to insert the data in the table directly rather than using store procedure. The data types used in database table is 'int' and 'Image'. But insert operation is not completing anyways.
Whereas the same message flow code is inserting the data in Database table which is on Sybase 12.5.
Can this be a compatibility issue of ODBC drivers which are present in WMB7?
Any kind of direction would be great help
It could definitely be a driver issue, in the SOE Sybase 15.7 is only listed as supported from 7.0.0.6 onwards:
http://publib.boulder.ibm.com/infocenter/prodguid/v1r0/clarity-reports/report/html/softwareReqsForProduct?deliverableId=1106652668319&osPlatform=AIX#sw-Databases
Are you running on this version?
Actually for resolving this issue we have changed the datatype from Image to varbinary in Database Table. And all started working in order

How to retrieve Oracle server collation in order to set up linked server

After searching here and on the web, I finally decided to post the question. I am running an SQL 2000 server, and linked an Oracle 9i server. Everything works fine when I run queries, and even updates and inserts from and to the Oracle Linked server (using both Microsoft OLE DB driver and Oracle OLE DB driver) using the OPENQUERY approach.
The problem is that, in order to clean code a bit, I want to use four part names in my queries. I am doing this also when querying other SQL linked servers.
But when I run the queries against Oracle using four part names I get this error: ( I am translating the error message from spanish. Probably the original message in english id different)
ERROR: OLE DB 'MSDAORA' returned an invalid column definition.
Error Code: 7318
Digging a bit, I learned that this is probably related to nos having the right collation name set in the linked server properties.
Now... I am not an Oracle expert, so I need to find out what collation is the schema I connect to using in Oracle (apps... yes, I know, I know... )
So, the plain question is... How do I find out what collation Oracle is using? I have access to the Oracle server via Toad... is there any query I can run in order to find this out?
Thanks!
I think you're looking for the NLS settings, which you can find from these views:
V$NLS_PARAMETERS — "Current values"
NLS_DATABASE_PARAMETERS — What the database was created with.
NLS_INSTANCE_PARAMETERS — From changes by ALTER SYSTEM
NLS_SESSION_PARAMETERS — Combined, plus ALTER SESSION
V$PARAMETER — System parameters, where a lot of this is changed (contains all kinds of stuff)
The documentation is rather lacking here (or, quite likely, I couldn't find the right document), but this should get you what you want.
You will probably have to log in as SYSDBA to read some of these views.

What causes a JDBC Type 91 error?

I have a web app hosted on BEA Weblogic 10.x with an Oracle 10g database backend.
It works perfectly with one database, but when we make a clone of it and try to use a different WebLogic and Oracle instance we are getting this error:
ERROR - Problem initializing invocation tracking - disabling
tracking xxxxclass.BadTableMappingException: Database column
xxxxPeriodEnding in database yyyyyyy, table zzzzzzz has an
unknown type: JDBC Type 91.
We get it every time we do a query that involves a column of type DATE. There was no ORA-XXXX code in the message.
I can access the database using SQL*Plus using the same access and do selects and updates on the same tables with no errors.
The answer to this question is not just a simple description of what a type 91 error is (although that will help) but what could be causing this given the circumstances described above.
I am using ojdbc14.jar for JDBC on both instances of weblogic.
I have no idea about the error, but have you considered the jdbc jar version and more importantly if the oracle DB needs to be updated.
I faced very weird problems with oracle, and struggled for a while to find at the end that installing some patches for oracle would solve the problem.
Set oracle.jdbc.V8Compatible=true.
This remaps the oracle DATE type to a DATETIME time in JDBC. This parameter was missing on the new Weblogic server.

Resources