Jython scripts doesn't work when executing in ODI - oracle

I have an ODI job with a procedure that have 3 Tasks. These tasks are coded in Jython technology. When I execute these scripts using Jython standalone in my PC are working fine, but when I run them from the ODI menu these doesn't make nothing.
The execution is marked as OK and I don't see any error logs in any window.
I checked that code works in jython standalone. Tried with paths using "/", using "\", my folder (Using windows in development mode) has all permissions available.
FILE_NAME = "FILES-100-*-000001.csv"
NAS_FOLDER = "/apps/dataflow/src/"
WORK_FOLDER = "/apps/dataflow/target/"
#Extraemos prefijo y sufijo del fichero a procesar
splitted_value = FILE_NAME.split("*")
prefix = splitted_value[0]
suffix = splitted_value[1]
#Obtenemos listado de ficheros de la ruta del NAS y movemos los que cumplan condiciones al directorio WORK
files = os.listdir(NAS_FOLDER)
for file in files:
if file.find(prefix) >= 0 and file.find(suffix) > 0:
print "Fichero origen: " + NAS_FOLDER+file + " | Fichero destino: " + WORK_FOLDER+file
try:
os.rename(NAS_FOLDER+file, WORK_FOLDER+file)
except:
print("No se ha podido mover el fichero: " + NAS_FOLDER+file)
I expect the files moved succesfully. (These with the correct name and not moved before). I expect see any logs or error info too.
Thanks in advance.

Related

Replicate and rename archives

i'm really new in python. I'm trying to replicate and archive and rename with the information from list in csv (Same archive .jpg). Basically i don't know how to paste the information from csv and use to rename the archive.
i've got this
import shutil
import sys
import os
# Abrir archivo de entrada y obtener las lineas del archivo
raw_csv = open(csv_path, "r")
csv_lines = raw_csv.readlines()
for line in raw_csv:()
filename = file.index()
shutil.copy('rename.jpg', '')
enter code here
if somebody can help me, i really appreciate it.

Cannot connect to fresh installed DB2 on WINDOWS 10

I just installed a DB2 on my Windows 10 laptop.
Installation looks ok.
If I run db2level I get this answer:
C:\IBM\SQLLIB\BIN>db2licm -l
Nome prodotto: "IBM DB2 Developer-C Edition"
Tipo di licenza: "Comunità "
Data scadenza: "Permanente"
Identificativo prodotto: "db2dec"
Informazioni sulla versione: "11.1"
Quantità massima di memoria (GB): "16"
Numero massimo di core: "4"
Numero massimo di tablespace (GB): "100"
When I run db2licm -l I get this:
C:\IBM\SQLLIB\BIN>db2licm -l
Nome prodotto: "IBM DB2 Developer-C Edition"
Tipo di licenza: "Comunità "
Data scadenza: "Permanente"
Identificativo prodotto: "db2dec"
Informazioni sulla versione: "11.1"
Quantità massima di memoria (GB): "16"
Numero massimo di core: "4"
Numero massimo di tablespace (GB): "100"
DB2 is started, I can issue db2stop and db2start command without any issue.
And now the PROLBLEM: I cannot find a way to CONNECT to the DB2 instance.
In fact when I run CONNECT command CLPPlus window freezes this way:
CLPPlus window
while RAM usage start rising:
DB2 RAM usage
I googled IBM sites without finding any suitable solution.
Has anyone experienced the same problem?
Thanks a lot
Ettore
2018-10-22
I think you put me on the right way.
I checked whether I could create the SAMPLE database and I got this:
C:\IBM\SQLLIB\BIN>db2sampl
Creating database "SAMPLE"...
Existing "SAMPLE" database found...
The "-force" option was not specified...
Attempt to create the database "SAMPLE" failed.
SQL1005N L'alias del database "SAMPLE" esiste già nella directory del database locale oppure nella directory del database di sistema.
'db2sampl' processing complete.
So, SAMPLE database already existed, I tried to recreate it but operation failed:
C:\IBM\SQLLIB\BIN>db2sampl -force
Creating database "SAMPLE"...
Existing "SAMPLE" database found...
Dropping and recreating database "SAMPLE"...
Attempt to drop existing database "SAMPLE" failed.
Attempt to create the database "SAMPLE" failed.
SQL30082N Elaborazione di sicurezza non riuscita con codice di errore "3" ("PASSWORD MISSING"). SQLSTATE=08001
'db2sampl' processing complete.
Something was wrong with SAMPLE database.
So I tried to create a new database and it worked:
db2 => CREATE DATABASE TEST_DB AUTOMATIC STORAGE YES
DB20000I Il comando CREATE DATABASE è stato completato con esito positivo.
and CONNECT command worked too:
db2 => CONNECT TO TEST_DB
Informazioni sul collegamento del database
Server database = DB2/NT64 11.1.3.3
ID autorizzazione SQL = ETTORE
Alias database locale = TEST_DB
db2 =>
Then I tried to drop SAMPLE database:
db2 => DROP DATABASE SAMPLE
L'applicazione è già collegata a "DB2" mentre il comando emesso richiede un collegamento a "NDEDE68D" per l'esito positivo dell'esecuzione.
db2 =>
What does this mean?
When I give command DB2 in D:\IBM\SQLLIB\BIN I'm not aware about the Instance I'm connecting to. Is "NDEDE68D" another instance?
In any case I tried to connect TEST_DB to in DATA STUDIO and it succeeded:
IBM DATA STUDIO Connection to TEST_DB
while when I tried (again) to connect to SAMPLE db from the DB2 window, after a few seconds, DB2 had started devouring RAM:
RAM usage
Concluding, the problem now concerns just SAMPLE database.
How to connect to SAMPLE database or how to get rid of it and rebuild it?
Thanks a lot
2018-10-22 14:37
#Paul: here the answers to your questions.
Thanks a lot!
db2 => LIST NODE DIRECTORY
Directory nodo
Numero di voci nella directory = 1
Voce nodo 1:
Nome nodo = NDEDE68D
Commento
Tipo voce di directory = LOCAL
Protocollo = TCPIP
Nome Host = localhost
Nome servizio = 50000
db2 => LIST DATABASE DIRECTORY
Directory del database di sistema
Numero di voci nella directory = 2
Voce di database 1:
Alias del database = TEST_DB
Nome database = TEST_DB
Directory database locale = C:
Livello di release database = 14.00
Commento =
Tipo voce di directory = Indiretto
Numero partizione database catalogo = 0
Nome host server alternativo =
Numero porta server alternativo =
Voce di database 2:
Alias del database = SAMPLE
Nome database = SAMPLE
Nome nodo = NDEDE68D
Livello di release database = 14.00
Commento =
Tipo voce di directory = Remoto
Numero partizione database catalogo = -1
Nome host server alternativo =
Numero porta server alternativo =
db2 =>

copy file from one directory from one folder to another using sas

I matrying to copy the files which is coming to the main folder to another with out the date st. using the attached code to achive it . but getting tthe error message the System cannot find file specified.
%let rptpath = R:\CDW Reporting\Ad-Hoc\WR#_JAS0031 -Walls Regional HospitalHainey\Data Out\;
%let rptname = Walls Regional Hospital Hainey Report;
%let rptdate = today();
%let rptdatefmt = YYMMDDd10.;
data _NULL_;
cmd = "COPY &rptpath.&rptname" ||put(&rptdate,&rptdatefmt) || ".xlsx C:\Users\UCS1MKP\Desktop\y\&rptname..xlsx";
call system(cmd);
run; `
now how to overcome this.Thanks in advance.Manesh
Since your paths include spaces you need to add quotes around them in the generated COPY command.
cmd = "COPY ""&rptpath.&rptname"
|| put(&rptdate,&rptdatefmt)
|| ".xlsx"" ""C:\Users\UCS1MKP\Desktop\y\&rptname..xlsx"" "
;

Jython with wsadmin: WASX7017E com.ibm.ws.scripting.ScriptingException: Invalid object name

I have a Jython script calling wsadmin libraries to configure a WAS server.
I have these functions:
def createWasObject(was_object_type, was_path, object_params):
if isinstance(was_path, basestring):
was_path = AdminConfig.getid(was_path)
str_params = '['
for k,v in object_params.items():
str_params = str_params + '[' + k + ' "' + v + '"] '
str_params = str_params + ']'
return AdminConfig.create(was_object_type, was_path, str_params)
def createJdbcProviders(was_path, jdbc_providers):
was_object_type = 'JDBCProvider'
for jdbc_provider in jdbc_providers:
jdbc = createWasObject(was_object_type, was_path, jdbc_provider['params'])
print jdbc
for datasource in jdbc_provider['datasources']:
ds = createWasObject('Datasource', jdbc, datasource['params'])
print
The "print jdbc" prints:
Teradata JDBC Provider(cells/jsr-websphere-1Cell01/nodes/jsr-websphere-1Node01/servers/jsr-business|resources.xml#JDBCProvider_1444648929602)"
Which looks like a correct object ID
However, when using it to create a datasource, I get the following error:
WASX7017E: Exception reçue lors de l'exécution du fichier "/root/jsr_auto_deployment/jsr.py" ; informations sur l'exception : com.ibm.ws.scripting.ScriptingException: Invalid object name: "Teradata JDBC Provider(cells/jsr-websphere-1Cell01/nodes/jsr-websphere-1Node01/servers/jsr-business|resources.xml#JDBCProvider_1444648929602)"
I am using Jython 2.7 through a Thin client. Reusing an object returned by AdminConfig.create() was working well with a Jython script ran through wsadmin.sh
My problem was on that line:
was_path = AdminConfig.getid(was_path)
Most of the time I was passing a string but this time I was already using an ID. So I removed the AdminConfig.getid in the function and added it in the calls when necessary only.

How to connect to ftps site using microsoft internet transfer control 6.0 in vb6

In my exisiting visual basic 6 application I was connecting to an ftp site. Now the other side changed protocol to ftps and changed the port to 22.
My code do not work properly. I get error vb FTP run-time error '35753' "protocol not supported for this method".
I only changed the port in my code and the url
my old url was like ftp.xxx.com.tr
I changed the url to
sftps://ftp.xxx.com.tr
I am trying to connect to the same location using filezilla and it changes the url to sftps://ftp.xxx.com.tr so I copied it. There are similar questions in stackover (Transfer PDF file to ftp server in MS access 2007) but not for ftps. This is my code
With xControl
.AccessType = icDirect
.Protocol = icFTP
.RemotePort = 22
.RequestTimeout = 50
.url = xURL
.UserName = xUserName
.Password = xPassword
.Cancel
.Execute , "DIR " & xFileName
Do While .StillExecuting
DoEvents: DoEvents: DoEvents
Loop
gLogonFtp = "Connected to Host"
End With
Thank you for your time,
Ferda
I used psftp as – wqw (Mar 11 at 13:53) suggested on his comment. Here is my new code.
This is my script file
cd to_remotedir
lcd C:\path2 'local dir
mget * *
quit
result = ChangeFileContent("*", xOnlyFileName) //here I change the content of my script file psftpcommand.bat to get a specific file
Sleep 1000
Shell "C:/path/psftp.exe -v -pw " & xPassword & " " & xUserName & "#" & xURL & ":22 -b C:/path/psftpcommands.bat"
Sleep 1000
result = ChangeFileContent(xOnlyFileName, "*")//here I rechanged the content of the file. Change file name to ->*
'In the below I check if the requested file has come
Sleep 1000
If Dir("C:\path2\" & xOnlyFileName) <> "" Then
gLogonFtp = "Successful"
frmDataTransfers.lblTransferInfoDownLoad.Caption = "Dosya Çekildi " & xOnlyFileName
frmDataTransfers.lblTransferInfoDownLoad.Refresh
End If
That's all.
Thank you for your help.
Ferda

Resources