How query data in pl/sql via ODBC from DB2 on AS400

Hi,
What's the most easy way to do some selects on tables in an external (non-oracle)database via odbc?
I only need selects, no dml-statements like inserts en updates...
Where can I find more information about this subject?
Filip

You need to use Oracle Heterogeneous Services. Firstly you have to obtain and configure DB2 ODBC drivers. I got mine from ibm.com (not free) but I am sure there are some third party vendors out there. I don't know much about DB2 so I can't help you with the configuration (I asked a DB2 DBA to help me with that part).
The rest is just setting up Oracle HS and creating the DB link. The following steps should help but there are much more detailed manuals for Oracle HS on http://tahiti.oracle.com.
Listener Configuration
Add the following entry into the SID_LIST part of the listener. The SID_NAME will be used in the heterogeneous services configuration
(SID_DESC=
(SID_NAME=db2)
(ORACLE_HOME=D:\oracle\ora92)
(PROGRAM=hsodbc)
Restart the listener.
Heterogeneous Service Configuration
Under ORACLE_HOME\HS\admin create the following text file called initDB2.ora (the DB2 part should match the SID_NAME used in the listener configuration).
Put the following line in the text file (the DQ01 is the name of the DB2 ODBC System DSN):
HS_FDS_CONNECT_INFO=DQ01
Client Configuration
The client side refers to an Oracle database that will use the heterogeneous gateway.
TNSNames Entry
Put the following entry in the tnsnames.ora file (the SID part should match the SID_NAME in the listener configuration):
DB2.telkom.co.za =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=cntrra20-esdt00)(PORT=1521))
(CONNECT_DATA=(SID=db2))
(HS=OK)
Database Link
Create a database link that references the new tnsnames.ora entry:
create public database link db2
connect to oratst identified by oracle using 'db2';
Test the database link.

Similar Messages

  • Querying Data w PL/SQL - selecting 1 row

    Initial research done at:
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm#i45320
    Querying Data with PL/SQL - Selecting At Most One Row: SELECT INTO Statement
    I am trying to run a simple SELECT COUNT statement in PL/SQL. Can someone please help me with the syntax? Here is my SQL select count(*) statement.
    SELECT ITEM_TYPE, count(*)
    FROM
    APPLSYS.WF_ITEMS
    WHERE
    ITEM_TYPE = 'GLBATCH' AND
    END_DATE is not null
    GROUP BY ITEM_TYPE;
    Thanks, I tried following some examples found on these forum threads but couldn't seem to find one for something so basic as this.

    I am trying to run a simple SELECT COUNT statement in PL/SQL. Can someone please help me with the syntax?in plsql you would declare variables to hold the selected values:
    declare
       l_item_type   applsys.wf_items.item_type%type;
       l_cnt         integer;
    begin
         select   item_type, count ( * )
           into   l_item_type, l_cnt
           from   applsys.wf_items
          where   item_type = 'GLBATCH' and end_date is not null
       group by   item_type;
       dbms_output.put_line ('Item_type: ' || l_item_type);
       dbms_output.put_line ('Count: ' || l_cnt);
    end;

  • How Can I Run a SQL Loader Job from Schedular

    How Can I Run a SQL Loader Job from Schedular , So that It Runs every Day.

    Depends on a couple of factors.
    If you are on a UNIX platform, you can create a shell script and schedule it with cron.
    If you are on a Windows platform, you can create a batch file and schedule it with the Windows scheduler.
    Or, if you are on Oracle 9i or 10g, you could use the external table feature instead of SQL*Loader. Then you could write a stored procedure to process the external table and schedule it using the Oracle scheduler (DBMS_JOB). This would probably be my preference.

  • How to parse BEX Query data to Flex interface via XML

    Hi,
    How can we pass the Bex Query data in XML tabular format so it can be consumed by a Flex interface?
    And communicate back and forth.
    Regards
    Vivek

    Hi,
    May be this link is helpful to you,
    http://help.sap.com/saphelpnw04/helpdata/en/d9/ed8c3c59021315e10000000a114084/frameset.htm_
    All the Best,
    Madhu....

  • Problem remote connection to SQL via ODBC

    Hello, I have a server machine on which I installed the "SQL Server 2008 R2 Express." On the same machine I have configured a connection to the SQL server via ODBC and I developed a VI that uses the "LABSQL ADO function" and it perfectly communicates via ODBC with the database.
    The problem is when I try to connect to the database from a remote PC. Even on the remote PC I configured the connection via ODBC. I launch the same VI I described above, it performs correctly the ADO Connection Open the ADO connection, but the SQL Execute returned an unknown error: -2147217865. It seems that it can not find the table on which I am doing the query.
    Does anyone have any idea? I have no experience with databases and do not know what tests to do.
    Thanks a lot.

    Hi,
    actually the Microsoft error code seems to be related to not-existing table (see here).
    Anyway, this error code may result when trying to use tables with spaces or other special characters ("-", "/", "\", "?" ) in their names.
    Is this true also in the database you are using?
    Could it be an issue with permission levels?
    I hope it helps!
    Bye,
    Licia

  • How to create a .mdf SQL Server database from a Data-Tier Application file that has data?

    This is a noob question, though I do use SQL Server databases all the time with Entity Framework when I code in C# using Visual Studio 2013.  The development environment is found below at [A].  I am trying to make a clone of a SQL Server 2008 R2
    database (.mdf)  that exists online.  I can read, connect and work with this database in Visual Studio 2013, but I wish to make a local copy of the database, as an .MDF file.  Somewhere in my notes I have a way of creating a local copy from
    an online database when using Visual Studio but I forgot how (it seems, reviewing my notes, that it deals with ADO.NET which is deprecated in Visual Studio 2013 these days, or so it seems).  So I'm looking for another way.  What I did was create
    (or export) a "Data-Tier Application File" from the online SQL Server database, with data, and it seems to have worked in that this Data-Tier Application file exists on my hard drive and seems to have data in it ("SQL Server Replication Snapshot"
    is the format it seems).  It contains skeleton code to create a database, but when I tried to execute it with SQL Server 2014 Management Studio, I got a bunch of errors.
    So my question is:
    1) Can I somehow create a .MDF SQL Server Database from an Data-Tier Application file that has data?  What tool do I use?  I saw this link, http://social.technet.microsoft.com/wiki/contents/articles/2639.how-to-use-data-tier-application-import-and-export-with-a-windows-azure-sql-database.aspx 
    and it relates to Azure, but is there a tool for C#Visual Studio 2013, standalone?
    2) If there's an easy way to create a .mdf SQL Server Database file from an online file, within SQL Server Management Studio?  I don't think so, since it would require Administrator permissions on the online server, which I don't have. I have permission
    to read, update, delete the online database file, but strangely not to download it (the service I use has a tool for backup, but not for download).
    3) same question as 2), but for Visual Studio 2013?  I don't think so, since I notice none of the templates even mentions ADO.NET anymore, but instead they go with Entity Framework.  Using EF I can of course do anything I want with the online database
    (CRUD), but it remains online.  Maybe there's a switch to make a local copy?  I guess I could write a short program to suck all the data out of the online database and put it into a new, duplicate database having the same tables, that I create on
    my localhost, but my question here is if there's an easier way than this, maybe a tool or command I can run from inside Visual Studio?
    Any advice on any of the above questions is appreciated.
    Thank you,
    Paul
    [A] Microsoft Visual Studio Professional 2013
    Version 12.0.21005.1 REL
    Microsoft .NET Framework
    Version 4.5.51641
    Microsoft Web Developer Tools 2013   2.0.40926.0
    SQL Server Data Tools   12.0.30919.1
    Microsoft SQL Server Data Tools
    Windows Azure Mobile Services Tools   1.0
    Windows Azure Mobile Services Tools

    Thanks but these links are too general to help.
    "2. what do you mean by online file?" - I mean the SQL Server database file is on a remote web server that I rent from, but I am not the administrator of.  I can access my database using SQL Server Authentication, but nothing more.
    Paul
    What do you mean by too general? It explains on how you can use data tier application to create and deploy databases
    May be this will help you to understand better
    http://www.databasejournal.com/features/mssql/article.php/3911041/Creating-Data-Tier-Applications--in-SQL-Server-2008-R2.htm
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How do i connect to sql server 2012 from cmd .

    Hi ,
    I Installed sql server 2008 R2 and 2012 Express and sql server2014 . I can conect to sql server 2008 R2 using
    SQLCMD -L command .
    How do i connect to sql server 2012 express edition from cmd .
    Any Hep appreciated
    Thanks in advance,
    Shravan

    I HAVE ANOTHER INSTANCE NAMED TEST  WHEN I USE THE COMMAND IT GIVES ME THIS ERROR 
    HOW TO RECTIFY 
    C:\Users\HP>SQLCMD -S HP-HP/TEST
    Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Named Pipes Provider: C
    ould not open a connection to SQL Server [67]. .
    Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : Login timeout expired.
    Sqlcmd: Error: Microsoft SQL Server Native Client 11.0 : A network-related or in
    stance-specific error has occurred while establishing a connection to SQL Server
    . Server is not found or not accessible. Check if instance name is correct and i
    f SQL Server is configured to allow remote connections. For more information see
     SQL Server Books Online..
    PLZ HELP 

  • How to load data to a SQL Server 2000 from a text file ( fixed / delimited)

    I am a navie user to ODI, just installed some time back. And I wanted to load text data ina file ( fixed length/ delimited ) to SQL server 2000 database.
    Iam intrested to know the steps I need to take to achieve this. I mean for example first creating topology,next designer..
    Could you please provide some books/articles or any documents that talt about these steps clearly one-by-one.

    Hi,
    Oracle Data Integrator - Getting Started with an ETL Project
    follow this manuel step by step and you will be able to load data from file to any database...

  • Accessing Views via ODBC from MSAccess

    Hello,
    This started as a simple thing, allow somebody to access to a database on a SQL 2005 server so they could get to it from MSAccess. I have created a login (Windows Authentication) so they can see the database and gave them "public" and "datareader" abilities.
    The user then informed me that while they could see the views they could not see the data. Not being a DBA (sorry) I added "public" to the view's permissions (under properties) and granted it "Select" access and nothing else. After I completed this the user could not even see the views to pick them (via the ODBC link from MSAccess) and when I try to remove "public" from the permissions it dissapears, but when I reopen the permission "public" is back.
    I then find out there is no data in the views and so the user would not have been able view anything anyway.
    So what I want to do is remove "public" from the views permissions, is this possible?
    Thanks for any help,
    Tyrone

    Is anybody still curious about this?
    Thanks!
    Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • QUery data to BLOB file and upload from APex

    I have query that populate 68k records
    Example Query is
    1) Select empno,ename from emp;
    table for Blob is
    SQL> create table dummy_blob
    ( blob_id number ,
    , blob_content_type varchar2(30)
    , blob_size number
    , blob_filename varchar2(100)
    , blob_desc varchar2(100)
    , the_blob blob );
    What I need is
    1) from html DB i need to place a button
    When user press the Button
    I need to call the database Package
    and execute the query and store in BLOB table
    2) After the query executed and writes the data in Blob Tables
    I need to refresh the APex Screen Done
    and Display the Report type as
    ID File
    with Download button
    3) when user press the button pop up file_browser
    and save it to xxx.csv file

    any help plz

  • Calling 9iLite Stored Procs via ODBC from C/C++

    Hi all,
    The Oracle 9i Lite documentation seems to offer contradictory advice on calling stored procedures over ODBC using C/C++.
    Page 2-11 of Oracle9i Lite "Developer's Guide for Java" (pdf) states "Oracle Lite does not support the SQL CALL statement for invoking stored procedures". Page 2-23 of the same document states "to execute a stored procedure....use the following CALL statement".
    Does anyone know what the correct method is? CALL does not work for me, but I don't know if it's a coding error, or whether I need to invoke the SP a different way.
    thanks for any help you can give,
    Owen.

    Since Mr. Tamashunas's question began elsewhere, I'll give some background for others. Mr. Tamashunas has an ASP (using ADO) using the following code:
    Oracle Package / Proc:
    CREATE OR REPLACE PACKAGE BODY UserInfo
    AS
    PROCEDURE sp_getUsers (
    p_errcode out NUMBER,
    p_errdesc out VARCHAR2,
    iCurs in out tCurs)
    IS
    BEGIN
    p_errcode := 0;
    OPEN iCurs for Select * from naowner.users;
    EXCEPTION
    When others then
    p_errcode := SQLCODE;
    p_errdesc := SQLERRM;
    end sp_getUsers;
    END; -- package body
    ASP code:
    strConn = Session("dbConnStr")
    cnnOracle.Open strConn
    'Creates a command object.
    Set cmdPackage = Server.CreateObject("ADODB.Command")
    Set cmdPackage.ActiveConnection = cnnOracle
    cmdPackage.CommandType = adCmdStoredProc
    cmdPackage.CommandText = "UserInfo.sp_getUsers"
    'cmdStoredProc.CommandText = "{call UserInfo.sp_addUser(?,?,?,?)}"
    cmdStoredProc.Parameters.Append
    cmdStoredProc.CreateParameter("errcode",adInteger,adParamOutput)
    cmdStoredProc.Parameters.Append
    cmdStoredProc.CreateParameter("errdesc",adVarChar,adParamOutput,1000)
    cmdStoredProc.Execute
    ---------- or -----------------
    Session("dbConnStr") = "DSN=novoarch;UID=naowner;PWD=nadba"
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.Open Session("dbConnStr")
    set rs = objConn.execute("{call LogUtils.sp_getloginfo(:p_errcode, :p_errdesc,
    :iCurs)}")
    SQLBindParameter is an ODBC API call that allows you to bind parameters to procedure calls, rather than providing the parameters explicitly, i.e.
    {call foo( 1, 2, 'abc' )}
    vs
    {call foo( ?, ?, ? )}
    ADO is a higher-level interface to ODBC (or OLEDB). In ADO, you accomplish the same thing with the CreateParameter & Parameter.Append functions in your code.
    Justin Cave
    ODBC Development

  • How to sync apps on iPad via Wifi from an iMac

    Hello all,
    I have been pulling my hair out for the past 2 hours trying to work out how to get the message back that appeared on my ipad saying 'new apps have been downloaded would you like to automatically download this in future' i opened the ipad and the message was gone.
    I didn't even know I could transfer them wirelessly - I'm connected via bluetooth to my iMac and on the same Wifi
    Does anyone have any ideas how I can sync my apps without connecting to itunes with the USB cable?
    Thanks

    There are a couple of iOS5 and iCloud features that are available as a public beta test.  One is automatic download to all your devices at once.  It's not a sync, but a simultaneous download.  If you want all your devices to have the same purchases, you need to enable both your computer and your iDevices.  This explains how: iTunes Store: How to enable Automatic Downloads, http://support.apple.com/kb/HT4539

  • How i send files , pic etc via bluetooth , from my i pad mini to another i pad mini ??

    Im having problems working out how to send with bluetooth on my ipad mini .... i have dropbox etc , but still cant work out how to send books or pdfs or anything
    could anyone help please ?thanks

    You can use Photo Transfer App to transfer photos and movies
    http://i1224.photobucket.com/albums/ee374/Diavonex/Album%205/3af5c541040e15e3f6b 3356e4c55cbfc.jpg

  • How to use 10g's SQL tuning support from SQL*Plus

    Hi,
    I am having problems with my application's SQL queries execution time. I am not tuning guru, I know pretty little about tuning. As I read 10g has a SQL Tuning Advisor. Can I use it from SQL*Plus? I didn't say, but do not have the possibility to access the database, by no other means only SQL*Plus.
    TIA
    Regards,
    Tamas Szecsy

    If you have granted the ADVISOR privilege you may use it from SQL*PLUS
    Look for examples on the web
    (using DBMS_SQLTUNE package)

  • How can I access HTTP services via Extendscript from PPro CC

    I attempting to build an HTML5 panel for Premiere Pro that retrieves assets from a third party REST API but there seems to be no support for Socket or XMLHttpRequest objects in this application which there is for others. (I get Error: Socket does not have a constructor)
    How would I go about making these requests in Extendscript?

    Hi schallis,
    I am also looking into using sockets (creating a socket server in Premiere) from my HTML5 panel, but am also getting "Socket is not defined" when running it in the context of Premiere.
    I think you are mixing up the Javascript engine that is in CEF (Chrome Embedded Framework, which runs the Javascript in your HTML panel), and CEP (Common Extensibility Framework, which runs JSX code). The Socket class in question belongs to the CEP side of things. so the lack of it in CEP doesn't mean that you can't use web sockets (if they were supported) in the CEF side.
    I am fairly certain jQuery doesn't do sockets, so it would be an XmlHttpRequest if using jQuery.

Maybe you are looking for

  • HT4437 How do I stream airplay content from 2nd Gen Apple tv 5.1?

    Can't find setting to stream music from Apple tv to AirPlay speaker and AirPort Express..

  • Screen Sharing via iCloud on Lion Freezes at Login Screen

    After updating to OSX Lion 10.7.3, screen sharing between two computers via the Internet allows me to connect to the remote computer and see the remote user's login screen, but as soon as I click on a user to login, the screen share image freezes bef

  • Phonebook like headers

    Post Author: schwarem CA Forum: Formula I am creating a directory.  I would like to put the last name of the first and last record on each page header similar to how things are listed in phonebooks.  How do I get the first and last record on the page

  • Wiki file upload size

    I work at a school where we use a Mac Mini Server as a media server using the Wiki component. In the past, I was able to modify Library/Server/Wiki/Config/Collabcored.plist file to increase the file upload size. Since upgrading to Yosemite, that file

  • Is the iMac Desktop worth the money?

    I've been saving for a computer for forever and REALLY want an iMac but it costs SO much! Is it worth it? If not, what's a better computrer I can save for?