How to get time from Date

I have a Column that is defined as "DATE".it also Contains Time.........
I want to Get the Time only....so when i am using this
to_date(var_date,'hh12:mi:ss PM'),it is giving me date also and when i am using this
to_char(var_date,'hh12:mi:ss PM') then it is giving me all values similar to one of the top values in Column....
Then i Used EXTRACT function as
Select EXTRACT(HOUR FROM VAR_DATE).......
THEN IT THRWOING ERROR.......INVALID EXTRACT FIELD FOR EXTRACT SOURCE........
pLZ HELP HOW TO GET TIME...................................ONLY WITH AM AND PM......
Thanks in Advance

Hi,
to_char function should give the result as expected.
SQL> select to_char(sysdate, 'hh12:mi:ss PM') from dual ;
TO_CHAR(SYS
11:39:16 AM
SQL> select to_char(sysdate, 'hh12:mi:ss AM') from dual ;
TO_CHAR(SYS
11:39:32 AM
SQL> select to_char(sysdate,'hh:mi:ss') from dual ;
TO_CHAR(
11:40:04
SQL> select to_char(sysdate,'hh:mi:ss am') from dual ;
TO_CHAR(SYS
11:40:18 am
SQL> select to_char(sysdate,'hh:mi:ss pm') from dual ;
TO_CHAR(SYS
11:40:31 am
Thanks,
Siva

Similar Messages

  • How to get Time from Different Work Station on the Network

    Hi,
    How do I get time from different work station on the network using its ip:port etc.
    Lets say, my main server-side Java application is running on a work station 123.12.123.1:1527,
    the client-side applications are accessing it using above IP.
    what I wanna do is, use the time of 123.12.123.1 machine throughout the application, not client local time.
    Appreciated..

    Ok, this network service on IP:Port is working for me, I hope this is the best way of doing it.
    In server application, I have this
    package RenameItToYourOwnPackage;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.net.ServerSocket;
    import java.net.Socket;
    import java.text.SimpleDateFormat;
    public class ServerSocketExample implements Runnable {
        private ServerSocket server;
        private int port = 7777;
        Socket socket;
        public void run() {
            try {
                System.out.println("Waiting for client message");
                server = new ServerSocket(port);
                while (true) {
                    socket = server.accept();
                    // Read a message sent by client application
                    ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
                    String clientMessage = (String) ois.readObject();
                    System.out.println("Message sent by client: " + clientMessage);
                    // send current datetime to client
                    ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
                    oos.writeObject(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date()));
                    ois.close();
                    oos.close();
                    socket.close();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
    }In the client application I have
    package RenameItToYourOwnPackage;
    import java.io.IOException;
    import java.io.ObjectInputStream;
    import java.io.ObjectOutputStream;
    import java.net.InetAddress;
    import java.net.Socket;
    import java.net.UnknownHostException;
    public class ClientSocketExample {
        static String dateTimeString;
        public ClientSocketExample() {
        public static String getServerDateString() {
            try {
                // Create a connection to the server socket on the server application
                InetAddress host = InetAddress.getByName("127.0.0.1");
                Socket socket = new Socket(host.getHostName(), 7777);
                // Send a message to the server application
                 ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
                 oos.writeObject("Send me today's timestamp as string");
                // Read the response by server application
                ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
                dateTimeString = (String) ois.readObject();
                //System.out.println("Message sent by server: " + message);
                ois.close();
                oos.close();
            } catch (UnknownHostException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            return dateTimeString;
    }And I run the service on the server-side with
            new Thread(new ServerSocketExample()).start();On the client-side I receive the date with
            System.out.println("DateTime on Server : " + ClientSocketExample.getServerDateString());Edited by: nkamir on Sep 13, 2010 2:53 PM

  • How to get valid from date in KONH Table

    Hi ,
          I am sending COND_A idoc for MRP. Now when I create a record using VK11,the valid from date is fine.
    But while changing the same using VK12 changed date does not reflect in KONH Table (when the new valid from date is greater the the previous one) .I understand the SAP Logic behind this from previous threads .
    But my issue is this :
    Suppose I have a Material X created with Valid from = 10.01.2011 & valid to = 31.12.9999
    Now I change this Valid from = 28.01.2011 & valid to = 31.01.2011.
    Now how can I send the data for 28.01.2011 in my I-doc , as KONH still has 10.01.2011 as valid from date.

    even if you send the data for 28.01.2011, it should pick up the condition record because the start date for condition record is in past? why do you think it is a problem? now if your concern is that if your input date is 27.01.2011 and it should not pick this condition (that is a different matter altogether)...

  • How to get last Build date of a dll in the real time target

    Info On My Project    
       I am working on LabWindows CVI 12.0 for development . This project is a real time application for hardware, which is having Phar Lap ETS as RTOS...  
    I am facing some problems while checking Build date of my Application file( .dll)
    I have tried to use GetFileDate API. But it is not supporting for realtime Target..
    So i have tried __DATE__ macro.. That also having some problems..
    How to get last Build date of a dll from the real time target  ??
    Please Help to solve this....
    Thanks
    Vaishakh A  K

    Please reply if any one have suggestion...

  • How to get both OTF data and spool at a time

    Hi Experts,
        My requirement is to get both OTF data and spool.
    In 'OPEN_FORM' i tried passing itcpo-TDGETOTF = 'X'. itcpo- TDNEWID = 'X'.
    I was able to get OTF data but spool is not getting generated.
    IF i pass only itcpo- TDNEWID = 'X'. the spool is getting generated but not OTF data.
    when both the fields are set i.e. itcpo-TDGETOTF = 'X'. itcpo- TDNEWID = 'X'.
    the spool is generation is getting supressed.
    Similarly when i tried to get OTF data by passing itcpo-TDGETOTF = 'X'. to 'OPEN_FORM' as i need to convert it to PDF and send it to vendors as email ,
    The print preview in TCODE ME23n was not getting generated for 'MESSAGE' option 'External send'.
    Please suggest me how to get both OTF data and spool at a time.

    Hi Kartik,
    This one is similar to my question to print and email invoice at same time.  I pass itcpo-tdgetotf = 'X' in order to get otfdata and send email with the attachment of otfdata.
    Now I have data in otfdata, but when I call print_otf function, I clear out itcpo-tdgetotf, and passed
    itcpo-tddest = device_type but I still get error message said 'Handler not valid for open spool request'.
    Can you give me a working example that you have otfdata table and print data from that table.  I also post my question on other thread
    submit report and export to memory
    thanks

  • How to get sales order data in substitution of fi-docu from GM posting ?

    How to get sales order data in substitution of FI documents from goods movement posting?
    When I posting a material document with movement type "501E", the system will creating a FI document automatically. And I need to get the sales order data in the substitution of FI document.
    I tried to export the data of the material document in user-exit "MB_CF001 Updating of material document data upon posting", but this user-exit does not triggered in the posting process at all. what's the problem?
    Do you have better solution or idea for this? Please help me. Thank you!

    Hello Harish,
    Please use BAPI_BUSPROCESSND_GETDETAILMUL to read details of sales order. This works as a remote enabled counterpart of CRM_ORDER_READ.
    Similarly if you want to display sales order from R/3, use FM BAPI_BUSPROCESSND_DISPLAY.
    Regards
    Kaushal

  • How do i get time or date connection?

    I want get time or date when the users login to database.(with SQLPlus or PL/SQL).
    Thanks.
    bsaraie.

    SELECT logon_time FROM v$session
    WHERE username = 'SCOTT' ;

  • How to get the current data and time of SCOM server via SCOM SDK (API) calls?

    Hi,
    I need to read the current date and time of SCOM server via SOM SDK.
    Is there a class in SDK that provides this info ?
    Thanks,
    satheesh

    To get time and date of Alerts of SCOM, You can use following command let "get-scomalert"
    Also, You can refer below links
    http://blog.tyang.org/2013/02/21/using-scom-2012-sdk-to-retrieve-resource-pools-information/
    Please remember, if you see a post that helped you please click "Vote As Helpful" and if it answered your question, please click "Mark As Answer"
    Mai Ali | My blog: Technical

  • How to get  the actual data in ALV report

    I am doing some upgradation work   in that i am using Submit  & And return and  also i am using some function modules like LIST FROM MEMORY , LIST TO TXT wnd WRITE LIST , it gives output in normal list format , But i need to print in ALV report .
    With the use of set table for 1st display i got the  ALV report   but not with actual data, (some junk value is showing) , So can any 1 suggest me how to get  the  actual data in ALV report, With the use of  Any Function Module or with Coding,
    with regards,

    Hi Saravana
    I am sure you must be getting the values in tables of table parameters from every FM.
    consolidate the values from tables of all FMs in one table and built ALV for that table only.
    I hope this way you can show the actual data in ALV.
    thanks
    Lalit

  • How to get the "current date" in the BEx?

    Hi all,
    I need to get the "current date" in my Bex report in order to make a comparison. I know there is a "How to" which shows how to get the current date via a User Exit, but I didn't find it. Could you please help me?
    Thanks

    1. Create a  New Formula in Key Figures structure
    2. Give tech name and description and Select "New variable" option
    3. Next screen will launch Variable Wizard -> create a new variable with replacement path as processing type
    4. in next screene  select the date characteristic that represents the first date to use in the calculation (From Date)
    5. In the next  screen select Key in the Replace Variable with field. Leave all the other options as they are
    6. In the next Currencies and Units screen select Date as the Dimension ID.
    6. Save variable
    repeate the Above steps to create another variable (To Date)
    and now you can use these two new replacement path variables in your new formula.
    Dev

  • How to get the context data using java script in interactive forms

    Hi All,
    How to get the context data using java script in interactive forms by adobe,  am using web dynpro java
    thanks.

    Hi venkat,
    Please Refer this link.
      Populating one Drop-Down list from the selection of another Drop-down list
    Thanks,
    Raju.

  • How  to get  response from such a  function

    How  to get  response from such a  function (in MODULE USER_COMMAND_0010 INPUT I get "ODGOVOR" 'X'
    FUNCTION Z_SEENKRAT.
    ""Local Interface:
    *"  EXPORTING
    *"     REFERENCE(ODGOVOR) TYPE  MSEG-KZEAR
    DATA ok_code LIKE sy-ucomm.
    DATA: test like mseg-kzear.
    BREAK-POINT.
    call screen 10.
    test = ODGOVOR.
    ENDFUNCTION.
    *&      Module  CLEAR_OK_CODE  OUTPUT
          text
    MODULE clear_ok_code OUTPUT.
      CLEAR ok_code.
    ENDMODULE.                 " CLEAR_OK_CODE  OUTPUT
    *&      Module  USER_COMMAND_0010  INPUT
          text
    MODULE USER_COMMAND_0010 INPUT.
    DATA odgovor LIKE mseg-KZEAR.
    CASE ok_code.
        WHEN 'DA'.
        ODGOVOR = 'X'.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0010  INPUT

    Hi,
    You need to declare the ODGOVOR variable in the TOP include, then you will get the value
    Regards
    Sudheer

  • How to get acknowlgmnt from EFT (debt card swap) machine from swing app.

    Hi,
    Please some 1 let me know how to get acknowlegdement from EFT ( debit card Swap) machine once it is connected to the computer.
    I have a code which seems to have no errors ut it I am not sure whether the EFT machine will be able to send or recieve the data once the car is swaped. because i dont know what is the response of the EFT machine when connected to the computer though a java swing class.
    I know it will be quite tidious job for you to go through my program but this is all i can do...or atleast give me a link where i can refer to such case.......I am using eclipe Ide....and have searched alot on google too......

    Vish_1x1 wrote:
    Hi,
    Please some 1 let me know how to get acknowlegdement from EFT ( debit card Swap) machine once it is connected to the computer.What do you mean by "acknowledgement"? You realise it needs some sort of authorising host in order to authorise, right?
    I have a code which seems to have no errors ut it I am not sure whether the EFT machine will be able to send or recieve the data once the car is swaped. because i dont know what is the response of the EFT machine when connected to the computer though a java swing class.Mumbo-jumbo
    I know it will be quite tidious job for you to go through my program but this is all i can do...or atleast give me a link where i can refer to such case.......I am using eclipe Ide....and have searched alot on google too......Where did you get this "EFT machine" (whatever that is)? Do you mean a card reader? An EMV terminal? A PDQ? What? Where did it come from? Start there. If you need to get this thing working, you must be part of an enterprise, which has access to resources such as hardware vendor support, merchant banking services and EFT software vendors. If you're not, then you might as well abandon all hope of using this machine to take cards on your own, because you can't. End of story
    And, no, nothing to do with Java

  • How to get format from textpane?

    iam changing the color and inserting image in jtextpane after i have to send a mail.
    how to get that formatted data and send to mail plz help in this case.
    change the code and send it. plz...............
    import java.awt.*;
    import javax.swing.*;
    import javax.swing.JTabbedPane.*;
    import java.awt.event.*;
    import java.io.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    import javax.swing.text.rtf.*;
    import java.util.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    public class loginform extends JFrame {
         JTabbedPane jtp = new JTabbedPane();
         public loginform() {
              Container c = getContentPane();
              JTabbedPane jtp = new JTabbedPane();
              jtp.addTab("COMPOSEMAIL", new ComposeMailPanel());
              c.add(jtp);
              c.validate();
         }//method
         public static void main(String a[]) throws Exception {
              loginform s = new loginform();
              s.setSize(800, 800);
              s.setVisible(true);
         }//main
    }//mainclass
    class ComposeMailPanel extends JPanel implements ActionListener {
         JTextField BCC;
         int start;
         int end;
         JLabel JLabel1;
         JLabel JLabel2;
         JLabel JLabel3;
         JLabel JLabel4;
         JFrame mainFrame = new JFrame();
         JTextField from;
         JTextField subject;
         JButton Send;
         String mailsentaddress = "";
         JButton bInsertPic = new JButton("P");
         JButton bForegroundColor = new JButton("F");
         JFileChooser insertIconFile = new JFileChooser();
         JColorChooser backgroundChooser = new JColorChooser();
         JColorChooser foregroundChooser = new JColorChooser();
         Color foregroundColor;
         JTextPane mainTextPane = new JTextPane();
         SimpleAttributeSet sas = new SimpleAttributeSet();
         MutableAttributeSet sas1 = new SimpleAttributeSet();
         StyleContext sc = new StyleContext();
         MutableAttributeSet mas;
         DefaultStyledDocument dse = new DefaultStyledDocument(sc);
         JScrollPane mainScrollPane = new JScrollPane(mainTextPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
         RTFEditorKit rtfkit = new RTFEditorKit();
         Dimension Size1 = new Dimension();
         public ComposeMailPanel() {
              setLayout(null);
              mainTextPane.setBounds(150, 325, 572, 150);
              mainTextPane.setContentType("text/html");
              mainTextPane.setEditorKit(rtfkit);
              mainTextPane.setDocument(dse);
              mainScrollPane.setBounds(150, 325, 572, 155);
              bInsertPic.setBounds(150, 300, 20, 20);
              bForegroundColor.setBounds(171, 300, 20, 20);
              add(mainScrollPane);
              add(bInsertPic);
              add(bForegroundColor);
              mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              bInsertPic.addActionListener(this);
              bInsertPic.setToolTipText("Insert picture");
              bForegroundColor.addActionListener(this);
              bForegroundColor.setToolTipText("Text color");
              JLabel1 = new JLabel("FROM  :");
              add(JLabel1);
              JLabel1.setBounds(30, 205, 110, 20);
              JLabel2 = new JLabel("BCC :");
              add(JLabel2);
              JLabel2.setBounds(30, 235, 110, 20);
              JLabel3 = new JLabel("SUBJECT :");
              add(JLabel3);
              JLabel3.setBounds(30, 265, 110, 20);
              JLabel4 = new JLabel("MESSAGE :");
              add(JLabel4);
              JLabel4.setBounds(30, 325, 110, 20);
              from = new JTextField();
              add(from);
              from.setBounds(150, 210, 577, 20);
              BCC = new JTextField();
              add(BCC);
              BCC.setBounds(150, 240, 577, 20);
              subject = new JTextField();
              add(subject);
              subject.setBounds(150, 270, 577, 20);
              Send = new JButton("Send");
              add(Send);
              Send.setBounds(720, 495, 65, 20);
              Send.addActionListener(this);
         }// constructor
         public void setAttributeSet(AttributeSet attr) {
              int xStart, xFinish, k;
              xStart = mainTextPane.getSelectionStart();
              xFinish = mainTextPane.getSelectionEnd();
              k = xFinish - xStart;
              if (xStart != xFinish) {
                   dse.setCharacterAttributes(xStart, k, attr, true);
              } else if (xStart == xFinish) {
                   mas = rtfkit.getInputAttributes();
                   mas.addAttributes(attr);
              // The below command line sets the focus to the JTextPane
              mainTextPane.grabFocus();
         public void actionPerformed(ActionEvent ae1) {
              JComponent b = (JComponent) ae1.getSource();
              String str3 = null;
              if (b == bInsertPic) {
                   insertIconFile.setDialogType(JFileChooser.OPEN_DIALOG);
                   insertIconFile.setDialogTitle("Select a picture to insert into document");
                   if (insertIconFile.showDialog(mainFrame, "Insert") != JFileChooser.APPROVE_OPTION) {
                        return;
                   File g = insertIconFile.getSelectedFile();
                   ImageIcon image1 = new ImageIcon(g.toString());
                   mainTextPane.insertIcon(image1);
                   mainTextPane.grabFocus();
              } else if (b == bForegroundColor) {
                   foregroundColor = foregroundChooser.showDialog(mainFrame,"Color Chooser", Color.white);
                   if (foregroundColor != null) {
                        String s1 = mainTextPane.getSelectedText();
                        StyleConstants.setForeground(sas, foregroundColor);
                        setAttributeSet(sas);
              } else if (ae1.getSource() == Send) {
                   String From = "";
                   String To = "";
                   String Subject = "";
                   String Body = "";
                   String Attachment = "";
                   String Hostname = "";
                   From = from.getText();
                   To = BCC.getText();
                   Subject = subject.getText();
                   try {
                        int ki = mainTextPane.getDocument().getLength();
                        Body = mainTextPane.getStyledDocument().getText(0, ki);
                        Hostname = "192.9.200.2";
                        SmtpAttachmentExample example1 = new SmtpAttachmentExample();
                        example1.sendMessage1(Hostname, To, From, Subject, Body);
                        mailsentaddress = BCC.getText();
                   } catch (Exception we1) {
    class SmtpAttachmentExample {
         public void sendMessage1(String hostname, String to, String from,
                   String subject, String body) {
              try {
                   Properties props = System.getProperties();
                   props.put("mail.smtp.host", hostname);
                   Session mailsession = Session.getDefaultInstance(props, null);
                   Message message = new MimeMessage(mailsession);
                   message.setFrom(new InternetAddress(from));
                   message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
                   message.setSubject(subject);
                   message.setSentDate(new Date());
                   MimeBodyPart messageBodyPart = new MimeBodyPart();
                   messageBodyPart.setText(body);
                   Multipart multipart = new MimeMultipart();
                   multipart.addBodyPart(messageBodyPart);
                   message.setContent(multipart);
                   Transport.send(message);
              } catch (Exception ert) {
         }//withoutattachement
    }thanks in advance
    raja

    here it is...simple is'nt it???
    package jwsdp.test;
    import java.awt.Color;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.ByteArrayInputStream;
    import java.io.ByteArrayOutputStream;
    import java.io.File;
    import java.util.Properties;
    import javax.swing.ImageIcon;
    import javax.swing.JButton;
    import javax.swing.JColorChooser;
    import javax.swing.JComponent;
    import javax.swing.JFileChooser;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTabbedPane;
    import javax.swing.JTextField;
    import javax.swing.JTextPane;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.text.AttributeSet;
    import javax.swing.text.DefaultStyledDocument;
    import javax.swing.text.MutableAttributeSet;
    import javax.swing.text.SimpleAttributeSet;
    import javax.swing.text.StyleConstants;
    import javax.swing.text.StyleContext;
    import javax.swing.text.rtf.RTFEditorKit;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    public class loginform extends JFrame {
         JTabbedPane jtp = new JTabbedPane();
         public loginform() {
              Container c = getContentPane();
              JTabbedPane jtp = new JTabbedPane();
              jtp.addTab("COMPOSEMAIL", new ComposeMailPanel());
              c.add(jtp);
              c.validate();
         }//method
         public static void main(String a[]) throws Exception {
              loginform s = new loginform();
              s.setSize(800, 800);
              s.setVisible(true);
         }//main
    }//mainclass
    class ComposeMailPanel extends JPanel implements ActionListener {
         JTextField BCC;
         int start;
         int end;
         JLabel JLabel1;
         JLabel JLabel2;
         JLabel JLabel3;
         JLabel JLabel4;
         JFrame mainFrame = new JFrame();
         JTextField from;
         JTextField subject;
         JButton Send;
         String mailsentaddress = "";
         JButton bInsertPic = new JButton("P");
         JButton bForegroundColor = new JButton("F");
         JFileChooser insertIconFile = new JFileChooser();
         JColorChooser backgroundChooser = new JColorChooser();
         JColorChooser foregroundChooser = new JColorChooser();
         Color foregroundColor;
         JTextPane mainTextPane = new JTextPane();
         SimpleAttributeSet sas = new SimpleAttributeSet();
         MutableAttributeSet sas1 = new SimpleAttributeSet();
         StyleContext sc = new StyleContext();
         MutableAttributeSet mas;
         DefaultStyledDocument dse = new DefaultStyledDocument(sc);
         JScrollPane mainScrollPane = new JScrollPane(mainTextPane, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
         RTFEditorKit rtfkit = new RTFEditorKit();
         Dimension Size1 = new Dimension();
         public ComposeMailPanel() {
              setLayout(null);
              mainTextPane.setBounds(150, 325, 572, 150);
              mainTextPane.setContentType("text/html");
              mainTextPane.setEditorKit(rtfkit);
              mainTextPane.setDocument(dse);
              mainScrollPane.setBounds(150, 325, 572, 155);
              bInsertPic.setBounds(150, 300, 20, 20);
              bForegroundColor.setBounds(171, 300, 20, 20);
              add(mainScrollPane);
              add(bInsertPic);
              add(bForegroundColor);
              mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              bInsertPic.addActionListener(this);
              bInsertPic.setToolTipText("Insert picture");
              bForegroundColor.addActionListener(this);
              bForegroundColor.setToolTipText("Text color");
              JLabel1 = new JLabel("FROM  :");
              add(JLabel1);
              JLabel1.setBounds(30, 205, 110, 20);
              JLabel2 = new JLabel("BCC :");
              add(JLabel2);
              JLabel2.setBounds(30, 235, 110, 20);
              JLabel3 = new JLabel("SUBJECT :");
              add(JLabel3);
              JLabel3.setBounds(30, 265, 110, 20);
              JLabel4 = new JLabel("MESSAGE :");
              add(JLabel4);
              JLabel4.setBounds(30, 325, 110, 20);
              from = new JTextField();
              add(from);
              from.setBounds(150, 210, 577, 20);
              BCC = new JTextField();
              add(BCC);
              BCC.setBounds(150, 240, 577, 20);
              subject = new JTextField();
              add(subject);
              subject.setBounds(150, 270, 577, 20);
              Send = new JButton("Send");
              add(Send);
              Send.setBounds(720, 495, 65, 20);
              Send.addActionListener(this);
         }// constructor
         public void setAttributeSet(AttributeSet attr) {
              int xStart, xFinish, k;
              xStart = mainTextPane.getSelectionStart();
              xFinish = mainTextPane.getSelectionEnd();
              k = xFinish - xStart;
              if (xStart != xFinish) {
                   dse.setCharacterAttributes(xStart, k, attr, true);
              } else if (xStart == xFinish) {
                   mas = rtfkit.getInputAttributes();
                   mas.addAttributes(attr);
              // The below command line sets the focus to the JTextPane
              mainTextPane.grabFocus();
         public void actionPerformed(ActionEvent ae1) {
              JComponent b = (JComponent) ae1.getSource();
              String str3 = null;
              if (b == bInsertPic) {
                   insertIconFile.setDialogType(JFileChooser.OPEN_DIALOG);
                   insertIconFile.setDialogTitle("Select a picture to insert into document");
                   if (insertIconFile.showDialog(mainFrame, "Insert") != JFileChooser.APPROVE_OPTION) {
                        return;
                   File g = insertIconFile.getSelectedFile();
                   ImageIcon image1 = new ImageIcon(g.toString());
                   mainTextPane.insertIcon(image1);
                   mainTextPane.grabFocus();
              } else if (b == bForegroundColor) {
                   foregroundColor = foregroundChooser.showDialog(mainFrame,"Color Chooser", Color.white);
                   if (foregroundColor != null) {
                        String s1 = mainTextPane.getSelectedText();
                        StyleConstants.setForeground(sas, foregroundColor);
                        setAttributeSet(sas);
              } else if (ae1.getSource() == Send) {
                   String From = "";
                   String To = "";
                   String Subject = "";
                   String Body = "";
                   String Attachment = "";
                   String Hostname = "";
                   From = from.getText();
                   To = BCC.getText();
                   Subject = subject.getText();
                   try {
                        int ki = mainTextPane.getDocument().getLength();
                        ByteArrayOutputStream l_out = new ByteArrayOutputStream();                  // added by Guilllaume
                        mainTextPane.getEditorKit().write(l_out,mainTextPane.getDocument(),0,ki);   // added by Guilllaume
                        Body = new String(l_out.toByteArray());                                     // added by Guilllaume
                    //     Body = mainTextPane.getStyledDocument().getText(0, ki); // supress by Guilllaume
                        Hostname = "192.9.200.2";
                        SmtpAttachmentExample example1 = new SmtpAttachmentExample();
                        example1.sendMessage1(Hostname, To, From, Subject, Body);
                        mailsentaddress = BCC.getText();
                   } catch (Exception we1) {
    class SmtpAttachmentExample {
         public void sendMessage1(String hostname, String to, String from,
                   String subject, String body) {
              try {
                   Properties props = System.getProperties();
                   props.put("mail.smtp.host", hostname);
                   Session mailsession = Session.getDefaultInstance(props, null);
                   Message message = new MimeMessage(mailsession);
                   message.setFrom(new InternetAddress(from));
                   message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to, false));
                   message.setSubject(subject);
                   message.setSentDate(new Date());
                   MimeBodyPart messageBodyPart = new MimeBodyPart();
                   messageBodyPart.setText(body);
                   Multipart multipart = new MimeMultipart();
                   multipart.addBodyPart(messageBodyPart);
                   message.setContent(multipart);
                   Transport.send(message);
              } catch (Exception ert) {
         }//withoutattachement
    }

  • How to get messages from IBM MQ in Oracle.

    Hi ,
    Can you please help me how to get messages from one IBM MQ to another IBM MQ in Oracle.
    My requirement is Our upstream is putting messages from their IBM MQ to our IBM MQ
    then we have to extract data from the message and load into Oracle database tables
    how to implement this  in oracle.
    Is there any other way to implement this without writing any ORACLE PL/SQL programming.
    Please help me.
    Thanks.

    You might want to use Oracle AQ: Integrating Oracle database applications with WebSphere MQ applications You will need to write some PL/SQL to Dequeue from Oracle AQ and convert the queue payload into insert statements.
    If you need help wityh AQ, there is a separate forum: Advanced Queueing

Maybe you are looking for