Accessing  database using EJBs in WebDynpro

Im using EJBs to access database...data is getting stored in the database...but i dnt know how to retrieve it...webDynpro is a totally new environment for me..it would be a great help if someone can help me solve my problem...
regards,
Sonal

- start with "import JavaBean model" (importing model)
- put model in Used Models
- bind model with controller (web dynpro components-> double click on <application name>
- bind view with controller (same vindow)
- apply template (table for reading data) in view
and you are redy for start.
Eq
your EJB is MyEJB, and there is some function myFunction() with Vector as return (Vector contains MyEJB objects)
now in controller put (eq in wdDoInit())
MyEJB myObject = new MyEJB()
wdContext.current<NodeName>.bind(myObject.myFunction());
good luck

Similar Messages

  • How do I open a pdf stored in a Microsoft Access database using Visual Basic studios 2012

    Currently I am unable to find a valid method of being able to open a pdf stored in a Microsoft Access database using Visual Basic studios 2012. I've tried displaying the entire database on a form, but when I do this all the other columns show up with
    the correct data besides the one containing the pdf's, it just displays <binary data> in each row down the column. I also tried another method with which you use the database as a dataset and can drag and drop the rows and columns into the form, which
    again works for all the other columns besides the one containing the pdf's but this time I'm unable to interact with the column  at all. 
    Not too sure if this is in the correct place, but any answers or help would be appreciated. Cheers.

    Alex,
    This forum is dedicated to Project and Project Server. You might get better response, if you post to a Visual Basic forum. Here are couple I could find. 
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral%2Cvblanguage&filter=alltypes&sort=lastpostdesc
    Cheers,
    Prasanna Adavi, Project MVP
    Blog:
      Podcast:
       Twitter:   
    LinkedIn:
      

  • Setting System DSN for MS Access Database using Java Code

    How to set the system DSN for Access database using Java Code at runtime....???
    Replies are deeply appreciated...

    I found a 3rd Party MS Access JDBC Driver from a Google search. I downloaded and tried the free trial version. It worked fine but we opted not to purchase the full version and went a different route. If you don't find it, let me know and I'll see if I can track down the name of the product we tested.

  • Integrate 300 MS Access Databases using ODI

    Hi All,
    I am trying to integrate data between 300 similar MS Access databases using ODI. All the source databases have exactly the same data structures. I have done a POC for 3 databases by creating interfaces and could integrate the data between them successfully.
    Now that the project is approved ; Going forward I need to integrate data from 297 MS Access databases, so I need to run the same set of Interfaces on 297 source MS Access Databases with Target DB being the same.
    This integartion work could be labourious as I need to copy 7 interfaces on 297 databases - IS THERE ANY EASY SOLUTION FOR THIS PROBLEM.
    Some one suggested me to use Dynamic Variables in the TOPOLOGY to access all the MS Access databases - BUT NOT SURE IF THAT WORKS.
    APPRECIATE your suggestions.
    Thanks & Regards
    Kay

    The issue you face here is that the Access database is connected to through the JDBC-ODBC bridge to the Access ODBC database driver. You will need to have a separate DSN defined for each of the access databases, if you want to address each individually.
    An alternative approach is to have one DSN set up, one entry in ODI's topology, one interface etc, and each file you wish to use, you rename to a given name first. Thus, when ODI tries to access the database, the ODBC driver finds the then current file. Note that ODI keeps the database connection for the duration of a SESSION, so if you wanted to process all 300 files sequentially, then you would need to run separate sessions for each of the file executions.
    I think this will give you the solution you require without resorting to variables.

  • How to Retrive data from db using EJB in WebDynpro

    hi...
    i m using EJB's for backend connection in WebDynpro .in which i m able to store data in sapdb .for this i followed one tutorial which i have mentioned bellow which works perfectly.Now in the same Tutorial i want to retrive the data from database and disply it in WebDynpro
    i .e i want to disply bonus when i give ssn no and also i want to disply all data in db.
    Please help me as i m totaly new to this environment and also first time i m working on EJB.its very urgent
    Thanks and Regards
    Sonal<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c</a>

    hi...
    i m using EJB's for backend connection in WebDynpro .in which i m able to store data in sapdb .for this i followed one tutorial which i have mentioned bellow which works perfectly.Now in the same Tutorial i want to retrive the data from database and disply it in WebDynpro
    i .e i want to disply bonus when i give ssn no and also i want to disply all data in db.
    Please help me as i m totaly new to this environment and also first time i m working on EJB.its very urgent
    Thanks and Regards
    Sonal<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1f5f3366-0401-0010-d6b0-e85a49e93a5c</a>

  • Uploading images in access database using jsp

    Hi, am using jsp with access database and want to upload as in a profile picture for any profile on the site[i mean depending on the user's convenience] ..
    I just have a code which helps select the image from the client's machine n gets its address..but then how to use it in a form or something so that it can be submitted and inserted in the database?
    Any idea? I d prefer not using servelet.. but if it just cannot be done without servelet then ok can suggest with that too.
    Here is the code of Browsing to obtain the picture:
    <form name=uploadForm action="uploadpic.jsp" method=post enctype="multipart/form-data" >     <input type="file" > <input type="submit" name="submit"  />     </form>

    silversurface wrote:
    Hi, am using jsp with access database and want to upload as in a profile picture for any profile on the site[i mean depending on the user's convenience] ..
    bad. Don't put business logic in JSP, and that includes accessing databases.
    Any idea? I d prefer not using servelet.. but if it just cannot be done without servelet then ok can suggest with that too.
    Don't put business logic in JSP. That's what servlets are for (and EJB).

  • Use EJBs in Webdynpro

    Dear All,
    We have the following scenareio to be achieved,
    Use Database of the WAS Java engine and table creation using NWDS. - this can be done using data dictionary
    Use EJBs Data Updation - we have created a EJB project. One ear project which can be deployed to j2ee engine.
    In webdynpro we can able to create a java bean model. But when try execute this applicaiton, it leads to null pointer exception.
    Any idea what could be the reason for this.
    Thanks,

    Thanks for your immediate reply.
    Sharing reference: sap.com/QuickCarRentalEar.
    Finished with warnings: development component 'Frames'/'local'/'LOKAL'/'0.2008.06.12.18.12.16'/'0':Caught exception during application startup from SAP J2EE Engine's deploy service:java.rmi.RemoteException: Error occurred while starting application local/Frames and wait. Reason: Clusterwide exception: server ID 13390350:com.sap.engine.services.deploy.container.DeploymentException: Clusterwide exception: Failed to prepare application ''local/Frames'' for startup. Reason=Clusterwide exception: Failed to start application ''local/Frames'': The referenced application ''sap.com/QucikCarRentalEar' can''t be started. Check the causing exception for details. Hint: Is the referenced application deployed correctly on the server?
    Any inputs?...
    Can any one throw some lights on internally how this webdynpro calls ejb and process completes.
    Thanks..

  • Connect to a remote MS Access database using RmiJdbc

    Hello,
    I want to access a remote MS Access database from oracle stored procedures.
    Does anyone know how i can load the RmiJdbc driver using the loadjava command or with any other way.
    Because when i try to load RmiJdbc.zip using the loadjava command I am getting the error:
    ORA-29533:attempt to overwrite class or resource string while defining or compiling scott.TestClient
    this error is occured for multiple files...
    I don't know how to delete this classes.
    Because this error occured and the first time i tried to load Rmijdbc driver.
    and when i use the dropjava command to drop it,and then load it again the same error occures.
    Can anyone help me how to load this driver?
    Please answer because i need it as soon as possible.
    Thanks

    Hi,
    try this.
    String s = "UPDATE AGENT SET afname='test',alname='u',city='d',AGENT.[percent]=1 WHERE aid=23";
    -------->AGENT.[percent]

  • Creating a new access database using JDBC

    Hi Forum,
    I have a problem in hand. Let me describe the problem:
    I want to create an "access database" from java at runtime. "Access database" is file based, so for a database named test, it will have a file test.mdb.
    Now, everything's sweet and wonderful, if somebody creates an "empty access database" at the client machine and i then connect to it and create the tables i require.
    But the issue is i want to create the database at runtime (the database name and tables are determined at runtime).
    Using the JDBC:ODBC bridge driver , i am able to connect to an existing database, but any "create database" statements are not supported.
    A last ditch solution would be that i create an empty database using access and copy the file contents in the SQL server database as a a blob object. Then when i want to create a new access database at runtime, i create a file in a particular folder , with an .mdb
    extension, copy the file contents from the SQL server (i also have an SQL server connection) BLOB object, and then try to connect to the
    .mdb file.
    But this approach seems a "quick hack" and can have problems (which i can't see as of now).
    Can you suggest a better alternative for the problem.
    See the Java Sun forum at this address for a discussion of a similar problem, but sadly with no solution.
    http://forum.java.sun.com/thread.jspa?forumID=31&threadID=484731

    I have an applet that was previously connected to Oracle 9i. I am faced with connecting to MS Access temporarily for testing purposes.
    I have been unable to successfully code connection in java. I have set up the DSN and can access in SQL Worksheet in JDev.
    I saw your question regarding creating an access db, and thought you might be so kind as to help me code the connection to access!!!!
    Any help you could provide would be greatly appreciated. I have a huge application to finish with alot of sqlj already completed. Connectivity is not my area of expertise!
    Any help you could provide would be greatly appreciated!!!
    I am not sure if I have to use bridge? Am I progressing in right direction to migrating to SQL Server if need be?

  • Remote access database using EM Database Control Console

    When I install the Oracle database 10g, it gives me two choices:
    1)Using Grid Control for Database Management and
    2)Using Database Control for Database Management.
    When I select the #2, according to the Guide, I'll be able to manage my database locally. (Assume the database server's IP address is: DB_IP_Address, then I can use: http://DB_IP_Address:5560/em). But wait a minute___
    a)What does this "locally" mean? If the Oracle DB is installed in a remote location, and there is no LAN connection to it, can I still access it via the Oracle Enterprise Manager (Database Control Console)? (i.e., via the HTTP protocol)
    b)The same question is asked for the iSQL*Plus in regarding to the remote access. I guess the answer to a) above will automatically answer the b) ? (Actually I doubt that I can access remote database using the iSQL*Plus via HTTP protocol).
    Thanks
    Scott

    Hi,
    and there is no LAN connection to itWell you'll need some network link in order to connect successfully.
    What is meant by locally is that you can only manage databases installed on the local computer.
    For example if you installed it on machine "CPTR1", and on another machine "CPTR2", then you can't use http://cptr1:5560/em to manage the databases on "CPTR2. And vice versa.
    About iSQL*Plus, in fact, as far as the tns alias is ok from "CPTR1", you can connect to the databases on "CPTR2", "CPTR3", ....
    HTH,
    Yoann.

  • Updating a database using EJB Inheritance

    I am new to EJB's, so please forgive my ignorance. I creating the following classes that inherit from each other along with a method to update my database:
    @Entity
    @Inheritance(strategy = InheritanceType.JOINED)
    @DiscriminatorColumn(name="TYPE", discriminatorType=DiscriminatorType.STRING)
    public abstract class ObjectA implements java.io.Serializable {
         protected String name;
         protected String desc;
         protected String type;
    @Entity
    @DiscriminatorValue("OBJECTB")
    public class ObjectB extends ObjectA implements java.io.Serializable {
         protected String str_b;
         public ObjectB(String name, String desc, String type, String str_b) {
              this.name = name;
              this.desc = desc;
              this.type = type;
              this.str_b = str_b;
    @Entity
    @DiscriminatorValue("OBJECTC")
    public class ObjectC extends ObjectB implements java.io.Serializable {
         private String str_c;
         public ObjectC(String name, String desc, String type, String str_b, String str_c) {
              this.name = name;
              this.desc = desc;
              this.type = type;
              this.str_b = str_b;
              this.str_c = str_c;
    public class MyFacade implements ServletContextListener {
         @PersistenceUnit(unitName="Pu")
        private EntityManagerFactory emf;
        @Resource
        private UserTransaction utx;
        public MyFacade() { }
        public void contextDestroyed(ServletContextEvent sce) {
            if (emf.isOpen()) emf.close();
        public void contextInitialized(ServletContextEvent sce) {
            ServletContext context = sce.getServletContext();
            context.setAttribute("MyFacade", this);
         public void updateObject(ObjectA obj) {
            EntityManager em = emf.createEntityManager();
            try{
                utx.begin();
                em.merge(obj);
                utx.commit();
            } catch(Exception exe){
                try {
                    utx.rollback();
                } catch (Exception e) {}
                throw new RuntimeException("Error updating obj", exe);
            } finally {
                em.close();
    }If I do the following:
         String name = "test name";
         String desc = "updating object c";
         String type = "OBJECTC";
         String b = "b";
         String c = "c";
         MyFacade myf = new MyFacade();
         ObjectC objC = new ObjectC(name, desc, type, b, c);
         myf.updateObject(objC);
         .....In my database, only the values associated with ObjectC get updated and nothing from ObjectA or ObjectB get updated in the database. Does the "merge" method not work on inheritance. How do I update my database using inheritance?
    Thanks!
    Message was edited by:
    FourierXForm

    did you only have ISQL for testing it?
    Can you debug the form and look, if someone happens - exceptions, ... ?
    after the update you can use
    message (SQL%ROWCOUNT); pause ;
    to look, how many records were updated

  • How to insert date into ms access database using sql query in servlet

    sir all thing is working well now only tell me how we can insert date into ms access database which is input by user .
    insert into db2(bookname,studentname,date) values('"+bname+"','"+sname+"',date_format)";{code}
    or either the system date is inserted with query .
      plz help me
    thanx                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    bhavishya wrote:
    sir all thing is working well now only tell me how we can insert date into ms access database which is input by user .
    insert into db2(bookname,studentname,date) values('"+bname+"','"+sname+"',date_format)";{code}
    or either the system date is inserted with query .
    plz help me
    thanxAnd that SQL statement is another reason to use PreparedStatement. I assume bname and sname are input from some form? Well, if that's the case, simply inserting them into SQL by simple String concatenation is just begging for all sorts of problems. What if there is an apostrophe in the entry? Broken Statement. Worse, it's a wide open invitation to an SQL Injection attack.

  • How to connect my access database using applet?

    hi all,
    i need to connect my access database in my applet program which should work like an atm machine..I dont know how to connect it. Im new to applet same thing in JDBC application. Please help i terribly need it, our deadline in our case study is fast approaching and i still dont know how to do it. I tried the tutorial but i received some sql exception error. thanks!

    Try this link
    http://java.sun.com/docs/books/tutorial/jdbc/basics/

  • Access database using Java from HTML webpage

    Hi,
    I've got to create some online maths tests to be taken by students with their marks being stored in a database.
    I've wrote some simple java code which can add/remove and modify entries in a test mySQL database that I made. What I now need to do is be able to add entries to the database from a html page.
    The math tests will be java applets with the students having to interact according to questions, press submit and their score will be output. The score will then be entered into the database.
    The problem I'm having is that with an Applet their are all sorts of security issues (I'm having problems getting images to load in an Applet) so assume I'll face the same security issues when I try to access a database through an applet.
    So, could someone please help get started.
    Cheers

    MVC - I assume you mean model-view-control and not Marvel vs Capcom :)
    If so then does this mean I should completely seperate the user interface (the actual applets that will contain the test), the database (that will store the results) and the link between the two?
    is it possible to acheive this using Java, Java Applets, Java Script and the database (in my case mySQL) and could you give me some tips on how best to tackle the problem.
    Thanks

  • Problem in accessing database using a java class

    Hy Folks,
    I have written a class to retrive data from data base and compiled it.when I said java QueryExample, I am getting the following error message.It is as below.
    E:\>java QueryExample
    Loading JDBC Driver -> oracle.jdbc.driver.OracleDriver
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:120)
    at QueryExample.<init>(QueryExample.java:37)
    at QueryExample.main(QueryExample.java:129)
    Creating Statement...
    Exception in thread "main" java.lang.NullPointerException
    at QueryExample.performQuery(QueryExample.java:70)
    at QueryExample.main(QueryExample.java:130)
    Now my question is can I run a jdbc program with out using any application server or webserver.
    If I can , what are all the packeages I have to down load, and how to set their classpath.
    Regards,
    Olive.

    My basic doubght is can we write a class like this.Here I give the sample code that I am using,,,, and using Oracle9i for Windows release 2 (9.2) .
    // QueryExample.java
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    * The following class provides an example of using JDBC to perform a simple
    * query from an Oracle database.
    public class QueryExample {
    final static String driverClass = "oracle.jdbc.driver.OracleDriver";
    final static String connectionURL = "jdbc:oracle:thin:@localhost:1521:O920NT";
    final static String userID = "scott";
    final static String userPassword = "tiger";
    Connection con = null;
    * Construct a QueryExample object. This constructor will create an Oracle
    * database connection.
    public QueryExample() {
    try {
    System.out.print(" Loading JDBC Driver -> " + driverClass + "\n");
    Class.forName(driverClass).newInstance();
    System.out.print(" Connecting to -> " + connectionURL + "\n");
    this.con = DriverManager.getConnection(connectionURL, userID, userPassword);
    System.out.print(" Connected as -> " + userID + "\n");
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    } catch (InstantiationException e) {
    e.printStackTrace();
    } catch (IllegalAccessException e) {
    e.printStackTrace();
    } catch (SQLException e) {
    e.printStackTrace();
    * Method to perform a simply query from the "emp" table.
    public void performQuery() {
    Statement stmt = null;
    ResultSet rset = null;
    String queryString = "SELECT name, date_of_hire, monthly_salary " +
    "FROM emp " +
    "ORDER BY name";
    try {
    System.out.print(" Creating Statement...\n");
    stmt = con.createStatement ();
    System.out.print(" Opening ResultsSet...\n");
    rset = stmt.executeQuery(queryString);
    int counter = 0;
    while (rset.next()) {
    System.out.println();
    System.out.println(" Row [" + ++counter + "]");
    System.out.println(" ---------------------");
    System.out.println(" Name -> " + rset.getString(1));
    System.out.println(" Date of Hire -> " + rset.getString(2));
    System.out.println(" Monthly Salary -> " + rset.getFloat(3));
    System.out.println();
    System.out.print(" Closing ResultSet...\n");
    rset.close();
    System.out.print(" Closing Statement...\n");
    stmt.close();
    } catch (SQLException e) {
    e.printStackTrace();
    * Close down Oracle connection.
    public void closeConnection() {
    try {
    System.out.print(" Closing Connection...\n");
    con.close();
    } catch (SQLException e) {
    e.printStackTrace();
    * Sole entry point to the class and application.
    * @param args Array of String arguments.
    * @exception java.lang.InterruptedException
    * Thrown from the Thread class.
    public static void main(String[] args)
    throws java.lang.InterruptedException {
    QueryExample qe = new QueryExample();
    qe.performQuery();
    qe.closeConnection();
    }

Maybe you are looking for