Need a suggestion in getting data using JDBC

Hi,
There is a Emp table in database.
     And there is a corresponding Value Object(Contains getter and setter
     methods for columns of Emp table).
     If i fire a query to Emp, then the records will be stored in ResultSet.
     I am passing the table as a paremeter to a method.(so that no. of columns
     should vary)
     Now my problem is how can i initialize each column value getting from
     ResultSet into corresponding VO setter method.

Like this probably: vo.setX(rs.getInt("X"));

Similar Messages

  • Need suggestion in getting data using JDBC

    Hi all need suggestion,
         i had a VO corresponding to database table.
         when i am try to get the records from that table,
         how can i initialize the particular column value to the
         corresponding VO setter method.
         please do the needful.

    Hello inform2csr,
    Your question is not so clear.
    Can you be more precise?
    What is VO?

  • DISPLAY SPATIAL DATA USING JDBC ON A JAVA FRAME

    I am trying to set up some spatial data and need help in getting some sample
    code for displaying the data on a Java Frame using JDBC.
    The shapes I am setting up are simple polygons, lines, circles. I was going
    through the samples in the demo directory under $ORACLE_HOME/md/demo/examples, but could not find any JDBC
    I would really appreciate if you can point me towards some sample code and any other spatial resources.
    Madhukar

    Here you go. It uses JDBC to fetch geoms, convert them into Java JGeometry objects, which then create Java2D shapes (these are functions of the public sdoapi.jar library). It then uses some class in the sdovis.jar library (the rendering engine of MapViewer) to setup the necessary viewport transform. If you know how to setup the viewport transform, then you dont even need sdovis. sdovis.jar is found in an deployed MapViewer's WEB-INF/lib directory. Or you can extract it from the mapviewer.ear's web.war file.
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.sql.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.util.*;
    import oracle.jdbc.OracleDriver;
    import oracle.sdovis.*;
    import oracle.sdovis.style.*;
    import oracle.sdovis.util.*;
    import oracle.spatial.geometry.JGeometry;
    import oracle.sql.STRUCT;
    * A very simple program that shows stuff from db in a JFrame
    * <p>
    public class tilsvgui2 extends JFrame
      final static int mapWidth  = 640;
      final static int mapHeight = 480;
      static JSDOGeometry geom = null;
      public tilsvgui2()
        setSize(mapWidth+40, mapHeight+40);
                    setVisible(true);
        this.addWindowListener(new java.awt.event.WindowAdapter() {
          public void windowClosing(WindowEvent e) { System.exit(0); }
            public void paint(Graphics g)
                    super.paint(g);
        int w = this.getWidth(), h = this.getHeight();
        Insets inset = this.getInsets();
        double[] mbr = geom.getMBR();
        //from sdovis; it will setup the viewport transform
        XFViewPort xfp = new XFViewPort();
        xfp.setDeviceView(inset.left, inset.top, w-inset.left-inset.right-1, h-inset.top-inset.bottom-1);
        xfp.setDataView(mbr[0], mbr[1], mbr[2], mbr[3]);
        AffineTransform af = xfp.getAffineTransform();    //get the viewport transform
        Shape shp = geom.createShape(af);    //create a proper shape that fits the viewport
        Graphics2D g2 = (Graphics2D) g;
        g2.setColor(Color.red);
        g2.drawRect(inset.left, inset.top, w-inset.left-inset.right-1, h-inset.top-inset.bottom-1);
        //draw the shape itself
        g2.setColor(Color.blue);
        g2.draw(shp);
      public static void getStuff() throws Exception
        System.out.println("Loading geometry...");
        Connection conn = getConnection("mapsrus.us.oracle.com", "1521", "orcl", "scott", "tiger");
        Statement  stmt = conn.createStatement();
        ResultSet  rset = stmt.executeQuery("select geom, totpop from counties where county='Merrimack' and state_abrv='NH'");
        while(rset.next())
          STRUCT st = (STRUCT) rset.getObject(1);
          geom = JSDOGeometry.loadFromDB(st);
          int population = rset.getInt(2);
          break; //displaying only the first geometry
        rset.close();
        stmt.close();
        conn.close();
      private static Connection getConnection(String host,
                                              String port,
                                              String sid,
                                              String username,
                                              String password)
        throws SQLException
        String thinConn = "jdbc:oracle:thin:@"+host+":"+port+":"+sid;
        Driver d = new OracleDriver();
        Connection conn = DriverManager.getConnection(thinConn,username,password);
        conn.setAutoCommit(false);
        return conn;
      public static void main(String[] args)
        try{
          getStuff();
        }catch(Exception e)
          e.printStackTrace(System.err);
        new tilsvgui2();
    }

  • Oracle Web Forms - need a method to get data from a Form to Excel

    I am running Oracle Forms 6i for the web.
    I need a way of using the old DDE or OLE implmentation to get
    data to an Excel spreadsheet. Ideally opening an existing
    spreadsheet and inserting new data.
    Anyone been able to do this ?
    Thanks in advance
    Dave.

    If you have EXcel on your application server (the one where forms
    is), you can still use OLE2 calls to create or modify the excel
    sheet on the server. Then you can use web.show_document to get
    the excel file back to the client machine.

  • Need help about RRD4J, get data from rrdb

    i need more help about roundrobin database, especially using RRD4J library.
    i want to know, if i have one file database data1.rrd and i specific want to get data from startTime to endTime.
    how i can get that data from that database, and move them to another database file data2.rrd.
    can i do this?

    thx jschell
    javadoc from rrd4j not clearly enough for me to understanding about prosesing add, update and get data in there, so i ask in this forum may be anyone can give me solution.
    i think it's simple problem but i don't know how to implement with this API.
    with rrd4j we can create roundrobin database (rrd), the output in example: data1.rrd
    i just want to get data that i had put in data1.rrd to move them to another rrd, example: data2.rrd.
    data1.rrd and data2.rrd, they have same lastupdate time.

  • Need suggestion to get data from change log table of ODS.

    Hello,
    There is a case where i am loading opportunity header data from header ODS and opportunity item data from item ODS in the opportunity cube.
    Status (1= OPEN, 2= WON ETC) of the opportunity are available only in header ODS and not in item ODS.
    While loading data from header ODS to cube, I am loading it directly but while loading data from item ODS to cube i am using active data table of header ODS as a lookup in the update rule from item ODS to cube. I am selecting status from the active data table of header ODS while loading data from item ODS to cube.
    Since active data table will have only after image records, there is some data mismatch in the report as i am selecting data from active data table of header ODS while loading data from item ODS to cube.
    I need to select data from Change log in order to get before image also instead of active data table in order to overcome this issue. Is there any way by which i can do selection from Change log instead of active data table as change logs are generated at run time.
    Please let me know if you have any suggestions.
    Regards,
    Sanjay Chaurasia.

    Hi,
    You can use the changelog table of the DSO.
    Right click manage the Header DSO, go to the contents tab and click Change Log table. There you can see the technical name of the Change Log table.
    In the update rule Routine, give the tech name of Change log table instead of Active table name.
    Hope it helps.
    Krishna

  • Reading CLOB data using jdbc thin driver

    Hi,
    When I try reading data for a CLOB column using thin jdbc driver, I get the following error message
    "Exception: ORA-06550: line 1, column 22:
    PLS-00302: component 'GETCHUNKSIZE' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored".
    This error message is displayed when the call is made to get the character stream from the Clob object.
    Do I need to any server side setup before I can access CLOB data from the database?
    thanks.
    Puru Balakrishnan

    I updated to the latest jdbc drivers, 816classes12b.zip, and the problem went away.
    null

  • Need to change CONTRACT End date using Bapi BAPI_CUSTOMERCONTRACT_CHANGE

    Hi,
    I need to change date of a contract and for the same I am using Bapi "BAPI_CUSTOMERCONTRACT_CHANGE".
    I am passing the following Parameters to the BAPI.
    SALESDOCUMENT  -- Have passed the Contract Number in this.
    CONTRACT_HEADER_IN -- Have passed the values of the following fields ::
    COLLECT_NO -- Sales Document number
    Sales_Org  -- Sales Organization
    Distribution Channes -- Dist. Channel
    Division -- Division
    CT_VALID_T -- New date which I want as the contract end date.
    CONTRACT_HEADER_INX -- Following values have been paased in this Structure.
    UPDATEFLAG -- 'U'.
    CT_VALID_T -- 'X'.
    Now when I run the BAPI with these inputs I get the output as ' Field 'GUEEN' cannot be copied, because it is not ready for input'.This is a information message. But the changes are not reflected in the contract. I have done the commit work after BAPI.
    When I changes the value for CT_VALID_T flag from 'X' to 'U' the message mentioned above does not come but the end result is same and changes are not reflected in the contract.
    I would be really helpful to you if get any kind of helf to know ehy the output is not coming.
    Thanks a Lot for your kind help!!!!
    Regards,
    Lalit Kabra

    Hi Lalit,
    The value for CT_VALID_T flag has to be 'X' in the CONTRACT_HEADER_INX structure.
    In this case, you receive an informative message "Field 'GUEEN' cannot be copied, because it is not ready for input'"
    That is the problem. You cannot change this field because your functional team has this field as "not ready for input" in change mode.
    Can you change this field in transaction VA42? If you can't modify it in dialog, you can't modify it with BAPI.
    Regards,

  • Getting date using week number and year

    hi!
    how can i get the date for a given year using a given week number?
    assuming that the first day will be sunday?
    for example..
    the input year is 2006,
    then the week number is 30
    the result should be july 23 2006...
    please help.. Thanks!

    play a little with the Calendar class. You might need some setters and maybe the add method to scroll to the previous Sunday.

  • Not able to fetch updated data using jdbc and oracle 10g

    Whenever i m updating the data and fetching the same record after updating i m not able to get the fresh/new updated data , old record is fetched every time, but when i checked in database the record gets updated successfully , even if i fire the query two times after 10 seconds using Thread.sleep even then problem persist.
    Please help me out!!!!!!!!
    Implementation has been stucked up!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :(

    Well its okWhat is OK? Your stuff working now?
    i m doing the same thing Apparently not.
    please go thru the below code fragment:
    code for Update :::
    DataAccessBean1 partsHistoryDataAccessBean = new
    DataAccessBean1(context);
    partsHistoryDataAccessBean.setData(data);
    partsHistoryDataAccessBean.update();
    After Updating i m forwading it to the other servletForwarding what? Why do you need another servlet? Just do the query, put the new data into the response object, and return.
    According to your assumption i should get the updated
    data on the other screen but Nope, you don't understand what I'm saying.
    %

  • Hi, i'm new in lab view. i'm using 3'rd party daq card to get data using labview

    i'm still green in this field. can anybody help me on how to get various data from daq card(not an ni brand) using my labview programming. i use labview 6 and i don't know how to get the data so i can display it in my programming. i used Pcl 1800 and pcl 836 card of advantech brand.

    Greetings,
    Below is a link to a KnowledgeBase, which discusses your options:
    http://pong.ni.com/public.nsf/websearch/F3009806E2AE416E8525645D0076B962?OpenDocument
    It appears that Advantech has a LabVIEW driver available. Below is a link to information about the driver on their Web Site. I would suggest trying this option, as opposed to using the Call Library Function with Advantech's driver DLLs:
    http://www.advantech.com/content/0000000175/0000000175.asp?css=corp&name=corp
    Good luck with your application.
    Spencer S.

  • Unload dynamic data using JDBC into a file

    Hi,
    I have to download the result of a dynamic SELECT query into a file.
    The query will be provided at runtime. So I am unsure of the number of columns and the data types of the columns.
    Also I am unable to use io on the returned resultset object.
    So basically i have to persist the data from the resultset object into a file.
    Any hints
    Thanks in advance

    Also I am unable to use io on the returned resultset object.What do you mean by this?
    See the JDBC tutorial: http://java.sun.com/docs/books/tutorial/jdbc/index.html
    and the file I/O tutorial: http://java.sun.com/docs/books/tutorial/essential/io/index.html

  • Assigning an exact time to poll data using JDBC Sender?

    Hi,
    Can I set an exact time to poll data from DB table?
    I means, I want to poll data every 6 pm.
    But I cannot find fields to set starting time.
    There exist only poll interval fields in JDBC Sender.
    Regards,
    hiyoung.

    Hi,
    This might help you out.
    To run a scenario exactly once in a specific time every day    / schedule a adapter
    Note:You will need to have the authorizations of the user group SAP_XI_ADMINISTRATOR with the role modify.
    Go to Runtime Workbench -> Component Monitoring -> Communication Channel Monitoring
    Locate the link Availability Time Planning on the top right corner of your Communication Channel Monitoring page.
    In your case, the requirement is to schedule the Sender file adapter daily once at 12:00 at midnight.
    In Availability Time Planning, choose the Availability time as daily and say create.
    Provide the details like the time 12:00
    Then select the communication channel , goto the Communication Channels tab and filter and add the respective channel (File Sender).
    Once all the above has been done 'Save' the changes.
    <b>Cheers
    *RAJ*
    *REWARD POINTS IF FOUND USEFULL*</b>

  • Need help with returning NULL data using DECODE

    Hello again! I am new to PL/SQL and still fairly new to SQL. I have a query that returns several columns of data and based on the year entered I want either current data or past data. If the number is null that is considered current data only.
    Below is part of my where clause, it kinda of works the way I want. It is returning the correct numbers but it is not returning any null numbers when I enter 2007 for the current year. I hope this makes sense, any suggestions/tips would be great thanks!
    WHERE table1.num = decode(table1.num,
    null,
    decode(:p_year, to_char (current_date,'yyyy'),
    table1.num,null),
    decode(:p_year,(select to_char(open_date,'yyyy') from table2 where table2.num = table1.num),
    table1.num,null))

    maybe something like this?
    WHERE Nvl(table1.num,'x') = Decode(table1.num, null, Decode(:p_year, to_char(current_date,'yyyy'), table1.num, 'x'),
                                                         Decode(:p_year, (select to_char(open_date,'yyyy') from table2 where table2.num = table1.num), table1.num, 'x')) note: untested

  • What software do I need to install to get "Data Mining Framework"

    Hi,
    from edelivery.oracle.com I have downloaded:
    1. Hyperion Essbase - System 9 Release 9.3.1.2 Server Windows Installer
    2. Essbase Administration Services Release 9.3.1 Windows Installer
    I installed both software and I started Administration Services Console, log in etc. Essbase server is working fine.
    In Administration Services Console I click on Essbase Servers | localhost | Data Mining | Algorithms and got error:
    "message from server [Data Mining Framework is not available. Please contact Administrator].
    It looks like I need to install some other software to have access to data mining features. Which software do I need to install?
    Regards,
    Grofaty

    Windows 7 and iCloud Control Panel for Windows v1.1. Also, Apple (Canada) - iCloud - Learn how to set up iCloud on all your

Maybe you are looking for

  • Digital Signature box issues

    I have extended rights to users, but digital signature box will not work in Adobe Reader. What am I doing wrong?

  • Cant back up iphone says files are corupted

    my phone wont back up on my computer comes up saying last back up is corupted but cant find it on the computer to delete

  • Help with Dynamic GUI

    I am trying to create a dynamic gui for a program that when given three names, it will make a list of matches ( wrestling ) against each other.. I got it so when you click foward once.. it brings up the specified amount of text fields.. but when i cl

  • Transfer aps to ext hd

    Right now a user has a laptop running snow leopard. They have i movie and idvd but no support aps disk. Is there a way to save those installations and move them to an ext hd and when they do a clean install of lion they can keep the programs?

  • I can't download an app

    Help