Showing posts with label ODI. Show all posts
Showing posts with label ODI. Show all posts

Tuesday, April 11, 2017

Change ODI Supervisor Account



Sometimes, you have several boxes and environments, and make a lot of configurations and we don't really keep tracking of all actions done until certain point of time. When you need that password you realize that you don't have it.

In ODI there's a user SUPERVISOR, who controls the master configuration of the tool.

If you want to change it please do the following:

1.- Log in with the master repo user

2.- Execute the following statement:

update snp_user set pass='aYyH5kyea2TN2.YuxopAMy'  
where wuser_name = 'SUPERVISOR'

Where pass is the new encoded password, encoded with the ODI utility encode.sh

Location:
/product/111/odi_111/odi_111/oracledi/agent/bin/encoded.sh newpassword

sh encode.sh newPassword
aYyH5kyea2TN2.YuxopAMy

and once again!,  easy no?




Thursday, February 16, 2017

Send E-mail FDMEE + Jython

Customer asked me to send e-mail with atachment to multiples receivers

The code I wrote:

#------------------------------------------------------------------------------
# Oracle Send Mail with Atachment
#-------------------------------------------------------------------------------
import smtplib
import mimetypes
import email
import email.mime.application
import java.lang as lang
import decimal


fdmAPI.logInfo("Custom Script: Inicia envio de Correo HFDM")

strMsg = email.mime.Multipart.MIMEMultipart()
strOutPath = fdmContext['OUTBOXDIR']+"/reports/"
strInMailPath = fdmContext['INBOXDIR']+"/BMB_LOC_EMAIL/"
strEmailInfo = strInMailPath+"RemitDest.txt"
fdmAPI.logInfo("strOutPath: " + strOutPath)
fdmAPI.logInfo("strInMailPath: " + strInMailPath)
fdmAPI.logInfo("strEmailInfo: " + strEmailInfo)
flag="true"


try:
allItems=[]
recipient=[]
allRecipients=[]
filemail = open(strEmailInfo, 'rb')
for row in filemail.readlines():
items = row.split(':')
for item in items:
fdmAPI.logInfo("ITEMS:"+item)
allItems.append(item)
strSender = allItems[1]
fdmAPI.logInfo("strSender: "+strSender)
recipientStr= allItems[3]
fdmAPI.logInfo("recipientStr: "+recipientStr)
recipients = recipientStr.split('|')
for recipient in recipients:
fdmAPI.logInfo("recipient:"+recipient)
allRecipients.append(recipient)

except Exception, e:
print "Error: unable to open mail file: " + str(e)
recipient=[]
recipient=allRecipients
strSubject = "FDMEE Mensaje de Prueba"
strReceivers = recipient if type(recipient) is list else [recipient]
strMsg['Subject'] =  strSubject
strMsg['From'] = strSender
strMsg['To'] = ", ".join(strReceivers)
fdmAPI.logInfo("strMsgTo: " + strMsg['To'])

loadid_s = str(fdmContext['LOADID'])
strFileName = loadid_s + ".pdf"
strRelativeFilePath = strOutPath + strFileName
strTxt = "Se ha generado el reporte <b>"+strFileName+"</b> de Financial Dara Management Enterprise Edition <br> para mas detalle consulte <a href='https://WORKSPACE_URL/workspace/index.jsp'>FDMEE</a><br><img src='http://www.oracle.com/us/assets/oraclelogo.jpg'>"

body = email.mime.Text.MIMEText(strTxt,'html')
strMsg.attach(body)

fp=open(strRelativeFilePath,'rb')
att = email.mime.application.MIMEApplication(fp.read(),_subtype="pdf")
fp.close()

att.add_header('Content-Disposition','attachment',filename=strFileName)
strMsg.attach(att)


try:
smtpServer = smtplib.SMTP('ORACLE_SMTPSERVER:25')
smtpServer.starttls()
smtpServer.sendmail(strSender, strReceivers, strMsg.as_string())
print "Successfully sent email"
smtpServer.quit()

except Exception, e:
print "Error: unable to send email: " + str(e)



Easy no?