Problem in connecting to database from webdynpro for java

Hi
I have a problem in connecting to database from webdynpro application
I am using oracle 10 express edition as database and was able to connect to database from a java application.But  was unable to connect from a webdynpro for java.
<b>I guess webdynpro for java uses open sql instead of vendor sql(I looked in the visual admin ,DB is using open sql) so unable to connect to database.Am i right.?</b>
Do i need to make any settings in the visual admin to make it work?
How to solve this problem.Please give me pointers
Thanks
Bala

Hi,
For connecting to Oracle, either you can use the normal JDBC connectivty code directly which is given below :
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@Oracle_server_ip:Oracle port:SID of the Database","user_name","password");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("your query");
In case you want to fetch data through ejbs, these are the steps to be followed :
1) Open the J2EE perspective
2) Create an EJB Module project
3) Right click on ejbModule, create a new EJB (select your EJB type)
4) While creating the ejb itself, you can add business methods by clicking ‘Next’ in the UI. Another option is after creating the ejb, write the method in the bean, then select the method from ejb-jar.xml -> <bean name> ->method. Right click and select ‘propogate to local & remote’.
5) Double click on ejb-j2ee-engine.xml. select your bean and specify a Jndi name for eg: “MyJndi”.
6) Right click on the EJB project and add ‘classes12.zip’ file (provided by Oracle) to it’s build path. (under libraries tab). Also check the same file under ‘Order & Export’.
7) Create an Enterprise Application project.
8) Right click on the EJB module project and select add to EAR project, then select the created EAR project.
9) Right click on the EJB project, select ‘Build EJB Archive’
10) Right click on the EAR project, select ‘Build Application Archive’
11) Open the WebDynpro perspective, open a new project, right click on the project ->properties. Do the following configurations :-
• Java Build path - select the EJB project from ‘projects’ , check the selected project under ‘Order & Export’
• Project references – select the EAR project
• WebDynpro references – select ‘sharing references’ tab, click add & make an entry as : <vendor>/<EAR project name without .ear extension>
You can find the vendor name under ‘application-j2ee-engine.xml’ file of the EAR project. By default it is ‘sap.com’. So if my EAR project’s name is ABC, my entry would look like ‘sap.com/ABC’
12) Now the configurations are over and the EJB can be invoked by writing the client code inside the webdynpro component. Like:
InitialContext context = new InitialContext();
Object obj = context.lookup("MyJndi");
MyEJBHome home = MyEJBHome)PortableRemoteObject.narrow(obj,MyEJBHome.class);
MyEJB mybean = home.create();
int a = 0;
a= mybean.add(10,15);
wdContext.currentContextElement().setSum(a);
where ‘MyEJB’ is my EJB name and ‘MyJndi’ is my JNDI name
To connect to Oracle , you can write the usual Java code (given below) as a business methos of the ejb (similar to add() method in the example). And access it like mybean.<businessMethodName>().
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@Oracle_server_ip:Oracle port:SID of the Database","user_name","password");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("your query");
Extracted from Re: Webdynpro and Oracle
http://help.sap.com/saphelp_webas630/helpdata/en/b0/6e62f30cbe9e44977c78dbdc7a6b27/frameset.htm
May be of use to understand the VA Conf /people/varadharajan.krishnasamy/blog/2007/02/27/configuring-jdbc-connector-service-to-perform-database-lookups
Regards
Ayyapparaj

Similar Messages

  • How to access(connect) BI Data in webdynpro for java applications

    Hi ,
    is there any way to access and display the BI data in portal using webdynpro for java applications like we did in Visual composer.
    if not how to integrate the BI data in webdynpro applications ?
    Regards,
    Govindu

    Hi,
    Yes there are ways to do it. But may your scenario and the scenario for which I have done may differ.
    You can use openhub to get the data in a flat file and then read it into weddynpro through a java service OR
    You can use DBlink(which i have done).
    Please refer the link below:
    [Link|Data from BW to Oracle.;
    This I have done in NW04s. Not sure whether a better solution is available in the newer release.
    Hope it helps.
    Regards,
    Manoj

  • Problem in Uploading excel file using WebDynpro for Java

    Hi  All
    I have followed for Uploading excel file using WebDynpro for Java added by  Tulasi Palnati
    I done all, but I'm getting 500 Exception please contact u r system admin meag  at run time also  Jxl/Workbook class not found msag  but i downloaded Jxl.jar file and  there is no error signals  in coding part. How can I solve the Problem.
    Thanks
    Polaka

    Please ask the people in the Web Dynpro Java forum for a solution.

  • SSO-Logon from mobile device - create logon ticket from WebDynpro for Java

    Hi Experts,
    I'm developing WebDynpro-JAVA application for some warehouse stuff  (runs on a portal system, clients are mobile barcode-scanners with Windows mobile 5.0). JCOs from the portal system to the R/3-backend are confirgured for SSO with Logon-tickets and portal uses LDAP for authentication against a Windows-ADS.
    This works so far ... but my problem is the standard Logon-screen, which is nearly unusable on the mobile device (screen size, layout, etc.). Is there any solution to create logon-tickets directly from the WebDynpro application (using something from com.sap.engine.interfaces.security.auth or similar ?) or any chance to have a special logon screen for mobile devices (parameter sap-wd-client=Pie03Client is ignored for the logon screen).
    Thanks in advance.
    regards,
    Hendrik

    Hi Henrik,
    Did you find the solution to your problem ?
    I'm facing the same issue, so I'd be pleased to know the solution!
    Regards
    Stekam

  • Calling XI's SOAP Adapter from Webdynpro for java

    Hello every one,
    I have implemented a webservice scenario which involves soap message exchange,,I have checked the configuration from configuration tool -- it seems fine there -- than we had a check run from XML spy, using the WSDL generated by XI,,, that went through as well,, but now when I am trying to call the webservice through webservice adaptive model in NWDS, it returns :
    <!--  Receiver Identification
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="RCVR_DETERMINATION">NO_RECEIVER_CASE_BE</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:ApplicationFaultMessage namespace="" />
      <SAP:Stack>No receiver could be determined</SAP:Stack>
      <SAP:Retry>N</SAP:Retry>
      </SAP:Error>
    this is the response message generated and viewed in SXMB_MONI
    Now I cannot understand why its prompting error from application and not XML Spy,,
    I am using following url to send msg to XI's SOAP sender adapter:
    http://pep:8000/sap/xi/engine?type=entry&version=3.0&Sender.Service=BS_PROTOTYPE_WS_OUT&Interface=urn%3Apso%3Aws%3Abank%5ECC_CHK_ACC_SENDER&sap-user=<myuser>&sap-password=<myPwd>&sap-client=001&sap-language=EN
    any help would be highly appreciative..
    thanks

    Dear Nicholas,
    When portal server is installed, it assigns a specific port for running the portal. Normally the port is 500XX when xx is your instance number. There seems to be some problem in your case.
    Please carry out following steps to see/resolve the issue:
    1. Open the visual administrator
    2. Navigate to  Dispatcher -> Services -> HTTP Provider
    This HTTP Provider specifies the ports used by portal.
    You change the ports to something like : (Port:80,Type:http)(Port:443,Type:ssl)
    Save your settings and now open the browser and open the portal like http://<host>/irj/portal (because 80 is default port). If you specify some other port you need to enter like http://<host>:<port>/irj/portal
    This should resolve your issue:
    Enjoy
    Best Regards,
    Ravi

  • PDF generation from Webdynpro for java application

    Hi all,
    I have a scenario in which a PDF has to be generated from the datils present in a table in the same view, on click of a button. I have found many solutions for generating interactive forms but I need to generate it from the code directly. I have also found an application for generating an excel sheet from the table  data but it is not working with PDF.
    So anybody suggest me how to do it or please refer any applications that have been done.
    Thanks in advance.

    Hi marco,
    Sorry for the late reply.
    I have got an application to generate an excel file and i will paste that code here for your reference.
        byte[] excelXMLFile;
        IWDCachedWebResource cachedExcelResource = null;
        String fileName = dataNode.getNodeInfo().getName() + ".xls";
        try {
          // create Excel 2003 XML data as a byte array for the given context node, attributes and headers       
          excelXMLFile = this.toExcel(dataNode, columnInfos).getBytes("UTF-8");
          // create a cached Web Dynpro XLS Resource for the given byte array and filename
          cachedExcelResource = this.getCachedWebResource(excelXMLFile, fileName, WDWebResourceType.XLS);
          // Store URL and filename of cached excel resource in context.
          if (cachedExcelResource != null) {
            wdContext.currentContextElement().setExcelFileURL(cachedExcelResource.getURL());
            wdContext.currentContextElement().setExcelFileName(cachedExcelResource.getResourceName());
            // Open popup window with a link to the cached excel file web resource.
            this.openExcelLinkPopup();
          } else {
            wdComponentAPI.getMessageManager().reportException("Failed to create Excel file from table!", true);
        } catch (UnsupportedEncodingException e) {
          wdComponentAPI.getMessageManager().reportException(e.getLocalizedMessage(), true);
        } catch (WDURLException e) {
          wdComponentAPI.getMessageManager().reportException(e.getLocalizedMessage(), true);
    In the above code "excelXMLFile" is a byte array in which the data that has to be appended to the pdf (in xml format) is present.
    the toExcel method is used to convert the data in the table(i.e., the data that gets populated in the nodes of the view) in to XML format.
    My Problem is when i change the filename to .pdf extension and the WDWebResourceType.XLS to WDWebResourceType.PDF and execute the application the Acrobat reader is getting opened but it says
    "unsupported file type or the file has been damaged" .
    I mean i am unable to put data into the file.
    So, please help me in this regard.

  • How to connect to BAPIS Using webdynpro for java?

    Hi guys ,
    I am new to sap world . Can any body give overview how to
    connect BAPIS FUNCTION MODULES using   in webdynpro?

    Hi Ramana,
    Welcome to SAP world.
    You have lot of tutorials at SDN on the using BAPI's in WebDynpro.
    Please go through this link and follow the tutorial :
    https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/f0b0e990-0201-0010-cc96-d7ecd2e51715
    Make sure you configure your SLD and create JCO connections which is also given in the above link.
    Also go through the following link.
    http://help.sap.com/saphelp_erp2005vp/helpdata/en/41/38bc8f813719488ddc9d9b21251ec3/frameset.htm
    Do get back incase u need further explanation.
    All the best.
    Thanks & Regards,
    Vijith

  • Problems between Xcelsius and WebDynpro for Java

    How should I do to show Xcelsius in WebDynpro for Java?
    How should I transport data between Xcelsius and WebDynpro?
    How should I control WebDynpro with Xcelsius?For example,firing plugs in Xcelsius like in WebDynpro to change one view to another.
    How should I do to execute a Java method in Xcelsius?For example,scheduling a job on clicking a button in Xcelsius.
    Besides these,I also want to know the same problems between other BOE contents and WebDynpro for Java.
    Regards,
    Abe

    Hi Pradeep:
    Well that purely depends on the business application (project) your client is proposing. Following are very few factors which will drive for creating web-based applications:
    VC: it's a UI modeling tool (non-programming) for creating rapid creation of web-based applications.
    WD: its a powered by Java and ABAP with which you can create robust business applications.
    If your client is very choosy about rapid application development, reporting, rich user interface, to reduce TCO then VC is the choice. Or if the project contains typical integration with SAP and non-SAP systems, complex business logic development, integration with WCM systems...etc then WDJ is the option.
    If you’ve some sort of custom development with facilitating the Development Infrastructure (NWDI) then WDJ is the only option I could say.
    We hope with NW CE 7.1.1(referred by Priyanka Singh) tighter integration between these TWO tools may over come the ambiguity of using them.
    Tnx,
    MS

  • Is WebDynpro for Java going away?

    Hi,
    Is SAP planning to completely Switch from Webdynpro for java to webdynpro ABAP? What is the future for Webdynpro for java in that case? Like old ITS technology will SAP completely remove support for WebDynpro for Java development!
    With Regards,
    Nitesh Shelar

    Please refer ht[WD for Java going away??|WD for Java going away??]

  • How to invoke Workflow and UWL through Webdynpro for Java

    Hi,
    In my Development Component there are three applications .The requirement is that the data will flow between one application to another only through workflow in
    UWL.
    Can anybody help me out as to how to invoke workflow programatically from Webdynpro for Java .
    After data goes from one application to workflow UWL, how the second application will work on it . If possible please send me the links of some tutorials .
    I searched in Webdynpro Tutorials site but there are no tutorials available there .
    Thanks a lot .

    Hi,
    Check the following Threads,U will get lot of details......
    WebDynpro application that can work with SAP workflow work items?
    /thread/142477 [original link is broken]
    Configuring UWL with WebDynpro
    /people/niharika.jeena/blog/2006/06/06/launching-webdynpro-from-universal-worklist
    Sample Application,
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/how%20to%20configure%20the%20universal%20worklist.pdf

  • When connect the Database from Toad , Sqlplus giving the error

    when connect the Database from Toad , Sqlplus giving the error
    recent changes 12.1.1 installatiojn
    Oracle SQL plus encountered a problem and needs to close we are sorry for convenienvce
    Oracle Forms Designner has encountered a probloem and needs to close we are sorry for the convenience
    Thanks & Regards,
    sree

    when connect the Database from Toad , Sqlplus giving the error recent changes 12.1.1 installatiojnHave you tried using the same user via simple sqlplus on the database server or apps tier server itself? Please try the same database user/login on the database server using the sqlplus available on the server itself. See what message do you get. If the the login happens, then try with the tns entry e.g. sqlplus username/password@prod and see if that works on the db server. If both of these conditions work the check where is Toad picking up the tns entry from on the client pc/laptop. If first test fails, then check if the account is locked.
    Hope this helps.

  • How connect to database from javascript

    Hello friends
    This is sudhakar, working as a developer in indian based company, present we are developing one web based application for this purpose i am creating one dynamic menu.
    my problem is:
    how can i connect to the database from javascript, for this purpose is there any configuration please reply and also send me sample code on for creating dynamic menus depending on the database values using javascript
    regards.
    sudhakar
    [email protected]

    Copy the code in to new HTML File then open the file with IE
    <html>
    <SCRIPT LANGUAGE=javascript>
    <!--
    function ConDB()
         var conn = new ActiveXObject("ADODB.Connection") ;
         var connectionstring="Provider=SQLOLEDB;Password=;User ID=;Initial Catalog=;Data Source=;"
         conn.Open(connectionstring);
         var rs = new ActiveXObject("ADODB.Recordset");
         rs.Open("SELECT * FROM YourTablename ", conn);
         rs.MoveFirst
         while(!rs.eof)
         document.write( yourtablefieldname);
         rs.movenext;
         rs.close;
         conn.close;
    }       //-->
    </SCRIPT>
    <body OnLoad="javascript:ConDB()"></body>
    </html>

  • Adobe Interactive forms & WebDynpro for java problem with IE7 and IE8

    I have Interactive form ui-element in WebDynpro for java (ver. 7 SP 10) application. It works fine with IE6, but in IE7 (or IE8) it doesn't show that ui-element at all. We have tried to change IE7 security & advanced settings, but we have not made any progress. We have also tried to install/uninstall different Adobe reader versions etc.

    I know a little more about the problem now. After viewing the XML source I change the property of the inputfield.
    It was like this:
                <field name="verdipers_felt" y="130.7001mm" x="180.1801mm" w="101.6004mm" h="44.4501mm" locale="no_NO" access="ReadOnly">
    but i changed the access to be nonInteractive
                <field name="verdipers_felt" y="130.7001mm" x="180.1801mm" w="101.6004mm" h="44.4501mm" locale="no_NO" access="nonInteractive">
    now view2 shows the linebreak as in view1... Buut! when im going back to view1 from view2, the linebreaks gets converted into spaces
    thats pretty wierd, aint it?

  • 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

  • Not able to connect RAC database from client

    Hi there
    Recently I have configured RAC in test environment. version 11.2.0.1. OS Redhat 5.9. Everything seems to be fine except not able to connect rac database from client.  Error is as under :
    C:\Documents and Settings\pbl>sqlplus test1/test1@myrac
    SQL*Plus: Release 10.2.0.1.0 - Production on Mon Nov 17 14:29:06 2014
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    ERROR:
    ORA-12545: Connect failed because target host or object does not exist
    Enter user-name:
    myrac =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))
        (CONNECT_DATA =
          (SERVICE_NAME = racdb.testdb.com.bd)
    Please give me your valuable suggestion to  overcome the issue.
    Regards
    Jewel

    user13134974 wrote:
    ORA-12545: Connect failed because target host or object does not exist
    This error means that the hostname or IP address used in the TNS connection string, failed to resolve or connect.
    Your client is making two connections. The first connection is to the SCAN listener. It matches a db instance for your connection request based on service requested, available registered service handlers, load balancing, and so on. It then send a redirect to your client informing it of the handler for that service.
    Your client then does a second connection to this service (a local RAC listener that will provide you with a connection to the local RAC instance). This is what seems to be failing in your case.
    The SCAN listener's redirect uses the hostname of the server that the local listener is running on. Your client needs to resolve that hostname (of a RAC node) to an IP address. This likely fails.
    You can add the RAC node hostnames to your client platforms hosts file. The appropriate action however would be to ensure that DNS is used for name resolution instead.

Maybe you are looking for

  • Error while downloading data from internal table into XML file

    hi all, i developed a program to download data from into internal table to xml file like this. tables: mara. parameters: p_matnr like mara-matnr. data: begin of itab_mara occurs 0,             matnr like mara-matnr,             ernam like mara-ernam,

  • When Photoshop CS6 is invoked from PSE 11 Organizer why is a new file created with _edited-1 appende

    I just converted a large PSE 10 catalog to work with a downloaded trial version of PSE 11.  When I brought up the Organizer and clicked on the Editor button I selected Photoshop CS 6.  At that point the Organizer created an image stack with a new fil

  • Anyone had refund problems?

    Anyone else had a problem with getting refunds? I had 2 defect jetpacks and returned them but got charged. They traced them...they have one and the other one has been repaired and sent to another customer.....but still it is charged to my account say

  • Complex xml in tree control

    every example you see online is trivial and utterly useless for practical programming purposes...typically you'll see something like this: <mx:XML format="e4x" id="myMenuModel"> <root label="Menu"> <menuitem label="MenuItem A"> <menuitem label="SubMe

  • Call rules from PL/SQL

    Hi, I have ruleset and it being called by RL function. Is it possible that I can call that rules or rule function from PL/SQL, if yes could you please help me with some ideas. (without involving BPEL) Thanks Sreejit