How to query a sql database table from webdynpro?

Hi All,
Can someone tell me the steps involved in accessing a sql server database table and retrieving the record set from a webdynpro application.
Thanks in advance.
Best regards,
Divya

Hello Divya,
I would recommend you to read "Java Persistence" section in Development manual describing various options for database integration http://help.sap.com/saphelp_nw04/helpdata/en/61/fdbc3d16f39e33e10000000a11405a/frameset.htm
Tutorials
http://help.sap.com/saphelp_nw04/helpdata/en/46/ddc4705e911f43a611840d8decb5f6/frameset.htm
http://help.sap.com/saphelp_nw04/helpdata/en/91/9c2226df76f64fa7783dcaa4534395/frameset.htm
Web serices
http://help.sap.com/saphelp_nw04/helpdata/en/d6/f9bc3d52f39d33e10000000a11405a/frameset.htm
EJB
http://help.sap.com/saphelp_nw04/helpdata/en/19/f9bc3d8af79633e10000000a11405a/frameset.htm
Best regards, Maksim Rashchynski.

Similar Messages

  • How to insert data into database table from a servlet? Help please.

    From a servlet I want to insert a message with some servlet parameters into an oracle database table by writing 'insert into tablename'. How shall I write the sql statement?

    simple suppose u wanned to insert user name and password into table user_info then this is a simple example .....
    Best Regds
    bondzoro
    [email protected]
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class tester extends HttpServlet {
    Connection con = null;
    public void init(ServletConfig sc){
    super.int(sc);
    Class.forName("oracle.jdbc.driver.OracleDriver");
    public void service(HttpServletRequest req,HttpServletResponse res) throws ServletException,IOE
    try {
    con=DriverManager.getConnection("jdbc:oracle:thin:@database_URL:1521:ORA8","username","pa
    String user = req.getParameter("username");
    String pass = req.getParameter("pass");
    PreparedStatement pst = con.prepareStatement("insert into user_info values(?,?)");
    pst.setString(1,user);
    pst.setString(2,pass);
    pst.executeQuery();
    pst.close();
    con.close();
    }catch(Exception _e){
    _e.printStackTrace(System.err);
    ~

  • Unable to fetch database table from webdynpro application

    Hello,
    I have a Webdynpro application trying to fetch data from the database table. I have used the following code to get the connection to the database and execute the sql statement.
              InitialContext dbInitContext = new InitialContext();
              Properties sysProperties = System.getProperties();
              String sysname = sysProperties.getProperty("SAPSYSTEMNAME");
              String dbName = "jdbc/" + "SAP" + sysname + "DB";
              DataSource dataSource = (DataSource) dbInitContext.lookup(dbName);
              Connection conn = dataSource.getConnection();
              String SelectStmt = "Select * from INV_CUSTOMER";
              PreparedStatement stmt = conn.prepareStatement(SelectStmt);
              ResultSet resultSet = stmt.executeQuery();
    I logged into the database using user superdba in sqlcli, and created the table "INV_CUSTOMER". I am trying to run this application in my sneak preview java installation which comes with maxdb 7.6. But when I run the app, it always throws up the error:
    The SQL statement "SELECT * FROM "INV_CUSTOMER"" contains the semantics error[s]: - 1:15 - the table or view >>INV_CUSTOMER<< does not exist
    I am new to this concept, so any help would be appreciated.
    Thanks,
    Ajay

    >
    Ajay Singh wrote:
    > Hi Isaias,
    >
    > I created a dictionary project with the same structure, and used it in my app. Right now, everytime I run my app, the old data I entered is lost. I need to store data in the table, and reuse those records the next time I run the app. How do I do this?
    > Another question I have is, I have created Database Tables inside Local Dictionary of my dictionary project. Does this create a table in the actual database?
    > Forgive me, but I am new to this topic.
    >
    > Thanks,
    > Ajay
    Hi,
    It seems to me like there is more than one issue here. Let me try and help you out with some details.
    1.) If you have created the Dictionary project and the code in your original post is not giving you problems then it's good. However, the problem of the data disappearing from your Java Dictionary seems little bit wierd. You need to ensure that you are not running any "delete" command and ensure that the select statement (of it has and conditions) is correct.
    2.) As far as where the tables actually reside: When you create the Dictionary tables in a Dictionary Project-  this will actually create a script that will be run on the server that has an installed database (like Oracle, MSSQL Server or MaxDB, UDB). This means that the dictionary tables are just an abstraction of actual database tables.
    In order to ensure that you are not deleting the data - debug your Web Dynpro Application or EJB so that you can go through it step by step and see whether all the database statements are correct. Sometimes you may not get an SQL error due to a NullPointer in the dynamic queries as well - so keep a check on that as well.
    If you require a more detailed solution - please give us a small piece of code that we can analyse.
    Hope that helps.
    Thanks.,
    p256960.

  • How to delete/drop all the tables from SQL Server Database without using Enterprise Manager?

    How to delete/drop all the tables from SQL Server Database without using Enterprise Manager?
    I tried using DROP Tables, Truncate Database, Delete and many more but it is not working.  I want to delete all tables using Query Analyzer, i.e. through SQL Query.
    Please help me out in this concern.
    Nishith Shah

    Informative thread indeed. Wish I saw it early enough. Managed to come up with the code below before I saw this thread.
    declare @TTName Table
    (TableSchemaTableName
    varchar
    (500),
    [status] int
    default 0);
    with AvailableTables
    (TableSchemaTableName)
    as
    (select
    QUOTENAME(TABLE_SCHEMA)
    +
    +
    QUOTENAME(TABLE_NAME)
    from
    INFORMATION_SCHEMA.TABLES)
    insert into @TTName
    (TableSchemaTableName)
    select *
    from AvailableTables
    declare @TableSchemaTableName varchar
    (500)
    declare @sqlstatement nvarchar
    (1000)
    while 1=1
    begin
    set @sqlstatement
    =
    'DROP TABLE '
    + @TableSchemaTableName
    exec
    sp_executeSQL
    @sqlstatement
    print
    'Dropped Table : '
    + @TableSchemaTableName
    update @TTName
    set [status]
    = 1
    where TableSchemaTableName
    = @TableSchemaTableName
    if
    (select
    count([Status])
    from @TTName
    where [Status]
    = 0)
    = 0
    break
    end

  • How to copy a set of tables from a database to another periodically?

    We have a 4 node RAC primary database(10.2.0.2) with a physical standby(10.2.0.2) on our production site. Offlate we noticed that one of the applications(APP2) is causing heavy loads due large data downloads on the primary database servers. Our primary database has 2 schemas,
    1) one being the main schema with all objects, (USER1)
    2) and the other has views that query some set of tables from the main schema. (USER2)
    The application APP2 uses USER2 views to query and download huge data periodically. We need to be able to give accurate data results to APP2, but in the same time take off the load from the database, as APP2 is not our main application.
    We would like to know if there are any cost effective options in oracle to do this, and if so, what is the best option? Anyone has any experience setting up something like this before?
    We have thought of creating another 10.2.0.2 database on a different server and giving it regular updates(like data feeds) from the current database. The current database data changes quiet often, so the data feeds would have to be done often to keep the data current on the new database. So, we are not exactly sure how to go about it. Would a COPY command help?
    Please advice.

    user623066 wrote:
    Our 4 node RAC is already busy with our main application, which has its connections spread across all 4 nodes.
    Our main applications services are the same on all nodes and use all 4 nodes in the same way.
    There are some other utilities that we run from one of the app servers that connect to only 1 of the nodes.
    APP2 uses all 4 servers, which is again controlled by connection pooling and distributes the load.Wouldn't separate services be more beneficial here? If APP2 is locked down to one node during normal operation, that ensures that other connections aren't going to be competing for hardware with APP2 on 3 of the 4 nodes. If APP2 is generating less than 25% of the total load, you can let the other applications use whatever hardware resources are left idle on the node APP2 is locked down to.
    By Large data downloads, I meant both increase in network traffic and the CPU load on the database nodes.
    We are already using resouce manager to limit the resources allocated to USER2 that APP2 uses.
    And we have also limited the large downloads to take place in the early hours of the day when the traffic from our main application is less.
    But this has still not been optimal for the usage requirements for APP2. APP2 is also doing queries all through the day, but has a limit for the number of rows downloaded during peak hours.Can you explain a bit more about why using Resource Manager hasn't been sufficient? That's normally a pretty good way to prevent one hungry user from drastically affecting everyone else. Perhaps you just need to tweak the configuration here.
    Logical Standby seems a good option. But we need to keep our physical standby in place. Is it possible to have a logical standby and a physical standby? (ofcourse on separate servers)Sure. You can have as many standby servers of whatever type you'd like.
    Could we use a COPY command to copy data for the set of tables to a new database? Or is that also a complex option?You could, yes. COPY is a SQL*Plus command that has been depricated for copying data between Oracle databases for quite a while. It only works from SQL*Plus and would only be designed for one-time operations (i.e. there is no incremental COPY command). I can just about guarantee that's not what you want here.
    How do materialized views work? Wouldn't they still reside on the main database? Or is it possible to have remote materialized views?You probably don't want materialized views, but if you decide to go down that path
    - You'd create materialized view logs on the base tables to track changes
    - You'd create materialized views on the destination database that select data over a database link back to the source database
    - You'd put those materialized views into one or more refresh groups that are scheduled to refresh periodically
    - During a refresh, assuming incremental refreshes, the materialized view logs would be read and applied to the materialized views on the destination system to update the materialized views.
    Justin

  • How to Move or Copy the Tables from One Database to Another Database ?

    HI,
          Can any one help me on this, How i can move or copy the tables from one database to another database in SQL server 2005 by using SQL query. Hope can anyone provide me the useful and valuable response.
    Thanks
    Gopi

    Hello,
    Maybe these links help you out
    http://www.microsoft.com/downloads/en/details.aspx?familyid=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en
    http://www.suite101.com/content/how-to-copy-a-sql-database-a193532
    Also, you can just detach the database make a copy and move it to the new server.

  • How to connect and query the sql database in mobile application

    Hello,
    Can any one say how to connect the sql database from the j2me application.
    I have got some info that only through servlet or jsp only we can connect the database and from their we should get the info or query in mobile application.
    Is it true? and can i have any sample codes or white paper or guildlines.
    It would be more useful form my project.
    Thanks in advance.
    regards,
    sara

    Hi David,
    According to your description, when you add Windows Azure Mobile Services to a Window Phone 8 app, then store app data in the new mobile service. I recommend you post the related question on the Windows Azure Mobile Services Forums at
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=azuremobile .It is appropriate and more experts will assist you.
    In addition, there are the details about creating a Windows Phone app connected to your mobile service.
    http://www.windowsazure.com/en-us/develop/mobile/tutorials/get-started-wp8/
    http://www.windowsazure.com/en-us/develop/mobile/tutorials/get-started-with-data-wp8/
    Thanks,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • How to Import/Export database tables from one server to other in oracle8i

    Hello friend,
    Please can any one tell me how to import/export groups of database tables from one server with oracle to another using VB.net. It would be nice if some one can provide some code of it.
    I am a software developer and I am in middle of a large project development, in which I need to export a large oracle database from one server to another efficiently.
    Its very urgent so please someone help me.

    At command prompt (source db)
    set ORACLE_SID=db_name
    exp system/password@db_name full=y buffer=104857600 file=(c:\file1.dmp, c:\file2.dmp....) log=c:\exp.log filesize=2000M
    Then ftp the export dump files (in binary) to the other server or copy to target server over the network.
    At command prompt (target db)
    set ORACLE_SID=db_name
    imp system/password@db_name full=y ignore=y buffer=104857600 file=(c:\file1.dmp, c:\file2.dmp....) log=c:\imp.log filesize=2000M
    If the path names of the datafiles are going to be different in the target server (as compared to the source), then precreate the tablespaces before import. Set buffer value accordingly.
    Message was edited by:
    FeNiCrC_Neil

  • How to update database table from Internal Table

    hi experts,
        Can anyone please assist me in inserting records to a database table from an Internal Table
    whose structures are identical.
    Thanks in Advance,
    Sudhaa............

    Hi Sudha,
    Here are some example of update and insert:
    UPDATE SFLIGHT SET PLANETYPE = 'A310'
    PRICE = PRICE - '100.00'
    WHERE CARRID = 'LH' AND CONNID = '0402'.
    This example overwrites the contents of the PLANETYPE column with A310 and decreases the value of the PRICE column by 100 for each entry in SFLIGHT where CARRID contains u2018LHu2019 and CONNID contains u2018402u2019.
    TABLES SPFLI.
    DATA WA TYPE SPFLI.
    MOVE 'AA' TO WA-CARRID.
    MOVE '0064' TO WA-CONNID.
    MOVE 'WASHINGTON' TO WA-CITYFROM.
    UPDATE SPFLI FROM WA.
    MOVE 'LH' TO SPFLI-CARRID.
    MOVE '0017' TO SPFLI-CONNID.
    MOVE 'BERLIN' TO SPFLI-CITYFROM.
    UPDATE SPFLI.
    CARRID and CONNID are the primary key fields of table SPFLI. All fields of those lines where the primary key fields are "AA" and "0064", or "LH" and "0017", are replaced by the values in the corresponding fields of the work area WA or the table work area SPFLI.
    DATA: ITAB TYPE HASHED TABLE OF SPFLI
    WITH UNIQUE KEY CARRID CONNID,
    WA LIKE LINE OF ITAB.
    WA-CARRID = 'UA'. WA-CONNID = '0011'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    WA-CARRID = 'LH'. WA-CONNID = '1245'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    WA-CARRID = 'AA'. WA-CONNID = '4574'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    UPDATE SPFLI FROM TABLE ITAB.
    This example fills a hashed table ITAB and then overwrites the lines in SPFLI that have the same primary key (CARRID and CONNID) as a line in the internal table.
    Insert statement :
    TABLES SPFLI.
    DATA WA TYPE SPFLI.
    WA-CARRID = 'LH'.
    WA-CITYFROM = 'WASHINGTON'.
    INSERT INTO SPFLI VALUES WA.
    WA-CARRID = 'UA'.
    WA-CITYFROM = 'LONDON'.
    INSERT SPFLI FROM WA.
    SPFLI-CARRID = 'LH'.
    SPFLI-CITYFROM = 'BERLIN'.
    INSERT SPFLI.
    If the database table does not already contain a line with the same primary key as specified in the work area, the operation is completed successfully and SY-SUBRC is set to 0. Otherwise, the line is not inserted, and SY-SUBRC is set to 4.
    Regards,
    Premraj kaushik

  • How to create tree by database table

    hello sir ,
    my table is as follows,
    NAME LINK ID PID ROLLID
    User mgt. f?p=131:1: 1 - 10 ////root node///
    district 10 1 1 child
    Roles 16 14 4 child
    Users 11 10 1 child
    ROLLID is given from another table whis is (ROLES). i making tree by the combinations of id , pid, & roll id. by the roll id i can manage the tree to do not display specific nodes to specific users.
    ROLE table as :
    ROLE_ID NAME DESCRIPTION
    1 Administrator This is administrator
    2 Assistant Director -
    3 Assistant Statistical Officer -
    4 Data Entry Operator -
    but i think it is very complicated process . give me solution about it
    also i have to give my images to each node. how can i do that?

    You already have a thread going about this: Re: how to create tree by database table .
    Scott

  • How to insert data in database table

    Hi experts,
                   How to insert data into database table using internal table from function module.

    Hi,
    As per my understanding are you looking for the complete API feature of data insertion into the database using the Locking Mechanism? If yes, then you need to create a Lock Object using the Primary keys of the Primary Table and Secondary Tables. You need to call the lock object first and then you need to make the entry into the table. This principle is based on  'All or None Concept'.
    For the insert Statement Key word you can have a look at the following link:
    http://help.sap.com/abapdocu/en/ABAPINSERT_SOURCE.htm
    Hope this helps.
    Thanks,
    Samantak.

  • Create database tables from an xsd

    Is it possible to generate database table from a given xsd using toplink ?
    I want to use these tables to persist java objects obtained by unmarshalling the xml (corresponding to this xsd).
    Thanks in advance,
    Mahima

    Hello Mahima,
    Although you could use TopLink to generate a database schema from an XSD using a combination of wizards available in the TopLink Workbench, the resulting database schema would probably not be an optimal design. If you're interested we can talk about how to use this approach as a guide.
    Is your main use case the generation of a database schema or the actual movement of database data to/from XML?
    Using a combination of TopLink's object-relational and object-XML support to move data between XML and a relational database is a valid pattern. Refer to the discussion thread below for some approaches at setting up the metadata.
    TopLink-JAXB : Creating and Mapping tables from Toplink-JAXB POJOs.
    -Blaise

  • C# attaching SQL Database table to application for publish.

    Alright i finished app but i realised because entire app work on SQL Database table with @"Data Source=localhost\SQLExpress;Initial Catalog=DataPodataka2;Integrated Security=True" connection string like this,it won't work on client computer?...Any
    suggestion?

    This is a credential issue or the database isn't allowing SQL connections.  I would first start and make sure you can connect to database using SQL Server Management Studio and perform a simply query of database to make sure everything is working properly. 
    You can check also to make sure the SQL Service is running.  Then repeat with VS application to make sure that starting SSMS didn't fix the issue.Using Integrated Security = True indicates that you are using a Windows Credential for the database. 
    So you have to make sure that the SQL Database is also setup to use windows Credentials and the login account your are using for VS application is part of the SQL Server Group Account for windows authentication.
    jdweng

  • Updating database table from an internal table

    Hi All,
    I am updating a database table from an internal table.
    I am changing the non-key fields in that table.
    when I check sy-subrc = 4.
    Record already exists, because I am changing non-key fields of the
    database table.
    Is there any addition like to accept the duplicate keys with update.
    Alternatively, I have used Modify, It is adding new record,
    Again, I have search the old record and use Delete on the database table.
    Thanks & Regards,
    Kalyan Chandramouli
    SAP ABAP Consultant

    Hi,
    You are right, the field which I am trying to change is a part of primary key.
    Because, sy-subrc = 4. says,
    No line with specified primary key exits in the database table.
    I have a Z-tabel, with Kunnr Vkorg Matnr Bzirk Bztxt Split_percentage
    In this table primary key consists of KunnrVkorgMatnr+Bzirk.
    I am able to change the Split_percentage using UPDATE.
    Now, my client want to change Bzirk, Bztxt also in the table.
    How can I Go.
    Thanks & Regards,
    Kalyan Chandramouli
    SAP ABAP Consultant

  • How to find relationship between database tables

    Hi Mate,s.
    Iam new to SAPBW , PLZ tell me , How to find releationship between database table(Transperent tables).
    Regards.
    harry

    hi harry,
    from your previous postings, i guess you are asking relationship between tables in r/3, following links may help :
    http://www.sapgenie.com/abap/tables.htm
    http://www.sapgenie.com/abap/tables_sd.htm
    http://www.sapgenie.com/abap/tables_mm.htm
    http://www.sapgenie.com/abap/tables_fi.htm
    http://www.sapgenie.com/abap/tables_ps.htm

Maybe you are looking for

  • Unable to close some custom forms

    Hi Gurus, We did application migration from Hp-Unix to Sun Solaris. Oracle apps 11.5.10.2 with database 10.2.0.4 and application working good with few issues. Issues: 1. Few custom forms ( message Forms) unable to close. If we close by clicking X mar

  • Using procedure in SELECT statement

    I have a select statement that currently uses 4 functions to receive necessary values. All the functions are recursive and returns values from the same row. What I would like to do is replace these for function calls with 1 procedure. Does anybody kn

  • 3D files in After Effects CC

    Isn't that like saying, you didn't meet your own deadline? I'm glad it has worked towards yours and C4$D's advantage.. $$$$ Anyway, I am a whole hearted Blender Freak. On my 4th year now. You can do almost anything in Blender, and since it's such a s

  • Music app continues to have issues

    I posted about this issue months ago, but unfortunately the music app continues to have the same problem. On my phone, I continue to experience an issue where my saved playlists(ones I created on the phone) become disorganized. By disorganized, I mea

  • Weird issue with saving

    Hi, I normally hit Command-S every minute or so when working on something. I hit those keys and keep on going. Just a few minutes ago I did this and the window popped up as if I had hit Shift-Command-S - like I'm trying to save the project as a new v