Linking 2 oracle database through java

can any one provide all the necessary information for linking 2 different oracle databases and retriving data for jsp web application.
In one of my new web application i need to retrive data from 2 different oracle database's and show a report.
At present ,the application is using linked tables for Ms-Access.
I need to migrate the application from Access,StandAlone application to Oracle,Web application .

db links

Similar Messages

  • How to create an Oracle DATABASE through Java Programming Language.. ?

    How to create an Oracle DATABASE through Java Programming Language.. ?

    Oracle database administrators tend to be control freaks, especially in financial institutions where security is paramount.
    In general, they will supply you with a database, but require you to supply all the DDL scripts to create tables, indexes, views etc.
    So a certain amount of manual installation will always be required.
    Typically you would supply the SQL scripts, and a detailled installation document too.
    regards,
    Owen

  • How To Store pdf or doc file in Oracle Database using Java Jdbc?

    can any one help me out How To Store pdf or doc file in Oracle Database using Java Jdbc in JSP/Serlet? i tried like anything. using blob also i tried. but i am able 2 store images in DB not files. please if u know or else if u have some code like this plz send that to me, and help me out plz. i need that urgent.

    Hi.. i am not getting error, But i am not getting the original contents from my file. i am getting all ASCII vales, instead of my original data. here i am including my code.
    for Adding PDF in DB i used image.jsp
    Database table structure (table name. pictures )
    Name Null? Type
    ID NOT NULL NUMBER(11)
    IMAGE BLOB
    <%@ page language="java" import="java.util.*,java.sql.*,java.io.*" pageEncoding="ISO-8859-1"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <%
    try{
         Class.forName("oracle.jdbc.driver.OracleDriver");
         Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
         PreparedStatement ps,pstmt,psmnt;
         ps = con.prepareStatement("INSERT INTO pictures VALUES(?,?)");
    File file =
    new File("D:/info.pdf");
    FileInputStream fs = new FileInputStream(file);
    ps.setInt(1,4);
    ps.setBinaryStream(2,fs,fs.available());
    int i = ps.executeUpdate();
    if(i!=0){
    out.println("<h2>PDF inserted successfully");
    else{
    out.println("<h2>Problem in image insertion");
    catch(Exception e){
    out.println("<h2>Failed Due To "+e);
    %>
    O/P: PDF inserted successfully
    i tried to display that pdf using servlet. i am giving the code below.
    import java.io.IOException;
    import java.sql.*;
    import java.io.*;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class DispPDF extends HttpServlet {
         * The doGet method of the servlet. <br>
         * This method is called when a form has its tag value method equals to get.
         * @param request the request send by the client to the server
         * @param response the response send by the server to the client
         * @throws ServletException if an error occurred
         * @throws IOException if an error occurred
         public void service(HttpServletRequest request, HttpServletResponse response)
                   throws ServletException, IOException {
              //response.setContentType("text/html"); i commented. coz we cant use response two times.
              //PrintWriter out = response.getWriter();
              try{
                   InputStream sPdf;
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                        Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.1.135:1521:orcl","scott","tiger");
                        PreparedStatement ps,pstmt,psmnt;
                   psmnt = con.prepareStatement("SELECT image FROM pictures WHERE id = ?");
                        psmnt.setString(1, "4"); // here integer number '4' is image id from the table.
                   ResultSet rs = psmnt.executeQuery();
                        if(rs.next()) {
                   byte[] bytearray = new byte[1048576];
                        //out.println(bytearray);
                        int size=0;
                        sPdf = rs.getBinaryStream(1);
                        response.reset();
                        response.setContentType("application/pdf");
                        while((size=sPdf.read(bytearray))!= -1 ){
                        //out.println(size);
                        response.getOutputStream().write(bytearray,0,size);
                   catch(Exception e){
                   System.out.println("Failed Due To "+e);
                        //out.println("<h2>Failed Due To "+e);
              //out.close();
    OP
    PDF-1.4 %âãÏÓ 2 0 obj <>stream xœ+är á26S°00SIá2PÐ5´1ôÝ BÒ¸4Ü2‹ŠKüsSŠSŠS4C²€ê P”kø$V㙂GÒU×713CkW )(Ü endstream endobj 4 0 obj <>>>/MediaBox[0 0 595 842]>> endobj 1 0 obj <> endobj 3 0 obj <> endobj 5 0 obj <> endobj 6 0 obj <> endobj xref 0 7 0000000000 65535 f 0000000325 00000 n 0000000015 00000 n 0000000413 00000 n 0000000168 00000 n 0000000464 00000 n 0000000509 00000 n trailer <<01b2fa8b70ac262bfa939cc786f8770c>]/Root 5 0 R/Size 7/Info 6 0 R>> startxref 641 %%EOF
    plz help me out.

  • Request parameter are not stored in database through Java Bean

    Hi,
    I want to store the request parameter in database through Java Bean.Allthough program are properly run but value are not store in DB.
    Here My code:
    Login.html:<html>
    <head>
    <title>A simple JSP application</title>
    <head>
    <body>
    <form method="get" action="submit.jsp" >
    Name: <input type="text" name="User">
    Password: <input type="password" name="Pass">
    <input type="Submit" value="Submit">
    </form>
    </body>
    </html>SimpleBean.java:
    package co;
    import java.util.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.*;
    public class SimpleBean implements java.io.Serializable{
    private String User="";
    private String Pass="";
    public SimpleBean(){}
    public String getUser() {
    return User;
    public void setUser(String User) {
    this.User = User;
    public String getPass() {
    return Pass;
    public void setPass(String Pass) {
    this.Pass = Pass;
    public void show()
         try
    System.out.println("Printed*************************************************************");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    System.out.println("Loading....");
    Connection con=DriverManager.getConnection("jdbc:odbc:Ex11dump");
    System.out.println("Connected....");
    PreparedStatement st=con.prepareStatement("insert into Table1 values(?,?)");
    System.out.println("~~~~~~~~~~~~~~~~~~~~");
    String User=getUser();
    st.setString(1,User);
    String Pass=getPass();
    st.setString(2,Pass);
    int y= st.executeUpdate();
    System.out.println(y);
    System.out.println("Query Executed");
    con.commit();
    con.close();
    System.out.println("Your logging is saved in DB *****************");
    catch(Exception e)
    e.printStackTrace();
    }submit.jsp:
    <jsp:useBean id="obj" class="co.SimpleBean"/>
    <jsp:setProperty name="obj" property="*" />
    <jsp:getProperty name="obj" property="User" /> <br>
    <jsp:getProperty name="obj" property="Pass" /> <br>
    <% obj.show();%>
    <%
    out.println("Ur data is saved in DB");
    %>Please Help me.
    Thanks.

    The issue is in the naming of your fields.
    Change User -> user and Pass->pass
    Name: <input type="text" name="user">
    Password: <input type="password" name="pass">

  • How to create a oracle database by java code?

    how to create a oracle database by java code?
    please give some ways then that way's code

    I'm not sure what you mean with "database". Do you mean an Oracle instance or an Oracle user/schema (probably the latter, because that's the equivalent to a MS SQL Database).
    Creating an instance is definitely not possible from within Java. To create a new user this should be possible, as this can be done with SQL:
    GRANT connect,resource TO <newuser> IDENTIFIED BY <password>;
    I'm always cautious with questions like this. In 90% of the cases there is something wrong with the initial design. Creating a database shouldn't be something the application is doing.
    Thomas

  • How to connect Oracle database  through Microsoft ODBC?

    My ODBC Configuration:
    DSN name is :db
    Username : india
    Server :db.world
    Now, i am trying to connect with oracle database through SQL*plus or TOAD.
    But, it is giving the following error.
    ORA-03121: no interface driver connected - function not performed
    Database version : 9.2.0.1.0
    Operating System : Microsoft Windows XP
    ODBC Version : 2.575.1117.00
    I am trying to connect with the database like this:
    Username : india
    Password : india
    Database : ODBC:db
    Can i connect like this otherwise whether i need install any other supporting driver?

    Now, i am trying to connect with oracle database
    through SQL*plus or TOAD.
    But, it is giving the following error.
    ORA-03121: no interface driver connected -
    function not performed
    I am trying to connect with the database like this:
    Username : india
    Password : india
    Database : ODBC:db
    As already stated, you can not use the DSN in SQL*Plus (nor TOAD, afaik)!
    I can reproduce the error message with the following:
    C:\>sqlplus a/b@ODBC:c
    SQL*Plus: Release 11.1.0.6.0 - Production on Mon Aug 4 21:34:58 2008
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    ERROR:
    ORA-03121: no interface driver connected - function not performedLooking up the message, it says:
    Cause: A SQL*Net version 1 prefix was erroneously used in the connect string
    Looks like this has nothing to do with your DSN - it is more a matter of not using a proper connection string.
    If 'Test Connection' works then you should probably proceed to work with Crystal Reports, using the DSN in question.
    However, you should note that the old MS ODBC driver for Oracle was designed for OCI 7 (and for databases 7.x-8.x) and is now considered obsolete by both MS and Oracle.
    Deprecated MDAC components and MS KB Article 244661.
    Use the Oracle ODBC driver included with a supported Client version instead.
    Edit:
    Clarifying and adding references.
    Message was edited by:
    orafad

  • How to connect oracle database with JAVA

    how to connect oracle database with JAVA....
    using j2sdk and Jcreator . which connector to use .. what are the code for that ..

    PLEASE .... Ask in an Oracle Java forum.
    And read the documentaiton. There is a whole document devoted to doing that. http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/toc.htm has examples.
    PLEASE ... do not ask product questions in a forum which clearly has a title saying it is devoted to assisting with download problems.

  • Java App connection to an Oracle Database through Oracle Stored Procedure

    My team's access to its Databases (Oracle only) is restricted to access through Oracle Stored Procedures that are part of the Oracle Database. So, in my Java App I need to call the Stored Procedure that will give me the access to the table that I need, declare the right parameters and execute the command. The Stored Procedure will then hand me the data I need.
    I am finding support on the web for creating Stored Procedures in Java, but that is not what I need.
    Can anyone post here a class that addresses this, or point me to a link that will shed some light on it?
    Thanks
    user606303

    user606303 wrote:
    Sorry this code is unformatted - I can't see how to format it.Use \ tags
    I am looking for Java code that will do what this .NET code below does (connects to a database and writes data to the table through an Oracle stored procedure that is part of the Oracle Database.)
    So learn Java, learn JDBC and translate the requirements; don't attempt to translate the code as the platforms are too different.
    From a quick glance it looks like a JDBC CallableStatement can do the job.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Sending Long Raw Data to Oracle database through Stored  Procedure

    Hi,
    I am trying to push data to Oracle 9i database through Stored Procedure via thin driver. It is going smoothly upto 29411 bytes. But it is not accepting for 53843 bytes and giving following error :
    java.sql.SQLException: Data size bigger than max size for this type: 53843
    Is it thin driver limitation? Can I solve it by using OCI driver? Or is there any other approach?
    I tried creating connection pool in weblogic 7.0 through OCI driver. But I am not able to configure it. Is there any special way of configuration.
    Quick response will be greatly appreciated.
    Thanks
    Sanjiv

    It happens to me. But I am using CMP of Weblogic 7. If you write your own jdbc code, the following link may be helpful.
    http://otn.oracle.com/sample_code/tech/java/codesnippet/xmldb/HowToLoadLargeXML.html

  • Startup/Shutdown database through java code

    I am trying to shutdown/startup my database 10gr2 using a java code.
    I am able to shutdown db through EM dbconsole .. so there should be way to perform these steps using java prog.
    Issue I am getting is that "shutdown immeidate" is not a valid sql statement.
    do "shutdown" command strickly belongs to sqlplus only
    [ shutdown/ shutdown immeidate/shutdown abort ] .. nothing works
    Error is
    Connected ..
    Shuting down database..
    java.sql.SQLException: ORA-00900: invalid SQL statement
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
    at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
    Any idea how we can achive it
    here ismy code ..
    ======================
    /* shutdown/startup database */
    import java.sql.*;
    import oracle.jdbc.driver.*;
    class DBTest
         public static void main (String args[])
         Connection connection = null;
         try {
              // Load the JDBC driver
              String driverName = "oracle.jdbc.driver.OracleDriver";
              Class.forName(driverName);
              // Create a connection to the database
              String serverName = "127.0.0.1";
              String portNumber = "1521";
              String sid = "prod";
              String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
              String username = "sys as sysdba";
              String password = "password";
              connection = DriverManager.getConnection(url, username, password);
              System.out.println("Connected ..");
              System.out.println("Shuting down database..");
              Statement stmt = connection.createStatement();
              stmt.execute("shutdown immediate");
              stmt.close();
              System.out.println("Shuting down database complete..");
              connection.close();
         } catch (ClassNotFoundException e) {
              e.printStackTrace();
              // Could not find the database driver
         } catch (SQLException e) {
         e.printStackTrace();
              // Could not connect to the database
    ==================================

    Link is perfect for OCI users.
    Do anyone have an idea how 10g enterprise manager console stops database server. Whats happening in background when shutdown button is clicked after provided database and host credential.

  • Retrieve data from a synonym in oracle database through db connect

    Hi Everyone,
    I have created certain synonym for some tables in oracle. I want to retrieve data from it through db connect but where through source system and then selecting database tables, only tables and views are available.
    Synonyms are not available to create data sources and retrieve the data from it. Why is it so. Is this a limitation of db connect.
    Can anyone please let me know about it.
    Thanks,
    Joshua.

    Hi,
    You want to import data from an external Oracle database into your BW 3.X. To do this, you can connect the external database to the BW 3.X release as a source system using the external database connect. BW 3.X here represents BW 3.0, BW 3.1 and BW 3.5 because in other (DB relevant) parts, all 3 versions are based on the same source code.
    General information
    The above function allows you to load data from an external Oracle database (not a BW database) into your BW 3.0 system.
    There may also be constellations which cannot be used directly through the DB Connect access. However, it should be possible to find an adequate, customer-specific solution for most of these scenarios.
    In such situations, the resulting work falls into the area of Consulting and cannot be handled via Support.
    Successful implementation of a connection requires corresponding expertise and experience in the use of the source database in the areas:
                    - Tools
                    - SQL syntax
                    - DB-specific functions
    Corresponding knowledge of the source application is also required to ensure that semantically relevant data arrives in the BW system.
    Procedure
    You should execute the following steps to connect the source system (Q) to the BW system (BW):
    Installing the client software on an BW application server
                         Of course, you only need to install the client software if you are using BW with a non-Oracle database.
                         Use the Oracle setup program on the database CD (runInstaller on Unix) to start the OracleInstaller. Follow the program instructions and the DB installation instructions to install the Oracle Client software on BW.
    Testing connection setup from BW to Q
                         After you install the client software on BW, try to set up a connection from BW to the server on Q. You may need to adjust the tnsnames.ora or sqlnet.ora files for this, to introduce the Oracle systems (to which contact should be made) to BW. You can test the connection by executing the command "tnsping QDB" on BW to check whether the client has established contact to the QDB database on the Q system.
    Creating a separate U user in Q
                         We recommend that you create a separate U user in Q for connection to BW. This means that authorization and administration questions can be solved centrally.
    Displaying data sources in Q for the U user
                         To provide U data for users other than U, you can create views on other user tables as user U:
                         CREATE OR REPLACE VIEW viewname AS
                           SELECT * FROM QDB.tablename
                         You may have to grant SELECT privileges to user U in the QDB schema:
                            GRANT select ON QDB.tablename TO U
                         Of course, you can also restrict or reformat data in the view arrangement (for example, change from internal date format into the SAP date format). JOIN operations using several tables are also available.
                         !!! Synonyms do not yet work!!!
                         Synonyms that you can create as described below are another option for providing a complete table for the user U:
                           CREATE SYNONYM synoname FOR QDB.tablename
                         !!! Synonyms do not (yet) work!!!
                         After you have displayed the require data for user U, you can simply use
                           SELECT * FROM <view or table>
                         on the Q system to check which data is returned.
                         You can now open a link to Q as user U in the BW system with SQLPLUS and check, using the same SELECT, whether this data is also seen in the Oracle client. If this is not the case, there is probably a connection problem.
    Creating a connection from BW to Q in BW
    Including data sources of user U user in Q in BW.
    Solution
    Supported BW, Basis and BW 3.0B database versions, Basis 6.20 Support Package 2 (or higher)
          Oracle 8.1 (or higher, see below)
    Possible problems
    - Synonyms do not (yet) work!
    Up to now, only tables and views have been used as data sources for the DB Connect from the R3 Basis. As soon as synonyms are also used in the Basis, you will be able to convert created views (or even replicated tables) to synonyms as a workaround.
    With Basis 6.40 at the earliest, therefore as of BW 3.5, you will also be able to use synonyms. Until then, the following will help:
      CREATE VIEW <view_on_synonym> AS SELECT * FROM <synonym>
    - The source DB must have at least the release version of the BW DB.
    Oracle only ensures the support of client-server links if the version of the client is not higher than that of the server. So if BW has Oracle version 8.1 and, as in the case of Dbconnect, is run as a client against the server of the source database, the source database must have at least release Oracle 8.1 or higher.
    Of course, you have the option to install the Oracle client software of a lower version and then use this for the DB connect. This is also the procedure used to work with a DB connect on external databases of other vendors.
    Furthermore, the implementation of the DBconnect function in BW uses SAP Basis functions. Specifications of Oracle 8.1 database catalogs are used here. The source database must therefore have at least Version 8.1.
    - Oracle Client Software Version
    If you want to connect from an Oracle BW DB to an Oracle source DB, for the DB connect you naturally use the client software that you already installed on each application server.
    If you want to connect from a non-Oracle BW DB to an Oracle source DB, check item 3 of note 521230 to see which Oracle client software version is released with your BW R3 kernel and use this version.
    - Date and time fields in Oracle and their conversion into SAP-compatible column formats
    Example with a DATE field:
    Since a SAP table does not have a DATE field (date values are NUMC(8) and time specifications are NUMC(6)), we will use the Oracle DBA_TABLES system table as an example.
        SQL> desc dba_tables;
    The Oracle DBA_TABLES system table has a LAST_ANALYZED field. This is a DATE type field and is recognized as a date field of 7 characters by DBA_CONNECT. However, the import does not work because the DATE is a 7-byte conglomerate of "...century, year, month, date, hour, minute and second." (extract from the Oracle documentation).
    To make this DATE field legible for DB connect, you must use the TO_CHAR function in a VIEW. This should display the following examples:
    SQL> select LAST_ANALYZED from dba_tables
          where table_name like 'RS%' and rownum < 10 ;
    The formatting used here is the default used implicitly by SQLPLUS.
    SQL> select  to_char(LAST_ANALYZED,'YYYYMMDD') as dat from dba_tables where table_name like 'RS%' and rownum < 10 ;
    The result now has the SAP compatible format YYYYMMDD and should be loaded correctly by the DB connect as a date.
    SQL> select  to_char(LAST_ANALYZED,'HH24MISS') as tim from dba_tables where table_name like 'RS%' and rownum < 10 ;
    The result now has the SAP compatible format HHMMSS and should be loaded correctly by the DB connect as a time.
    You can use the following example for more detailed experiments:
    SQL> select  to_char(
           TO_DATE('03-FEB-2001 04:05:06','DD-MON-YYYY HH24:MI:SS'),
           'YY-MM-DD HH24-MI-SS') as datim from dual;
    with the result:
      DATIM
      01-02-03 04-05-06
    When you create a VIEW and use the TO_CHAR function (or other functions), you should easily be able to avoid problems with the interpretation of date/time specifications (and other reformatting).
    Details about the functions and the formats are contained in the Oracle documentation.
    - Special characters
    A words that contain special characters can only be imported correctly if the code pages in BW and in the source system are identical. If the code pages are not the same, DB Connect can be used if the characters to be imported appear under the first 127 characters of the character set.
    The use of multibyte code pages in the source system for saving data using character sets with more than 256 characters (Kanji, Katakana, Hiragana, Korean, Chinese, Tagalog, Khmer, Arabic, Cherokee, and so on) can cause the characters to become corrupt.
    For questions concerning the code pages, also refer to the FAQ note 606359 and question/answer 19 that appears there.

  • View pdf file stored in oracle database through oracle forms

    Forms [32 Bit] Version 10.1.2.0.2 (Production)
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.8.0 - Production
    Oracle Toolkit Version 10.1.2.0.2 (Production)
    PL/SQL Version 10.1.0.4.2 (Production)
    Oracle Procedure Builder V10.1.2.0.2 - Production
    PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
    Oracle Query Builder 10.1.2.0.2 - Production
    Oracle Virtual Graphics System Version 10.1.2.0.2 (Production)
    Oracle Tools GUI Utilities Version 10.1.2.0.2 (Production)
    Oracle Multimedia Version 10.1.2.0.2 (Production)
    Oracle Tools Integration Version 10.1.2.0.2 (Production)
    Oracle Tools Common Area Version 10.1.2.0.2
    Oracle CORE     10.1.0.4.0     Production
    I have created external directory and am able to load pdf files in oracle database table called test_blob.
    CREATE TABLE test_blob (
    id NUMBER(15)
    , file_name VARCHAR2(1000)
    , image BLOB
    , timestamp DATE
    I have 2 pdf files in the table. I want to view this pdf from forms when the user clicks on the button. On when-button-pressed trigger I want to show pdf on the screen. Any help is appreciated. Not on the designer. I want to run form application.
    SELECT id, file_name,
    DBMS_LOB.GETLENGTH(image) Length,
    timestamp
    FROM test_blob
    ID|FILE_NAME|LENGTH|TIMESTAMP
    1001|2011 HeartlandEmployeeReferralCard.pdf|353718|1/28/2013 11:44:41 AM
    1002|2011 HeartlandEmployeeReferralCard.pdf|353718|1/28/2013 11:51:07 AM
    Edited by: user_anumoses on Jan 28, 2013 11:45 AM

    We were able to do the same thing with Oracle Application Server and Oracle WebLogic Server. I cannot remember how different the processes were, but it seems like they were very similar. I am going to give you the instructions on how we implemented a "Read PDF" procedure on the WebLogic Server. If you are still on the Application Server you may have to do some Google searches, but it all boils down to the mod_plsql DAD Configuration file.
    Our PDF was located in a table with the following structure:
    CASE_DOCUMENTS
       (id_document                    NUMBER NOT NULL,
        doc_blob                       BLOB,
        note                           VARCHAR2(240),
        created_by                     VARCHAR2(20) NOT NULL,
        created_dt                     DATE NOT NULL,
        case_id                        NUMBER NOT NULL,
        filename                       VARCHAR2(100) NOT NULL)Based on that table structure we created a procedure named READ_PDF which you will reference below in the dads.conf file below:
    CREATE or REPLACE procedure read_pdf (p_id_document IN number)
    is
      view_file     blob;
    BEGIN
      select doc_blob
        into view_file
        from case_documents
       where id_document = p_id_document;
      OWA_UTIL.MIME_HEADER ('APPLICATION/PDF', FALSE);
      HTP.P ('CONTENT-LENGTH: ' || DBMS_LOB.GETLENGTH (view_file));
      OWA_UTIL.http_header_close;
      WPG_DOCLOAD.download_file (view_file);
    END;
    GRANT EXECUTE ON read_pdf TO financial_user_role  -- Name of role to execute
    /Basically, you are passing in one parameter and that is the primary key for your table. You are selecting the pdf stored in a BLOB for that primary key. The commands below that allow the pdf to open up so you can view it – we got this off some search we did a few years ago.
    Now, you need to add logic to your Oracle Form that will call the procedure above, but the URL is based on the dads.conf file that we will set up below… Anyway, we created a button on the form module with a label of "View". In the WHEN-BUTTON-PRESSED trigger the logic looks like this:
    -- The View logic uses the DAD (Database Access Descriptors) method to view a .pdf file from the form.
    -- The DAD was created on WebLogic Server  with the name findadgen.  This allows an http request be made
    -- to the database.
    declare
      v_file          varchar2(400);
      v_success       boolean;
      ret_val         number;
      v_http_link     varchar2(400);
    begin
      -- The format of the link is as follows: hostname:port/pls/DAD_name/procedure_name
      v_http_link := 'http://finas03:8888/pls/findadgen/read_pdf?p_id_document=' || :case_documents.id_document;
      web.show_document(v_http_link, '_BLANK');
    end;The name of our WebLogic Server is "finas03" so that is what is listed in the URL. The "findadgen" is the name of the <Location> in the dads.conf file below, the "read_pdf" is the name of the procedure we created above, the "p_id_document=" is the IN parameter listed in the READ_PDF procedure created above, and the ":case_documents.id_document" is the reference to the primary key in our Oracle Form.
    For WebLogic, you can either go through Enterprise Manager (directions below) or update the dads.conf file on the filesystem directly (if you update the dads.conf file directly then skip to step 4 and ignore step 5):
    1.     Enterprise Manager -> Web Tier -> ohs1
    2.     Oracle HTTP Server (pull-down) – Administration – Advance Configuration
    3.     Select File – dads.conf
    4.     Add something similar:
    # ============================================================================ 
    #                     mod_plsql DAD Configuration File                         
    # ============================================================================ 
    # 1. Please refer to dads.README for a description of this file                
    # ============================================================================  
    # Note: This file should typically be included in your plsql.conf file with 
    # the "include" directive. 
    # Hint: You can look at some sample DADs in the dads.README file 
    # ============================================================================
    <Location /pls/findadgen>
        SetHandler pls_handler
        Order allow,deny
        Allow from All
        AllowOverride None
        PlsqlDatabaseUsername financial
        PlsqlDatabasePassword sdo_3#d1
        PlsqlDatabaseConnectString ffindbTNSFormat
        PlsqlNLSLanguage AMERICAN_AMERICA.WE8ISO8859P1
        PlsqlAuthenticationMode Basic
        PlsqlDefaultPage read_pdf
    </Location>You are adding the <Location> section to your dads.conf file. The "finddadgen" is the name that you will reference in a change you fill make to your Oracle Form. The "financial" is the Schema, the "sdo_3#d1" is the password for that Schema, the "ffindb" is the database that the stored procedure is located on, and the "read_pdf" is a stored procedure you will have to create in order to read the pdf.
    5.     Press the "Apply" Button
    6.     Obfuscate the DAD password by running the dadTool.pl script located in $ORACLE_HOME/bin (This was done on Unix on our server with the following commands):
    $> LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH
    $> cd $ORACLE_HOME/bin
    $> perl dadTool.pl -f /u01/app/oracle/middleware/asinst_1/config/OHS/ohs1/mod_plsql/dads.conf
    7.     Restart the Oracle HTTP Server using Fusion Middleware Control:
    Enterprise Manager -> Web Tier -> ohs1
    Oracle HTTP Server – Control – Shutdown
    Oracle HTTP Server – Control – Start Up
    If you followed the instructions above, you should have created a stored procedure, added logic to your Oracle form to reference that stored procedure, and created an entry in the dads.conf file. Once you move the form onto the server and you restart the HTTP Service, you should be able to view a pdf that is stored in a table directly from your Oracle Form.

  • Need to Connect oracle database through EP

    Hi,
    my requirement is trying to connect oracle database and getting values from oracle database and displaying in portal (through EP)
    i created driver name called - sapdirect and import the jars like pOracle.jar in the driver and then i'll try to create datasource with the following configurations
    Name : sapdsn
    Aliases : sapalias
    Driver name: selected whatever i created before (ex: sapdirect)
    class : com.sap.portals.jdbc.oracle.OracleDriver
    url : jdbc:sap:oracle://10.145.4.171:1521;RAMS
    user name :scott
    password :tiger
    But the datasource can't create , the follwing error shown,
    Please gimme Solution for this.
    Even, all the services running oracle m/c.
    im wating for solution,
    Thanks in advance
    Bye for now
    Vasu
    Error:
    java.rmi.RemoteException: Error occurred while starting application in whole cluster and wait.; nested exception is:
    com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide execption: server ID 3739150:Exception while preparing start of application sap.com/JDBCConnector_sapdsn.xml.
    at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:679) at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:661) at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.startApplication(DataSourceManagerImpl.java:562) at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.deploy(DataSourceManagerImpl.java:261) at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.createDataSource(DataSourceManagerImpl.java:317) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.pj.jmx.introspect.DefaultMBeanInvoker.invoke(DefaultMBeanInvoker.java:58) at com.sap.pj.jmx.mbeaninfo.AdditionalInfoProviderMBean.invoke(AdditionalInfoProviderMBean.java:289) at com.sap.pj.jmx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:944) at com.sap.pj.jmx.server.interceptor.MBeanServerWrapperInterceptor.invoke(MBeanServerWrapperInterceptor.java:288) at com.sap.engine.services.jmx.CompletionInterceptor.invoke(CompletionInterceptor.java:400) at com.sap.engine.services.jmx.RedirectInterceptor.invoke(RedirectInterceptor.java:340) at com.sap.pj.jmx.server.interceptor.MBeanServerInterceptorChain.invoke(MBeanServerInterceptorChain.java:330) at com.sap.engine.services.jmx.MBeanServerSecurityWrapper.invoke(MBeanServerSecurityWrapper.java:287) at com.sap.engine.services.jmx.MBeanServerInvoker.invokeMbs(MBeanServerInvoker.java:157) at com.sap.engine.services.jmx.ClusterInterceptor.invokeMbs(ClusterInterceptor.java:220) at com.sap.engine.services.jmx.ClusterInterceptor.invoke(ClusterInterceptor.java:803) at com.sap.engine.services.jmx.MBeanServerInterceptorInvoker.invokeMbs(MBeanServerInterceptorInvoker.java:102) at com.sap.engine.services.jmx.connector.p4.P4ConnectorServerImpl.invokeMbs(P4ConnectorServerImpl.java:61) at com.sap.engine.services.jmx.connector.p4.P4ConnectorServerImplp4_Skel.dispatch(P4ConnectorServerImplp4_Skel.java:64) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:291) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:183) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:119) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37) at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)Caused by: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide execption: server ID 3739150:Exception while preparing start of application sap.com/JDBCConnector_sapdsn.xml.
    at com.sap.engine.services.deploy.server.application.ParallelAdapter.sleepClientThread(ParallelAdapter.java:232) at com.sap.engine.services.deploy.server.application.ParallelAdapter.runInTheSameThread(ParallelAdapter.java:113) at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesAndWait(ParallelAdapter.java:214) at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:4601) at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:677) ... 31 more

    Go to System Administration
    -> System Configuration
    -> System Landscape
    -> select a Folder where you want to store your system object
    -> right click -> New System
    -> in the wizard, select JDBC System
    -> enter values
    -> edit
    Then fill in the correct values as stated here:
    http://help.sap.com/saphelp_nw04/helpdata/en/84/d5df3df2ad685ae10000000a11405a/frameset.htm
    Then assign an Alias and enter some usermapping data for the system.
    You then can use the ConnectorService to get a native sql connection and fire statements. I'm sure you can find some examples here.
    Regards, Karsten

  • Connecting Oracle DataBase through WebDynpro

    Hi,
    I created a Dynamic table, now I should display the data from Oracle Database. I tried in many various ways to connect to database, but the data is not retrieving.
    Can u explain the reasons and give necessary coding to retrieve the data.
    Its very very urgent.

    Hi
    I think you can do using the APIs provided by SAP.
    Check this link
    JDBC Reference
    or
    Try connectinc using lookup.
    try{
    InitialContext ctx=new InitialContext();
    javax.sql.DataSource ds=(javax.sql.DataSource)ctx.lookup("jdbc/SAPJ2EDB");
    java.sql.Connection con=ds.getConnection();
    java.sql.Statement stmt=con.createStatement();
    con.close();
    catch(Exception e)
    wdComponentAPI.getMessageManager().reportException("Exception "+e,true);
    Check this thread moreuseful.
    WebDynpro and Oracle Connection
    Please Check these threads
    Re: I need a j2ee code for getting data from oracle database
    Re: oracle connection
    Re: problem with displaying records from the database in a table ui element
    See this sample application and help
    https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/f0b0e990-0201-0010-cc96-d7ecd2e51715
    I hope these links will help u resolve your problem.
    All The Best
    Priyanka
    Do Reward Points

  • Error in connecting Oracle Database from JAVA application!!!

    Hi,
    I am trying to connect to the Oracle11g database server from the client machine using JAVA eclipse. I have installed the oracle client in the client machine. Once i try to execute the below code it was throwing below error:
    public class Dbconnect {
    public static void main (String[] args)throws Exception {
    try {
    Class.forName ("oracle.jdbc.driver.OracleDriver");
    String connectString = "jdbc:oracle:thin:@<IP Address>:1521:orcl";
    OracleDriver drivers = new OracleDriver();
    System.out.println(drivers);
    Connection connection = null;
    connection = (OracleConnection)DriverManager.getConnection(connectString,"ADMIN", "admin");
    System.out.println(connection);
    System.out.println("Connected to the database");
    Error:
    java.sql.SQLException: The Network Adapter could not establish the connection
         at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
         at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
         at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
         at java.sql.DriverManager.getConnection(Unknown Source)
         at java.sql.DriverManager.getConnection(Unknown Source)
         at DBConnect.main(DBConnect.java:15)
    Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection
         at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:359)
         at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:422)
         at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:672)
         at oracle.net.ns.NSProtocol.connect(NSProtocol.java:237)
         at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
         at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
         ... 7 more
    Caused by: java.net.ConnectException: Connection refused: connect
         at java.net.PlainSocketImpl.socketConnect(Native Method)
         at java.net.PlainSocketImpl.doConnect(Unknown Source)
         at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
         at java.net.PlainSocketImpl.connect(Unknown Source)
         at java.net.SocksSocketImpl.connect(Unknown Source)
         at java.net.Socket.connect(Unknown Source)
         at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:141)
         at oracle.net.nt.ConnOption.connect(ConnOption.java:123)
         at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:337)
         ... 12 more
    I am unable to connect using sqlplus as well ORA-12560: TNS:protocol adapter error
    Please advise me on how to resolve this issue..
    Thanks

    Prabhu wrote:
    We are not able to connect from SQLplus as we.. If i issue this command in Sqlplus from client machine 'sqlplus admin/admin@'(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=<Ip Adddress>)(PORT=1521)))(CONNECT_DATA=(SID=orcl)))'' it was throwing the below error.
    Error: ORA-12541: TNS:no listener
    Do i need add get any config details in the client machine..
    Could please tell me what is the general procedure to access the DB server from client machine..on DB Server issue following OS commands
    lsnrctl start
    lsnrctl status
    lsnrctl service
    COPT commands & results, then PASTE all back here

Maybe you are looking for