How to use Java with PL/SQL commands to send an email with attachment

Apologizes in advance if this is the wrong place to ask the question.
I need to use Java with PL/SQL commands to send an email with attachment. My java application runs from the command line and does some magic to gather info from an Oracle 11g db. If the DB has sendmail configured, I'd like to send the results of the data gathering as an attachment to the email addresses. I'm not sure how to do this. I've been reading up on on PL/SQL can send email with UTL_SMTP - with attachments. I'm just not sure how to translate that into being triggered by my Java application. Any suggestions or pointers on what I should read would be appreciated.
Background - I've been programming in Java for 10+ years, but this is my first time using databases. I also have been on these forums for a long time, but lost my profile when it was switched to Oracle.
Thanks for all help.

user13726880 wrote:
The original requirements were put together and given to me, an Oracle newbie. They expected the Java app to use something intrinsic to Oracle and Unix sendmail. To solve my problem, I use a JDBC connection to run some SQL commands. I take that data, format it and send the results by email to the user. By default the requirement is to send it as an HTML attachment using Unix 'sendmail'. So I do that using Runtime exec. I have also added JavaMail functionality as an alternative to sendmail. It works great and as expected.Sounds like a reasonable solution.
Note however that PL/SQL itself can send email. And PL/SQL can call unix sendmail too.
However myself I would have done it in java with JavaMail.

Similar Messages

  • How to use alias in "From" field when I send a mail with utl_smtp ?

    Hi all,
    I'm using a PL/SQL package with an Oracle 11G database to send mails. It works fine but instead of use of my mail in "From" field like "[email protected]" as sender E-mail address, I would like to have "Toto" in the sender address. I tryied to use utl_smtp.mail(l_connection, '<toto> [email protected]') but it doesn't work. The only way I can send mail is when I set utl_smtp.mail(l_connection, '<[email protected]>') directly. When I use the Alias, I have an error from smtp server telling that I use a bad syntax address.
    Does someone know how to use the alias ? Where do I do a mistake ?
    Thank you for your help.
    sis2b

    Thank you, I find how to solve the problem thanks to your link.
    I try to send HTML E-mail so I had the From in the from field writen in the header of the mail and not to initialize the connection.
    sis2b.

  • Scheduling crontab to send an email with an attachement?

    (second post, 1st in wrong forum)
    Hey everyone,
    Does anyone know how to set up a command to send an email with an attachement? From what I've been informed so far, I inputed:
    0 22 * * * (cat mailtext; uuencode filename.txt filename.txt) | mail -s 'here is the backup log' [email protected]
    #The first filename.txt will also have the file path preceding it.
    I done all this and still no email. Do I have to enable smtp or set up the mail server?
    Any help would be much appreciated. Thanks!
    Xserve   Mac OS X (10.4.2)  

    What you're describing doesn't make any use of Automator.
    That being said, using command line "mail" does require that the Unix mail system be set up. This site has a utility for doing that.
    If you want to use Automator (the subject of this forum), you might try this:
    Create a new Automator workflow with these three actions:
    Get Specified Finder Items -- put your desired attachment(s) in the list
    New Mail Message -- fill in all appropriate fields
    Send Outgoing Messages
    Once you confirm that the workflow works, save it as an application. Then you can make it repeat with cron like you specified in your posting, but with the Automator task. E.g., if you saved it to the desktop, and with the name AutoSendDailyReport, edit your crontab:
    <pre>0 22 * * * ~/Desktop/AutoSendDailyReport.app/Contents/MacOS/AutoSendDailyReport</pre>
    Note that in this example, you'll need to be logged in at the time the cron job runs, so that the applications can run. It will automatically launch Mail, if not already running, and send the email.
    Alternatively, you can use iCal to schedule the task: set up a repeating event, with the alarm set to open the workflow app created above. Once again, you'll need to be logged in at the time the mail is to be sent.
    Titanium PowerBook   Mac OS X (10.4.4)  

  • How to use java integrate with ondemand

    Hi All,
    As i'm new to integration, can anyone help me to use java integrate with ondemand that inserts some records in ondemand and deletes some records from ondemand in secheduled interval basis.?
    Thanks in advance..!
    regards
    sowm

    Greetings,
    hi forum...
    how to use Java WebStart with EJB ? examples ?Well, for starters these are complementing, not 'cooperating', technologies. I presume, since EJB's do not - directly, at least - communicate with a web browser, that you intend for "Java WebStart" to somehow invoke an EJB?? Java WebStart is a technology for running client-side (Java) applications from the web browser - perceptively, the application resides on the server, but technically it, like an applet, is downloaded to the client and run there. Unlike an applet, however, it is not constrained by "sandbox" restrictions and does not have to be re-downloaded each time it is invoked - though the process allows for automagically updating the client-side with new versions of the application. ;) So, with this in mind, to "use Java WebStart with EJB" means little more than deploying an EJB client application with Java WebStart as the distribution channel.
    thanks
    minduRegards,
    Tony "Vee Schade" Cook

  • How to use Java WebStart with EJB ?

    hi forum...
    how to use Java WebStart with EJB ? examples ?
    thanks
    mindu

    Greetings,
    hi forum...
    how to use Java WebStart with EJB ? examples ?Well, for starters these are complementing, not 'cooperating', technologies. I presume, since EJB's do not - directly, at least - communicate with a web browser, that you intend for "Java WebStart" to somehow invoke an EJB?? Java WebStart is a technology for running client-side (Java) applications from the web browser - perceptively, the application resides on the server, but technically it, like an applet, is downloaded to the client and run there. Unlike an applet, however, it is not constrained by "sandbox" restrictions and does not have to be re-downloaded each time it is invoked - though the process allows for automagically updating the client-side with new versions of the application. ;) So, with this in mind, to "use Java WebStart with EJB" means little more than deploying an EJB client application with Java WebStart as the distribution channel.
    thanks
    minduRegards,
    Tony "Vee Schade" Cook

  • How to use Java Web Start with EJB ?

    hi forum...
    how to use Java WebStart with EJB ?
    examples ?
    thanks...
    mindu

    Mindu,
    WebStart will work with EJB. I use it with WebLogic Server. You have to make sure and deploy the weblogic.jar file - sign it if needed.
    For signing information, look here,
    http://java.sun.com/products/javawebstart/1.2/docs/developersguide.html
    Dan

  • How to use multiple JREs (1.5.0_20 and 1.6.0_07) with Internet Explorer 8?

    Hi!
    Question about the problem mentioned in subject.
    I have configured that JNLP opens with 1.5 version, both versions are enabled in Java Control Panel Runtime Settings but when I try to start a desktop java console says:
    Java Web Start 1.5.0_22
    Using JRE version 1.6.0_07 Java HotSpot(TM) Client VM
    And the opening of the desktop creates an exception:
    Java Web Start - Invalid Argument Error
    TooManyArgumentsException[ Too many arguments supplied: {C:\WINDOWS\Temporary, Internet, Files\Content.IE5\....
    I'm trying to open my desktop with 1.5 version and other programs with 1.6 version. What is it that I still need to do? I'm kind of confused with this. Some of my collagues have succeeded with this and some doesn't, with the same configuration.
    So the question is, how to use multiple JREs with IE8 so that one application uses 1.5 version and others 1.6 version?
    Br,
    Katri
    Edited by: ka**** on 09-Mar-2011 01:16
    Edited by: ka**** on 09-Mar-2011 03:16

    ka**** wrote:
    ..Question about the problem mentioned in subject.No "Using multiple JREs (1.5.0_20 and 1.6.0_07) with Internet Explorer 8" is a statement. To transform it to a question would be something like "How to use multiple JREs (1.5.0_20 and 1.6.0_07) with Internet Explorer 8?".
    Once you can come up with an actual question, I might look at this more closely.

  • Why can I not attach a document to an email? Every time I want to send an email with a document attached to it, an error notice pops out. It tell me that the file is being used even when  it is not. How can I fix this issue?

    Why can I not attach a document to an email? Every time I want to send an email with a document attached to it, an error notice pops out. It tells me that the file is being used even when  iall other programs are closed. How can I fix this issue?

    Thanks Jeff, I was not aware that a template could be multi-page.  (All the existing templates were 1 page)
    But it worked, saving me some steps.  When I was finished I renamed the document, and locked it.
    Then tried to save it but  could not because it was locked.  I closed it, went to my Spread Sheet Folder ,
    to find it, it was not there.  The Finder could not find it either.
    So I start over again.
    I opened up Numbers and it showed my personal Numbers template folder, it contained both my new 
    original 4 page template and the vanished saved document!
    I tried to delete the template containing these document data and could not - I had to go to the Library/Application Support/Numbers to physically remove it from this folder. Then I started over again.  I Finally found out how to make it work: I can now "save as", and then lock, and it will go to place where I want it to be saved and locked.
    The secret is: Click on the document title in the menu bar, and it opens up  "Save as...", which works the same as in OS 10.4.11, and you can pick the place you want for saving.  Once done that, you can then lock the document in the same pull down menu, and then close it.
    I also found later that I can delete a template from its folder, by letting Numbers open the templates,
    clicking on the one I want to remove, then go to the "Numbers Menu/File/Move to...", select "Desktop"
    and from there the selected template can then be thrown into the Trash from there.
    It appears now that the real fault of the Numbers software is that the "Save as" command is not available in the "Edit" or "File" pull-down menus, but hidden behind the title of the document.

  • How to use java source in Oracle when select by sqlplus.

    How to use java source in Oracle when select by sqlplus.
    I can create java source in Oracle
    import java.util.*;
    import java.sql.*;
    import java.util.Date;
    public class TimeDate
         public static void main(String[] args)
    public String setDate(int i){
    GregorianCalendar calendar = new GregorianCalendar();
    calendar.setTime(new Date((long)i*1000));
    System.out.println("Dateline: "
    + calendar.get(Calendar.HOUR_OF_DAY) + ":"
    + calendar.get(Calendar.MINUTE) + ":"
    + calendar.get(Calendar.SECOND) + "-"
    + calendar.get(Calendar.YEAR) + "/"
    + (calendar.get(Calendar.MONTH) + 1) + "/"
    + calendar.get(Calendar.DATE));
    String n = calendar.get(Calendar.YEAR) + "/" + (calendar.get(Calendar.MONTH) + 1) + "/" + calendar.get(Calendar.DATE);
         System.out.print(n);
         return n;
    I have table name TEST
    ID DATE_IN
    1 942685200
    2 952448400
    When I write jsp I use method setDate in class TimeDate
    The result is
    ID DATE_IN
    1 1999/11/16
    2 2003/7/25
    Thanks you very much.

    It is unclear where you are having a problem.  Is your issue at runtime (when the form runs in the browser) or when working in the Builder on the form?
    Also be aware that you will need to sign your jar and include some new manifest entries.  Refer to the Java 7u51 documentation and blogs that discuss the changes.
    https://blogs.oracle.com/java-platform-group/entry/new_security_requirements_for_rias
    http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/manifest.html

  • You want to know the amount of space the transaction log for the Customer database is using. Which T-SQL command would you use?

    You want to know the amount of space the transaction log for the Customer database is using. Which T-SQL command would you use?

    Forced me to do a little research.
    DBCC SQLPERF(logspace)
    See also
    http://stackoverflow.com/questions/198343/how-can-i-get-the-size-of-the-transaction-log-in-sql-2005-programmatically
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • How to use Java Beans In JSTL?

    Hi
    I want to know how to use Java bean in JSTL
    please explain this with giving any one example.
    Thanks-
    Swapneel

    A bean is obtain by <jsp:useBean> tag nd once bean is obtained we can get its property by using getProperty tag.

  • How to use java api for function activity in embed oracle workflow?

    because i can't install standalone oracle workflow successfully.
    pls tell me how to use java api for function activity in embed oracle workflow?
    are there some patch or pulg-in package?
    ths a lot...........

    The Java Function Activity Agent is not certified for Oracle Workflow embedded in Oracle Applications. Installing standalone workflow should be a lot easier than what you have found, although it looks like you did hit a Pentium 4 issue with the Oracle Universal Installer. I suggest you contact Oracle Support or Oracle Consulting for assistance.
    because i can't install standalone oracle workflow successfully.
    pls tell me how to use java api for function activity in embed oracle workflow?
    are there some patch or pulg-in package?
    ths a lot...........

  • How to use Java as a Front-end app

    how java application can be used as the Front-end interfaces to Forte based
    applications???
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    Rajiv,
    If you have Forte's WebEnterprise product, and Forte version 3.0.G.x or
    later, you have the ability to export an IIOP interface for any Forte
    service object. In fact, you can go one step further and generate a Java
    interface that "hides" the IIOP issues from the developer. The way you do
    this is to do the following:
    1) From the partitioning workshop, double click on the service object you
    wish to expose as an IIOP interface. This will bring up the Service Object
    Properties dialog.
    2) Off the Export tab, set the External Type drop down to IIOP. If IIOP is
    not an available option in the drop down list then you do not have
    WebEnterprise install.
    3) From here you need to set up the necessary IIOP configuration parameters
    (see the documentation for details on the specifics of what the parameters
    control).
    4) If you want to have Forte generate a JavaBean interface and the necessary
    Java classes to be called by your application then make sure you select the
    Java parameter at the bottom of the Configuration dialog. If IDL is
    selected then Forte will generate a generic IDL interface.
    5) When you make your distribution Forte will generate the Java classes for
    you.
    This mechanism works very well for accessing a Forte service object from a
    Java application.
    Good Luck!
    Jeff Wille
    -----Original Message-----
    From: Rajiv Srivastava <[email protected]>
    To: [email protected] <[email protected]>
    Date: Wednesday, December 09, 1998 2:03 PM
    Subject: how to use Java as a Front-end app
    how java application can be used as the Front-end interfaces to Forte based
    applications???
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

  • How to use the DISPLAY RECORD Setup Command in an etext file?

    Hi All,
    How to use the DISPLAY RECORD Setup Command in an etext file?
    I want to display a <NEW RECORD> conditionally. The condition will be based on the data coming through from the xml file.
    Please help me with an example. The BI User guide also doesnt show any examples.
    Your help is appreciated.
    Rgds,
    Kiran Panditi

    Hi,
    You can use vb coding in BEx Analyser to calculate your unit price. For this you have to first display the attributes of your object "XYZ". Then you can use VB cosing to calculate the value for the unit price field.
    One more thing cna you clarify whether is it display attribute or variable ?
    Regards,
    Balajee

  • Using java in Pl-SQL

    hi all,
    anybody plz tell me funda of using java in pl-sql with oracle 9i ,if possible send an example to my ID [email protected]
    Regards,
    Ajay

    Hi,
    It's all documented and online:
    http://download.oracle.com/docs/cd/B10501_01/java.920/a96659/toc.htm
    http://download.oracle.com/docs/cd/B10501_01/java.920/a96659/05_dev.htm#22878
    10G doc, but might be interesting too:
    http://download.oracle.com/docs/cd/B19306_01/java.102/b14187/chone.htm#BABCFIIF

Maybe you are looking for

  • Question on a specific Group Policy setting for SCCM Updates

    Hello, This may not exactly be the correct forum for this question but in looking around I didn't come up with an immediate answer and was hoping someone else had this issue. I have a WSUS server and am moving over to SCCM for updates. I've actually

  • Officejet Pro 8600 capability to save pictures from an SD card on my computer?

    I can read the pictures from SD card onto the printer, and print them using the SD slot provided on the front of the 8600 printer. However, I also would like to save the pictures in a folder on my computer. Is this possible with the 8600 printer?

  • Issue with attaching pdf in work item

    Dear Friends,   I am trying to attach Adobe form output to a work item and send it in for approval. I have converted the Adobe form output to binary format inside the program using function module 'SCMS_XSTRING_TO_BINARY and passed it to the workflow

  • Having multiple level of master/detail with data tags

    Hi, Here is a Database Model for the purpose : - An EMPLOYEE is in one and only one DEPT - a DEPT has several EMPLOYEEs Suppose that: - An EMPLOYEE come from one and only one SCHOOL which is in a SCHOOL table - a SCHOOL have educated several EMPLOYEE

  • Sax Parser application

    I have a Sax Parser Application which is working fine for parsing file with paths from D: or O: or N: Also I have the rights to access C: , but it gives me a following error when I access from C: java.net.MalformedURLException: unknown protocol: c at