I have successfully connected to a DB2 database from Oracle SQL Developer 19.4.0.354 using the DB2 ODBC driver.
SQl scripts work just fine.
Now I also want to execute PL/SQL scripts but simple sample script fails.:
set serveroutput on
DECLARE
message varchar2(20):= 'Hello, World!';
BEGIN
dbms_output.put_line(message);
END;
It fails in such a way that PL/SQL code does not seem to be accepted at all:
DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=DECLARE
message varchar2(20):= 'Hell;BEGIN-OF-STATEMENT;<create_view>, DRIVER=4.26.14
Is PL/SQL generally supported in this setup?
When using the Oracle-compatibility mode of Db2-LUW, it is necessary to:
set the Db2-registry-variable DB2_COMPATIBILITY=ORA with the db2set command.
bounce the Db2-instance with the db2stop and db2start commands, so the registry variable becomes effective.
create a new database after both of the above steps are completed (using the db2 create database command ), so that Oracle specific datatypes and other features become available.
If you only change the registry variable and bounce the Db2-instance but use a pre-existing database then you will not get all of the implemented Oracle compatibility features! This is documented in the Db2-Knowledge-Centre online.
With currently shipping Db2-LUW versions, you cannot retrofit the Oracle compatibility on to a previously created database.
Related
A user has been configured on Oracle. Via this user, I can create an ODBC connection and an OCI connection, and these both test fine in Win10. Using Alteryx with the ODBC and OCI connection, we try to write data to a new table.
The table is created and appears in PL/SQL with the expected column names. However, the rows are never written and the connection just hangs at this point.
What could be wrong? I am not an Oracle Admin
Based on comments you were expecting oracle to commit without executing "commit" command explicitly. It's not enabled by default in oracle so you have to turn it on.
It's not possible to turn this on for the database, but on client apps only.
E.g. "set autocommit on" command in SQL Plus.
So you need to check docs for the client application you're connected with (presumably Alteryx is the one). It might have such a feature.
Running this, I see no output other than 'completed'
set serveroutput on
declare
message varchar2(20) := 'Hello, World';
begin
dbms_output.put_line(message);
end;
/
I have seen this behavior before, and it's always because your database is too old.
Are you using something older than 11gR2 on the database? If so, our newer jdbc drivers no longer support DMBS_OUTPUT polling on 9i and 10g of the Database.
Your options are:
find an older copy of SQL Developer, which uses an older JDBC driver or
Upgrade your database to something from this decade (19c would be best)
Obviously option 1 is the easiest and option 2 is the most desirable.
BIDS 8.0
oracle 11.g client is installed. the original server was 11g and it worked. we upgraded the server to oracle 12c. all ole db update commands will not work. There is no error from the output, just the table data not updated. any ideas?
Try this
CREATE Procedure and sen parameters to it, and handle the Update operation in Procedure
Do not forget use commit end of the dml statament
I have a GIS oracle database and I am needing to reference in a SSIS dataflow task. Ideally I would normally do something like this (which works perfectly in Oracle SQL Developer):
execute sde.version_util.set_current_version('SAFE.mvedits')
SELECT CAD_EVENTID
FROM SAFE.INCIDENT_POINT_MV
however when I try to use that as the SQL command of my OLE DB Datasource it throws me an "Invalid SQL" error.
How do I set the SDE version in a SSIS dataflow task data source?
Knowing nothing of nothing on Oracle, what you might try is
In your Oracle Connection Manager, change the property RetainSameConnection to True. This means that all connections will Oracle will use the same thread.
Add an Execute SQL Task before your Data Flow that talks to Oracle. Use your query there to modify the current version thing. This setting should be persisted on the connection.
In your OLE DB Datasource, start with the SELECT statement.
You might need to set DelayValidation to true as well.
If that's not working, let me know and I'll see if I can come up with anything else.
As it turns out this is a shortfall of interacting with GIS Oracle databases through thirdparty applications. In my situation we addressed it by just bundling the change up in a stored procedure that lives on the oracle server and invoking that stored procedure from inside SSIS.
I am trying to recreate an oracle database in an HSQL database.
this is to enable better unit testing on the local developer systems.
What I need to know is is there anything tool/command I can use in the oracle server/client, that can provide me all the DDL commands for all the objects (tables, synonyms, views etc) in the oracle database.
I am planning to go through the created DDL commands and try to convert these commands into HSQL compatible commands.
Is it possible?
Any suggestions will be welcome.
system information:
Oracle DB: Oracle enterprise server 11g R2.
HSQL DB: hsql 2.2.9
You can use the DBMS_METADATA package along with the data dictionary to generate the DDL for your objects. For example, to generate the DDL for every table in a schema
declare
l_ddl clob;
begin
for t in (select * from user_tables)
loop
l_ddl := dbms_metadata.get_ddl( 'TABLE', t.table_name, USER );
<<do something with l_ddl>>
end loop;
end;
Are you sure that it makes sense to test with a completely different database than what you're really going to deploy to? Even if you translate the DDL to the closest analogue, it seems very likely that you'll get different results for some tests depending on the database you're connected to. Are you sure that you can't install Oracle (potentially Oracle XE if your concerns are primarily about licensing) on the developer's machines?
There are quite a few products that can help.
OpenSource:
http://www.liquibase.org/manual/formatted_sql_changelogs
Commercial with free trial:
http://www.devart.com/dbforge/oracle/schemacompare/new-export-oracle-schema.html
If you use a tool that is generally designed for use with Oracle databases only, you may get quite a lot of non-standard Oracle DDL that needs converting. A cross platform tool is more likely to reduce the work.
When HSQLDB is used in the ORA compatibility mode, it can translate some Oracle types in the DDL to a similar SQL Standard type. So the types may not pose a problem.
One open source inactive project do exact same thing.
http://schemamule.sourceforge.net/index.html