Need Sample code to retrieve Data from Portal DB(Oracle)

Would anyone provide me steps to create application with a sample code to retrieve data from portal DB which is oracle and see the output in table format.

Hi Bris ,
The sample code , you didnt specified from where do u want to access the oracle thorough java code or through webdynpro .
Sample code to access through Java
import java.sql.*;
class Customer
public static void main(String args[]) throws SQLException
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
System.out.println("Connecting to the database...");
try
Connection cn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","t");
Statement st=cn.createStatement();
ResultSet rs=st.executeQuery("select 'Connected' from dual");
rs.next();
String s=rs.getString(1);
System.out.println(s);
st.close();
cn.close();
catch(Exception ex)
System.out.println("The exception raised is:" + ex);
[code]
If accessing through JDBC datasorce.
https://www.sdn.sap.com/irj/sdn/thread?threadID=328550
https://www.sdn.sap.com/irj/sdn/thread?threadID=309386
[code]
package com.dhl.employeemodel;
import java.sql.Connection;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
public class DBConnectionManager {
     Connection connection;
      * @return
     public Connection getConnection() {
          try
               Context jndiContext = new InitialContext();
               DataSource ds = (DataSource)jndiContext.lookup("jdbc/MyAlias");
               connection = ds.getConnection();
         catch(Exception connectionErrEx)
               //connectionErrEx.printStackTrace();
               return null;
          return connection;
Thanx
Pankaj

Similar Messages

  • To write ABAP code to retrieve data from RSTMANPART table

    hello everyone...
    Actually, i need help to write a ABAP code....
    i need to record the number of data records which is transferred and added to 3 cubes... i need to read the latest request number from the RSSTATMANPART table, for the 3 datatargets,  and gather the transferred records, added records , start time n end time from that specific req num....
    And i have to store it in an internal table....
    Please help me with the same.....
    Thanks....
    Edited by: neethacj on Dec 2, 2010 10:27 AM

    Dear Neetha,
    The table name is RSSTATMANPART.
    Now the relevant fields are
    DTA(Data Target)
    DTA_TYPE(Data Target Type = Cube)
    RNR (Request ID)
    STATUS(Data Load Status )
    TSTATUS(Technical Status)
    DATUM_ANF(Request date)
    DATUM_VERB(Loaded Date)
    ZEIT_ANF(Start Time)
    ZEIT_VERB(Finishing Time)-->just do one load and compare the entries with Process monitor
    OLTPSOURCE(Datasource).
    ANZ_RECS(Transferred Records)
    INSERT_RECS(Inserted Records)
    *Create an Internal Table :
    DATA: IT_MANPART1 TYPE TABLE OF RSSTATMANPART,
               IT_MANPART2 TYPE TABLE OF RSSTATMANPART,
              IT_MANPART3 TYPE TABLE OF RSSTATMANPART,
               WA_MANPART LIKE LINE OF IT_MANPART1.
    *Fill the internal table
    SELECT * FROM RSSTATMANPART INTO TABLE IT_MANPART1  WHERE 
    DTA = 'CUBE1'.
    SELECT * FROM RSSTATMANPART INTO TABLE IT_MANPART2  WHERE 
    DTA = 'CUBE1'.
    SELECT * FROM RSSTATMANPART INTO TABLE IT_MANPART3  WHERE 
    DTA = 'CUBE1'.
    SORT IT_RSSTATMANPART1 BY  RNR  DESCENDING.
    SORT IT_RSSTATMANPART1 BY  RNR  DESCENDING.
    SORT IT_RSSTATMANPART1 BY  RNR  DESCENDING.
    It will fill up your Internal table with all the requests of the RSSTATMANPART for the three Infocubes.The requests have been sorted in descending order ,the most latest will be at the top.
    You can do whatever you want to do with these three internal tables..you can have them in one talbe also..depends on ur exact requirement.
    Regards,
    RK

  • How to increase speed while retrieving data from tableand showing it in pop

    Hi,
    In one form ,I have used f9 key to retrieve data from table in oracle database . i.e. in any input field in my form, once I press f9 key, it execute JavaScript windows. Open command.
    In that command, I called the servlet which retrieves nearly 7000 rows data from table and then it dispatch request to another jsp page which shows the related data in tabular form. The data may contain nearly 7000-8000 rows.
    So when I press the f9 keys it takes around 10-12 second to open the page.
    Is there any ways to open this pop up windows within 2-3 second once I hit the f9 keys.
    Here with I am attaching hole code for servlet and jsp page.
    Any suggestion is highly appreciated.
    Thanks and Regards
    Harshal
      try {            Class.forName("oracle.jdbc.OracleDriver");            connection = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:bmltest","system","manager");            st = connection.createStatement(); String query = ""; if(find == null){ query = "SELECT A1.ITEMNAME,A1.TECHDESC, A1.ITEMCODE,SUBSTR(A1.MUNITCODE,1,3),A1.MUNITCODE FROM CMSTITEM A1,CMSTITEMGRP A2  WHERE A1.ITEMGROUPCODE=A2.ITEMGROUPCODE AND A2.ITEMCLASS='"+Iclasscode+"' ORDER BY A1.ITEMNAME ASC"; }else{ find = find.toUpperCase(); query = "SELECT A1.ITEMNAME,A1.TECHDESC, A1.ITEMCODE,SUBSTR(A1.MUNITCODE,1,3),A1.MUNITCODE FROM CMSTITEM A1,CMSTITEMGRP A2  WHERE A1.ITEMGROUPCODE=A2.ITEMGROUPCODE AND A2.ITEMCLASS='"+Iclasscode+"' ORDER BY A1.ITEMNAME ASC and A1.ITEMNAME like '%"+find+"%' OR A1.ITEMCODE like '%"+find+"%'"; } rs = st.executeQuery(query); while (rs.next()){ for (int i=1;i<=5;i++){ Itemnamedetail.add(rs.getString(i)); } } connection.close(); }catch(Exception e){ e.printStackTrace(); }                request.setAttribute("rowid",rowid); request.setAttribute("select",Itemnamedetail); RequestDispatcher view = request.getRequestDispatcher("Itemname.jsp"); view.forward(request,response); 
    and here is an jsp code
    <%@page import ="java.util.*,java.sql.*,java.text.*"%><% ArrayList<String> arr1 = (ArrayList<String>)request.getAttribute("select"); String rowid = (String)request.getAttribute("rowid"); String itmcd = "itmcd"+rowid;        String itmnm = "itmnm"+rowid;        String uom = "uom"+rowid;        String mcode = "mcode"+rowid;%>  <html><head> </head><body>  <form name = "unitsel" action = "SelectUnit" method = post><p align="center"><b>Find :    <input type = "text" id = "find" name = "find" ></p></form><table border = 2px align = "center" width = 75%> <tr> <th>Item Name</th> <th>Tech-Description</th>                <th>Item-code</th> <th>Unit-name</th>                <th>Munit-code</th> </tr> <td width = 65%><h5 align=center><%=b%></h5></td>                <td width = 35%><h5 align=center><%=c%></h5></td> <td width = 35%><h5 align=center><%=d%></h5></td> <td width = 65%><h5 align=center><%=e%></h5></td> </tr> <%j++;}%> </table> </body></html> 

    First of all you will have to apply paging to show data in tables. and retrieve only those sets of data which are required. You will defnitely need to do lot of code for that. but i am hopeful, you will get some thing on net.
    Second thing you can do is use AJAX. It will show your popup and will keep on loading data simultaneously. You can use JQuery and many others for that.

  • Basic TableUI element to Retrieve Data from DB in WEbDynPro For Java

    Hi Experts,
    I am new to WebDynPro for java.Can any body please help me out from this issue.
    I am trying to display records from DataBase by Using Table UI element.
    DBTable Contains 10 rows.
    I have created a Node and Attributes(for every column) .
    I am using JDBC code to retrieve data from database and assigning to Attributes.
    But in Table UIElement its displaying only last record from database as first row in UIElement.
    Its over writing previous rows.
    Can any body please help me the correct procedure to retrieve data from DataBase.
    Thanks and Regards,
    Shashikiran.B

    Hi,
    Iterate through the result set object
    populate the context node
    Ex:Replace the context nodeName with that of yours.
    ResultSet resultSet = stmt.getResultSet();
           //Iterate through the resultset
           while(resultSet.next())
                //Create element of the context node
               IWDNodeElement nodeElement = wdContext.nodeOrders().createElement();
               //assign value from the database to the context attribute
               //Replace attributeName with your attribute name
               //Replace value with resultSet.getShort("<ColumnName>")
               nodeElement.setAttributeValue(attributeName, value);
               //Add the element to your node
               wdContext.nodeOrders().addElement(nodeElement);
    Regards
    Ayyapparaj

  • Query to retrieve data from action infotype based on particular actiontype

    Hi folks,
    I need some help in retrieving data from infotype 0000.
    The records for a certain employee id (10035532) for action infotype are as follows.. I trying to retireve the LOA action records
       BEGDA-ENDDA-MASSN-MASSG
    1. 04/01/2008 - 12/31/9999 - Z7(RLOA) - 02(FMLA).
    2. 03/01/2008 - 03/31/2008 - ZB - 03.
    3. 02/10/2008 - 02/29/2008 - Z2 - 05
    4. 01/20/2008 - 02/09/2008  - ZB - 07
    5  01/05/2008 - 01/19/2008  - Z5(Paid LOA) - 05(FMLA)
    I have to retrieve the Z5 record for this employee. For every Z7 there is a corresponding Z5 record that links to the LOA records, in most cases the Z5 is immediately followed by Z7 record. I am able to retrieve such records successfully. However for few employees like one here the Z5 record is the fourth or fifth record down from the Z7. How can i retrieve the record in such a case?
    Also in some cases the date ranges are missing in between, in such cases can we retirieve data succesfully? For ex:
    1. 04/01/2008 - 12/31/9999 - Z7(RLOA) - 02(FMLA).
    2. 03/01/2008 - 03/31/2008 - ZB - 03.
    3. 02/10/2008 -                   - Z2 - 05
    4. 01/20/2008 -                   - ZB - 07
    5  *01/05/2008 - 01/19/2008  - Z5(Paid LOA) - 05(FMLA)
    Need some inputs on the query here.
    Thanks in advance,
    VG

    No responses. The thread is closed.
    VG

  • Data From Excel to Oracle

    Hi, how can I do a Stored Procedure or free code to import data from Excel to Oracle Table? Tanks for all.

    I never use UTL_FILE. I use Delphi and I need to make a subrotine to import xls file to oracle. So, I prefer to do into DataBase, using database resource, but I do not oracle expertise, I have some difficulties. Tanks.

  • Failure to retrieve data from the database (Vendor Code 6550)

    I am having a trouble with two of the 6 reports that I have created. I am using Crystal XI and Oracle 10g. The underlying database object is a stored procedure that accepts as input a start time as a TIMESTAMP, an end time as a TIMESTAMP and a furnace number as a number. I have a cursor ref as a return parameter.
    When I run the stored procedure in Oracle I get the selected records and can view them on the screen.
    When I refresh data on the report in Crystal XI developer, the designer asks me for the start and end time and furnace number. When I input these values the report displays properly.
    When I launch the report from my VB .NET 2005 application I am asked for the username and the password for the database (this is another problem I need to solve as this information I put into the program seems to be ignored in my program) then I receive the following failure message:
    Failure to retrieve data from the database (Vendor Code 6550)
    When I launch the other reports, they only ask me for the username and password then they display the proper data.
    The main difference between my other reports and the two that are returning the above failure code is that the other reports are to either tables or views. The two that don't work are tied to stored procedures. I there any way that I can solve this problem or at least get more information?
    Any help would be greatly appreciated. Let me know if you need any other information.

    I have a similar problem, the only difference is that the crystal report error is only thrown when I try to load the sub reports at my web application. When I deploy my report to the Web application the main report loads up fine but when I try to launch the sub reports from the main report it can no longer load.
    But when I use the Crystal report developer I am able to load the main report and it's associated sub reports without any issues.
    My issue only occurs when I try to load the sub report in the web application. The following sections shows how my reports look like both in my .NET web application and also at the Crystal Report Development IDE.
    Failure: Loading my Reports from .NET Web Application
    1) When I load from the web application I am able to load the main report as per the print screen below.
    2) When I try to click on the hyper links to enter the sub reports I am now able to load them, both sub reports cannot load and will throw the same error "
    Failed to retrieve data from the database. Details: [Database Vendor Code:
    6550 ] Failed to retrieve data from the database. Details: [Database Vendor
    Code: 6550 ] Failed to retrieve data from the database. Error in File OAWR3011A
    {CEC8A94A-4490-4640-95FB-2739A679978B}.rpt: Failed to retrieve data from the
    database. Details: [Database Vendor Code: 6550 ] "
    Success: Loading my Reports from Crystal Report Development Tool
    1) This is my Main Report Loaded from the Crystal Report Development Tool, the first two hyperlinked fields are links to my sub reports, step number 2 and number 3 shows my sub reports when I load it using Crystal Report Developer
    2) Sub Report 1 Loaded Successfully, when I click on the fields in the first link
    3) Sub Report 2 loaded successfully when I click the second field hyper link

  • MS SQL database needs to run mdx query to analysis services to retrieve data from a BPC 10 Netweaver cube(view only)

    We are in the process of migrating from BPC7 SP12 Microsoft sql server to BPC10 netweaver on a sql server with BW7.4 and need to integrate our home grown data warehouse which is on a Microsoft sql server.  The data warehouse currently connects to BPC7 using integration services/analysis services and runs mdx queries to analysis services to retrieve data from the BPC7 cube (view only).  Please provide documentation on how to create this same integration with our data warehouse using BPC10 netweaver on a sql server.

    When you were setting up your ODBC data source for
    the Text driver, did you click on the "Options"
    button? There's a lot of options in there that I
    didn't understand at first glance.Yes I clicked on the options button, but the only thing there is dealing with file extensions. I left it set to the default.
    I have since tried closing my connection after I insert a record, I then try executeQuery, but still no luck. Seems strange that I can write to the file but not read from it. If any thing I'd expect the opposite problem.
    I have also tried using the class "JoltReport" from the sun tutorial instead of my own with the same result.
    Message was edited by:
    Hentay

  • Failed to retrieve data from the database.DB Vendor Code 156

    Hi,
    We recently migrated our scheduled Crystal Reports from BO XI R2 platform to BO XI 3.1, and are having issues with select reports that pull from the same SQL database.  The tables and fields exist in the database - and I ran the SQL in a different tool and the syntax is correct.  When I try to run an on-demand or schedule one of these reports in 3.1 Infoview I receive the following error:
    Failed to retrieve data from the database. Details: [Database Vendor Code: 156 ]
    Running:
    CR 2008 SP2
    BO XI 3.1 SP2 (FP 2.7)
    Please advise!  Thanks!

    Hi LuAnn,
    Not really clear what he said but I believe this is correct. The BOE servers are typically running under the local System Account. So when it passed the report job from the BOE Server it is the Local System account that the database is getting. We only do single hop for security. Which means if you are logged into InfoView under your local domain account and try to run a report BOE will not, unless specified in the custom database connection options in the CMC, pass your credentials to the DB but will pass the local system account credentials which is likely why these reports are failing.
    As A TEST only Ask your Administrator to set up a user account in MS SQL Server that has rights to run all reports. Or when you create the report check on the option to use Trusted Authentication. Then when the reports are published to BOE your log on credentials should get passed to the DB server through BOE.
    You'll have to more testing to find a Use account that you can run BOE Servers under and still maintain DB security and report level security that works for you. I also suggest you post your security questions to the BOE Administrator forum to get help configuring all of this and what others are doing.
    Thank you
    Don

  • Failed to retrieve data from the database Database Vendor Code: 2812

    Hi everyone
    Im using Sap Business One Version 2007A SP00 PL49, SQL 2005 and Crystal Reports Basic for Sap Business One (Add on 2.0.0.7). Whenever i try to generate a report from SBO the system displays the following message "Failed to retrieve data from the database DETAILS: [Database Vendor Code: 2812]"
    The scenario is that, according to the Colombia's product local expert, Is not possible to create Stored Procedures, Views, Functions or anything in the customer productive database, in order to improve the performance of the query i created other DB where i created an stored procedure, after that, i called it from Crystal where it's working ok. But when i try to generate it from SBO it show the message promted.
    Someone knows what could be happening
    I'll be thankful

    Hi Cesar,
    Please post your question to the Business One forum.
    I can't move this thread.
    Thank you
    Don

  • Failed to retrieve data from the database. Details: [Database Vendor Code: 997 ]

    Post Author: aya
    CA Forum: Crystal Reports
    Hi I am getting following problem while launching Crystal Report
    Failed to retrieve data from the database. Details: &#91;Database Vendor Code: 997 &#93; Failed to retrieve data from the database. Details: &#91;Database Vendor Code: 997 &#93;
    The database is Oracle.
    Thanks

    Post Author: pvierheilig
    CA Forum: Crystal Reports
    Have you been able to resolve this yet?  I don't have any reference to Oracle error codes but would suspect a quick Google of something like 'Oracle error code 997' should result in good information, since it is an Oracle error...
    Hope this helps.

  • Crystal Add on Failed to retrieve data from the DB Vendor Code: 2812

    Hi everyone
    Im using Sap Business One Version 2007A SP00 PL49, SQL 2005 and Crystal Reports Basic for Sap Business One (Add on 2.0.0.7). Whenever i try to generate a report from SBO the system displays the following message "Failed to retrieve data from the database DETAILS: Database Vendor Code: 2812"
    The scenario is that, according to the Colombia's product local expert, Is not possible to create Stored Procedures, Views, Functions or anything in the customer productive database, in order to improve the performance of the query i created other DB where i created an stored procedure, after that, i called it from Crystal where it's working ok. But when i try to generate it from SBO it show the message promted.
    Someone knows what could be happening
    I'll be thankful

    Hi everyone
    My Stored Procedure contains the following code "annar.dbo.OIBT c", where Annar is the database name.
    When i execute the report in Crystal directly is working without Issues, There everything is ok, the Stored Procedure parameters, sorts, cross tab. When i try to executed it from SBO it shows the prompt error.
    The connection was OLE DB (ADO). I created an ODBC connection with the following settings
    - SQL autentication based on Id and password created by user, in this case sa
    -  "Use Identifiers between "" ANSI " and "Use Null, filled and ANSI warning " are ticked.
    - Execute character data conversion.
    Microsoft SQL Native Client Versión 09.00.1399
    Nombre del origen de datos: Bisynf
    Descripción del origen de datos: BisynfDW
    Servidor: BISYNFGER
    Usar seguridad integrada: No
    Base de datos: (Default)
    Idioma: (Default)
    Cifrado de datos: No
    Certificado de servidor de confianza: No
    Multiple Active Result Sets (MARS): No
    Realizar conversión de los datos de caracteres: Yes
    Registrar consultas de larga ejecución: No
    Estadísticas del controlador de registro: No
    Usar configuración regional: No
    Usar identificadores entrecomillados ANSI: Yes
    Usar nulos, rellenos y advertencias ANSI: Yes
    Right now with Those setting is running ok again in Crystal Reports  but when i try to execute from SBO the error has changed the error now is "connection could not be opened", Report Name in this case "Informe Stock Total" { 1D2DBDC5-41DE-43C0-A23C-391E7AEF2A37}.rpt
    Tks a lot

  • Failed to retrieve data from the database. [Database Vendor Code: 116]

    My report is using Java Bean class as datasource and the Java Bean class calls a report-specific Java program to return a result set.
    Report fails to generate and the error message is
    Failed to retrieve data from the database. Details:  [Database Vendor Code: 116 ]
    Can anyone tell me what error code 116 means?
    Thanks.

    The problem is solved internally. Our team implemented a result set data structure that incorrectly converts a Double into a String before passing it to Crystal Report for rendering. Data Vendor Code I met yesterday was the outcome of illegal class conversion.
    I have a side question;  our development team would like to use log4j to log method calls invoked during rendering. Our problem could be solved earlier if we knew getString() was invoked instead of getDouble() during rendering.  We thought of specifying the full path of log4j jar file in CRConfig.xml but we don't know how to configure CR to write logging information into a specific file location.
    Please help.
    Thanks

  • Failed to retrieve data from the database.---- Error code:-2147482925

    Hi,
    I am  getting random error while generating a PDF report in Crystal Report XI R2.
    The error details are
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException: Impossibile r
    Error in File C:\WINDOWS\TEMP\{11834722-3B8E-4DFF-B7B6-B3D52DF904C1}.rpt:
    Failed to retrieve data from the database.---- Error code:-2147482925 Error code
    name:failed
    at com.crystaldecisions.sdk.occa.report.application.PrintOutputControlle
    r.export(Unknown Source)
    at ps_emxCrystalReportUtil_mxJPOZsBymAAAAAEAAAAD.getReport(ps_emxCrystal
    ReportUtil_mxJPOZsBymAAAAAEAAAAD.java:488)
    at ps_emxCrystalReportUtil_mxJPOZsBymAAAAAEAAAAD.ps_storeReportWithoutCh
    eckin(ps_emxCrystalReportUtil_mxJPOZsBymAAAAAEAAAAD.java:183)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    Please help me.
    Thanks in advance
    -Abhi

    Not enough info.
    The exception just states there were problems retrieving data from your data source.
    Sincerely,
    Ted Ueda

  • Process and Code for writing an RFC to retrieve data from IT0006 and IT0655

    Hi,
    Can some body tell me the process and code for creating an RFC to retrieve data from IT0006 and IT0655.
    Its very urgent........
    Waiting for an early reply.....
    Many thanks

    Hello Krishna,
          The process for creating an entry in infotype is as follows.
    1.First you get the personal number lock for upating.You can use function 
        module ' BAPI_EMPLOYEE_ENQUEUE ' or ENQUEUE_EMPREL.
    2.Pass the records to function module ' HR_INFOTYPE_OPERATION' with
       OPERATION - 'INS'.
    3.Unlock the Employee by using function moule 'BAPI_EMPLOYEET_DEQUEUE'.
    Regards,
    Manoj.

Maybe you are looking for

  • Trying to add a motion path to a panel but i get errors...

    hey guys.. im trying to move a panel container from one location to another.. basically when i start off the application the panel's horizontalCenter is set to "0" what i need it to do is move from that center location to left. the code i have is...

  • RFC lookUp during Message mapping

    All    I want to get soem values from SAP table during message mapping.After getting the values am going  to do 2:1 mapping by using BPM.   Could you please let me know the basic and fundamental things about RFC look up during mapping and RFC setting

  • Comprehensible question regarding the usage of a ccBPM in SAP PI 7.31

    Hello experts, I have got basic question about the useage of ccBPM in PI 7.31 double Stack. I haven't  created any ccBPM before so the whole set up process is new for me. We are currently using several ccBPM already which where created by our colleag

  • How to change my background?

    I want to change my background and can't find it anywhere. Not the wallpaper, I found that one. I have been using the iphone since inception but I have never tried to change the background. I was looking at the new ios 4 pictures and thought it would

  • Programatically knowing mode of Form

    Hi, How can I programatically find out whether my form is running in Query only mode in Forms 5.0 / 6.0 ? Thanx in advance. --- Ravi null