Selecting the data from database and sending to users  using javamail

how to select the records from database table in oracle and send automatically to users using javamail. I am able to send the txt msg. but dont know how to send the selected table data to users automatically.
can anyone suggest how to write the steps with database connection to send msgs containing data to different users
Thank You

using JDBC..you want to
1. create the connect
2. open the connection
3. query the table for the data
4. loop through the resultset to retrieve rows of data
5. do something with the data
6. email the result
once you have the data, it is up to you to determine the format to send to the user using JavaMail. It is easiest to send plain text
here's a site that give code example (for all steps above relating to JDBC):
http://javaalmanac.com/egs/java.sql/pkg.html

Similar Messages

  • Extract the data from database and send to XI in form of file

    hi,
        I am working on a scenario in which i am to extract thew data from an ODBC database. and send it to Integration Engine using a file adapter. In this case which adapter i should use? If i go for file adapter then how i will extract the data and if i go for JDBCadapter then i can't send the data in the form of file which is my basic requirement.
    Can someone help me out.

    Hi,
    You can Use JDBC Adapter to pull the data from Dbase very well.
    Check this For Refference Use
    PERIODIC SCHEDULING OF DATA BETWEEN ORACLE DB & R/3 SYSTEM
    Regards
    Seshagiri

  • [webdynpro] How to get the data from database and store in Excel sheet

    Hi All-
    I am developing an application in Webdynpro and I need to provide a URL ( link ) which if clicked , need to collect the data from Database ( SQL Server ) and puts in an Excel Sheet corresponding fields and opens the sheet.....
    Please look into this issue and help me out......
    Regards,
    Cris

    Hi Cris,
    Add-on to wat santosh has pointed to:
    Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)
    (Or) If you have implemented your logic to get Database records below Blog should guide you in opening an excel with ur records.
    Exporting table data to MS-Excel Sheet(enhanced Web Dynpro Binary Cache)
    Regards,
    N.

  • How to select the data from DB and write into File?

    Hi Experts,
    Can any one please help me,
    I want to write the data from a table "T1" from Data Base to one file in windows.
    This functionality i need to achive in SSIS package through script component and Execute SQL task if it's passible.
    If any other way is there please help me.

    through script component and Execute SQL task if it's passible
    The easier way is to use a "Data Flow" Task with a "OleDB Data Source" pointing the the SQL Server table / query and a "Flat File Destination" to export to a file.
    Olaf Helper
    [ Blog] [ Xing] [ MVP]

  • Problem in Selecting the data from EKPO and KONV tables

    Hi Experts,
    Presently I am working on Report with Comparision-Sheet Between the vendor's Quotations. I have to display the Discount, Freight, Packing and Forwarding, Vat in Item level data based on the conditions made in PO.
    As per my Knowledge, Condition Types are stored in KONV Table. But there is no relation between KONV and EKPO tables.  So, I am unable to print the data for Discount, Freight, Packing and Forwarding, Vat... How can I get the values from EKPO and KONV tables?
    Thanks in Advance.
    Thanks n Regards,
    Muralikrishna.

    Don't recall if this is correct, but you may need the condition number from the header (EKKO) combined with EKPO-EBELP or other field as you key to access KONV (KNUMH and KPOSN).  My site doesn't run PP, so can't verify if the data is actually stored that, so just a possibility.

  • Problem with displaying the data from Database on swf file.

    Hi ,
      I am new to flash.Thanks in Advance Please help me....
    Actually my requirement is my application consists a button(submit_Btn) when we click on the button(submit_Btn), each time it must to database(through servlet) and brings the data from database and places it on the flash swf file.Here my problem is for the first time when we click on the button it goes to database and place the data(which was returned from database) on the swf file.Next  when we click on the button for the second time(or anytime) it is not going  and bringing the new data from database(if some data is modified in database or not),Infact it is showing the old data(the data that was collected from previous ClickListener) only on the swf file and it is also not showing any complile time or run time error.
    my Code looks like this:
    submit_Btn.addEventListener(MouseEvent.CLICK,onCheck2);
    function onCheck2(evnt:MouseEvent):void {
    var xmlLoader:URLLoader = new URLLoader();
        var xmlurl:String = "http://localhost:8888/xmlServlet";
        var xmlrequest:URLRequest = new URLRequest(xmlurl);
    xmlLoader.dataFormat = URLLoaderDataFormat.TEXT;
    xmlLoader.addEventListener(Event.COMPLETE, xmlcompleteHandler);
    xmlLoader.load(xmlrequest);
    function xmlcompleteHandler(event:Event):void {
        var loader:URLLoader = URLLoader(event.target);
        var succData:String=loader.data;
            var xmlData:XML = new XML();
            var xmlList:XMLList;
            xmlData = XML(loader.data);
            xmlList = xmlData.children();
            for (var i=0; i<xmlList.length(); i++) {
                for (var n=0; n<xmlData.UserHumanap[i].HumanapDot.length(); n++) {
                        var x_coordinate:Number = xmlData.UserHumanap[i].HumanapDot[n].@x;
                        var y_coordinate:Number = xmlData.UserHumanap[i].HumanapDot[n].@y;
                        var point2:Point = new Point(x_coordinate,y_coordinate);
                        var circle:Sprite = new Sprite();
                        circle.graphics.beginFill(0x00ff00);
                        circle.graphics.drawCircle(point2.x,point2.y,3);   //Placing the data as dots on the swf file
    Thanks in Advance.......Please Help me..........
    its Urgent..........
    Thanks,
    Swarthi

    Checkout following line in your code
    var xmlurl:String = "http://localhost:8888/xmlServlet";
    now change it to
    var xmlurl:String = "http://localhost:8888/xmlServlet?random="+String(MAth.random());
    I think you will get the point now

  • To Select the data from two table one is transp table and onther is cluster

    Hi All,
    I want to select the data from two tables
    Here i am giving with an example.
    Fileds: kunnr belnr from bseg.  table bseg
    fields: adrnr from kna1     table: kna1.
    Know i want to put these into one internal table based on kunnr and belnr.
    Thanks in advance.
    Ramesh

    Hi,
       U cant use joins on cluster table and BSEG is a cluster table so use FOR  ALL ENTRIES for taht
    refer this code
    *&      Form  sub_read_bsak
          text
    -->  p1        text
    <--  p2        text
    FORM sub_read_bsak.
    *--Select data from BSAK Table
      SELECT lifnr
             augdt
             augbl
             gjahr
             belnr
             xblnr
             blart
             dmbtr
             mwskz
             mwsts
             sgtxt
             FROM bsak
             INTO CORRESPONDING FIELDS OF TABLE it_bsak
             WHERE belnr IN s_belnr
             AND   augdt IN s_augdt.
      IF sy-subrc EQ 0.
    *--Sort table by accounting document and vendor number
        SORT it_bsak BY belnr lifnr.
      ENDIF.
    ENDFORM.                    " sub_read_bsak
    *&      Form  sub_read_bseg
          text
    -->  p1        text
    <--  p2        text
    FORM sub_read_bseg.
      IF NOT it_bsak[] IS INITIAL.
    *--Select data from BSEG table
        SELECT belnr
               gjahr
               shkzg
               kostl
               hkont
               ebeln
               ebelp
               FROM bseg
               INTO CORRESPONDING FIELDS OF TABLE it_bseg
               FOR ALL ENTRIES IN it_bsak
               WHERE belnr EQ it_bsak-belnr
               AND   gjahr EQ it_bsak-gjahr
               AND   shkzg EQ 'S'.
        IF sy-subrc EQ 0.
    *--Sort table by accounting document
          SORT it_bseg BY belnr.
        ENDIF.
      ENDIF.
    ENDFORM.                    " sub_read_bseg

  • Get the data  from excel and insert into the database

    I want to read the data from excel file, get the data from excel and insert into the database.

    You can use the Apache POI HSSF API to read data from Excel files and you can use the Sun JDBC API to insert data in database.
    This has nothing to do with JSP/JSTL.

  • Problem in printing the data from database when i print inside servlet

    hi to all!
    the objective of the code below is getting the data from database table and has to send that data to the web browser using out.println .note: out - PrintWriter object
    In a getQuestion method, i am getting the data from database table and store it in String q and when i print the q within this method it is getting printed, but i got the null value when i printed the String q inside service method doPost. why..? its puzzling me.
    package servlet;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class test extends HttpServlet {
         Connection con;
         ResultSet rs;
         Statement s;
         StringBuffer q;
         StringBuffer o1;
         StringBuffer o2;
         StringBuffer o3;
         public void getQuestion() throws Exception
              if(rs.next())
                   q=new StringBuffer(rs.getString("question"));
                   o1=new StringBuffer(rs.getString("option1"));
                   o2=new StringBuffer(rs.getString("option2"));
                   o3=new StringBuffer(rs.getString("option3"));
                   System.out.println(q);
                   System.out.println(o1);
                   System.out.println(o2);
                   System.out.println(o3);
         public void connect(){
              try
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              con=DriverManager.getConnection("jdbc:odbc:ds","sa","server");
              s=con.createStatement();
              rs=s.executeQuery("select * from qa order by newid()");
              getQuestion();
              catch(Exception e)
                   System.out.println("erroe");
         public void doPost(HttpServletRequest request,HttpServletResponse response)
         throws IOException,ServletException
              response.setContentType("text/html");
              new test().connect();
              PrintWriter out=response.getWriter();
              request.setAttribute("question", q);
              request.setAttribute("option1", o1);
              request.setAttribute("option2", o2);
              request.setAttribute("option3", o3);
              //RequestDispatcher rd=getServletContext().getRequestDispatcher("/show.jsp");
              //rd.forward(request, response);
              out.println("<html>");
    out.println("<head>");
         out.println("<title>" + "shock!!!" + "</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h2>"+"Read twice before u answer"+"<h2>");
    out.println("<p></p>");
    //why the value of q is not getting printed, instead i get null
    out.println("<h2>"+ q +"<h2>");
    out.println("how is it");
    out.println("</body>");
    out.println("</html>");
    Edited by: Mahesh_yeswecan on Nov 29, 2008 10:42 AM

    As u said , i have done a silly mistake earlier. though i have corrected the code still i am getting the same null value
    package servlet;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class test extends HttpServlet  {
         Connection con;
         ResultSet rs;
         Statement s;
         StringBuffer q;
         StringBuffer o1;
         StringBuffer o2;
         StringBuffer o3;
         public void getQuestion() throws Exception
              if(rs.next())
                   q=new StringBuffer(rs.getString("question"));
                   o1=new StringBuffer(rs.getString("option1"));
                   o2=new StringBuffer(rs.getString("option2"));
                   o3=new StringBuffer(rs.getString("option3"));
                   System.out.println(q);
                   System.out.println(o1);
                   System.out.println(o2);
                   System.out.println(o3);
         public void connect(){
              try
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              con=DriverManager.getConnection("jdbc:odbc:ds","sa","server");
              s=con.createStatement();
              rs=s.executeQuery("select * from qa order by newid()");
              getQuestion();
              catch(Exception e)
                   System.out.println("erroe");
         public void doPost(HttpServletRequest request,HttpServletResponse response)
         throws IOException,ServletException
              response.setContentType("text/html");
              connect();
              PrintWriter out=response.getWriter();
              request.setAttribute("question", q);
              request.setAttribute("option1", o1);
              request.setAttribute("option2", o2);
              request.setAttribute("option3", o3);
              //RequestDispatcher rd=getServletContext().getRequestDispatcher("/show.jsp");
              //rd.forward(request, response);
              out.println("<html>");
            out.println("<head>");
             out.println("<title>" + "shock!!!" + "</title>");
            out.println("</head>");
            out.println("<body>");
            out.println("<h2>"+"Read twice before u answer"+"<h2>");
            out.println("<p></p>");
            //why the value of q is not getting printed, instead i get null
            out.println("<h2>"+ q +"<h2>");
            out.println("how is it");
            out.println("</body>");
            out.println("</html>");
    }

  • Pull the data from database.

    Hi EveryBody,
                     I have a requirement in universe if the end user will select the date from (1/8/14 to 10/8/14) then pull the data from the database. but when the end user select the data more than 10 days(e.g 1/8/14 to 15/8/14 etc...) then no need to pull the data from database.
    how will write the filter in the universe?
    how will achieve this? please help me.
    Thank you.

    Hi  ,
    I am assuming you are giving prompt for start date and end date  respectively start_date and end_date.
    please see the below work around. (below is pseudo code)
    1. create one dummy objects as
    case when @prompt(end_date) - @prompt(start_date) <= 10 then = 1 end
    Remember text used in dummy object should be same as you use it for you date prompts
    2. pull this objects in where clause along with your date prompts as
    dummy_object = 1 
    It will work as below :=
    your report will be prompted for start_date and end_date .
    Same values will be passed to dummy objects.
    When dummy object will be executed , it will check for  end_date-start_date <=10 or not.
    If it is less then 10 then query will executed else it will come out as where  clause is not satisfied.
    Hope this answers your question :-).
    Regards
    Jeevan 

  • How to retrieve the data from Website and Upload it in SAP table?

    Dear ABAPers,
            I want to retrieve the data from website and upload the same in SAP Database Table is that possible.Please help me.It is very Urgent.
    Thanks & Regards,
    Ashok.

    Dear Abhishek,
                  Thanks for your reply.But my requirement is not met.
    If i execute the program it should retrieve the data from particular website.
    Thanks & Regards,
    Ashok.

  • How to select the data from a Maintainance View into an internal table

    Hi All,
    Can anybody tell me how to select the data from a Maintainance View into an internal table.
    Thanks,
    srinivas.

    HI,
    You can not retrieve data from A mentenance view.
    For detail check this link,
    http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ed2d446011d189700000e8322d00/content.htm
    Regards,
    Anirban

  • How to make users to select the date from calendar control my making the date field read only in date time control in external list in sharepoint 2010

    How to make users to select the date from calendar control only, by my making the date text field read only (don't want to let users type the date) in date time control in external list in sharepoint 2010. I am looking for a solution which can
    be done through sharepoint desginer / out of the box.
    thanks.

    Congratulate you got the solution by yourself. I am new to a
    WinForms calendar component, I feel so helpless on many problems even I'd read many tutorials. This question on the
    calendar date selection did me a great favor. Cheers.

  • Extract data from SAP and send to external system via Webmethods & IDOC's

    Hi,
    We need to Extract data from SAP and send to an external system via Webmethods middlewear using IDOCs. I have never used webmethods before and would like to know more about how to implement this scenario. I have used IDOCS in an EDI scenario before but not used it along with WebMethods.
    Any pointers would be of great help. Thanks

    If you have already ABAP programs /BAPI's in place then try to develop RFC interface and write some back ground programs to scheudl BAPI's and develop scenario but you need to implement error handling , data validation in PI mapping level.
    or
    take help from ABAPer to design in ABAP like writing Proxy program to pull data and send it PI.
    if you are dealing with master data bit risky(correctness) but can be achived using PI.

  • How to display the data from database(MS access) to a textbox

    anyone know ?

    how to display the data from database(MS access) to a
    textboxThe reply hasn't changed over these years. Read the tuutorial on how to fetch the data. You can display it anywhere you feel like. :)
    http://java.sun.com/docs/books/tutorial/jdbc/

Maybe you are looking for