Power Builder - Error en UTL_SMTP

 
Vista:

Error en UTL_SMTP

Publicado por EdaurdoC (75 intervenciones) el 21/10/2009 18:09:59
Estimados,

Tengo un Procedure que me ejecuta correctamente en Oracle10g desde PBuider. pero cuando lo he copio para Oracle 8i al mandarlo a ejecutar tambien desde Power Builder 10.5, me da el siguiente error:

ORACLE - ODBC - "Syntax error or access violation " .

este es el procedimeiento si alguien le puede dar una revision o indicarme alguna pista:

OJO: si ejecuto el procedeminito desde el TOAD en Oracle8i si funciona.

CREATE OR REPLACE PROCEDURE "SENDY_MAIL"
( p_sender in varchar2,
p_recipient in varchar2,
p_message in varchar2,
p_cc in varchar2 ,
p_subject in varchar2
) as
l_mailhost Varchar2(255) :='100.134.1.6';
l_mail_conn utl_smtp.connection;

PROCEDURE send_header(name IN VARCHAR2, header IN VARCHAR2) AS
BEGIN
utl_smtp.write_data(l_mail_conn, name || ': ' || header || utl_tcp.CRLF);
END;

begin
l_mail_conn := utl_smtp.open_connection(l_mailhost, 25);
utl_smtp.helo(l_mail_conn, l_mailhost);
utl_smtp.mail(l_mail_conn, p_sender);
utl_smtp.rcpt(l_mail_conn, p_recipient);
utl_smtp.rcpt(l_mail_conn, p_cc);
utl_smtp.open_data(l_mail_conn );
send_header('Subject', p_subject);
utl_smtp.write_data(l_mail_conn, p_message);
utl_smtp.close_data(l_mail_conn );
utl_smtp.quit(l_mail_conn);

null;
end sendy_mail;
/
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Error en UTL_SMTP

Publicado por miguell (153 intervenciones) el 23/10/2009 10:20:19
Hola,

no tengo ni idea del paquete este utl_smtp y probablemente no te puedo ayudar mucho.

Sólo una cosa:
dices que en oracle 10 va bien pero en oracle 8 al ejecutar da error. (sí compila bien?).

Tu base de datos oracle 8 debe ser otra entonces y empezaría a ver si el paquete utl_smtp está lanzado correctamente y si tienes derechos de ejecución sobre ello.
(access violation? me huele a derechos (los GRANTS) )
Si también el servidor de correo es distinto / máquina cliente es distinta: no te olvides hechar un vistazo a la configuración de un posible antivirus: suelen bloquear el puerto 25 usado por smtp.

encontré un link donde tienen problemas parecidos:
http://www.forosdelweb.com/f100/enviar-correo-desde-oracle-con-utl_smtp-576743/

también vi algo sobre la utl_smtp en http://download.oracle.com/docs/cd/E11882_01/readmes.112/e11015/toc.htm , donde entre otras cosas hablan de derechos de CONNECT.:
te cito el texto (si necesitas traducción me lo dices):
----------------------------------------------------------------------
30.4 UTL_TCP, UTL_HTTP, UTL_SMTP, UTL_MAIL, and UTL_INADDR PL/SQL Packages
A new security measure is introduced in this release for the following network-related PL/SQL packages: UTL_TCP, UTL_HTTP, UTL_SMTP, UTL_MAIL, and UTL_INADDR. The invoker of those packages needs additional privileges to connect to an external host or to resolve the name or the IP address of a host. The packages check the invoker for the necessary privileges only when the calls are made at runtime and raises an exception if the invoker lacks the privileges. This new security measure is implemented by Oracle XML DB access control list (ACL) mechanism and, therefore, requires Oracle XML DB to be installed in order to use those packages.

Each external host that a database user wants to connect to or to resolve the name or IP address for from the database is restricted by an access control list (ACL). To grant a user the privileges for the host, the database administrator should create an ACL, add the privileges to the ACL for the user, assign the ACL to the host, and commit the changes using the DBMS_NETWORK_ACL_ADMIN PL/SQL package. For example, to give the users SCOTT and ADAMS the permission to connect to www.oracle.com via HTTP (namely to connect to TCP/IP port 80), the database administrator should complete the following:

SQL> REM Creates a new ACL and adds SCOTT the privilege to the ACL to make TCP connections
SQL> EXECUTE DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('acl_for_oracle.xml', -
> 'ACL for www.oracle.com', 'SCOTT', TRUE, 'connect')

SQL> REM Adds ADAMS the privilege to the ACL to make TCP connections also
SQL> EXECUTE DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE('acl_for_oracle.xml', -
> 'ADAMS', TRUE, 'connect')

SQL> REM Assigns the new ACL to www.oracle.com for TCP/IP port 80 (HTTP)
SQL> EXECUTE DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('acl_for_oracle.xml', -
> 'www.oracle.com', 80)

SQL> REM Commits to make the ACL take effect
SQL> COMMIT
The invoker of the UTL_TCP, UTL_HTTP, UTL_SMTP, and UTL_MAIL packages needs the 'connect' privilege to make TCP/IP, HTTP, or SMTP connections to the external host. The invoker of the UTL_INADDR package needs the 'resolve' privilege to resolve the name or the IP address of the external host. Note that those privileges are not granted through the GRANT SQL statement but through the DBMS_NETWORK_ACL_ADMIN package.

The current ACL assignment to external hosts and the privileges currently defined in the ACLs are shown through the system catalog views DBA_NETWORK_ACLS and DBA_NETWORK_ACL_PRIVILEGES.

The invokers of other database components that use those PL/SQL packages to perform network operations from the database, which are Oracle XML DB HttpUriType, Oracle Multimedia, and Oracle Spatial, are subject to the same network permission check and require the same privileges.
------------------------------------------------------

supongo que en el anterior ejemplo con puerto 80 habrá que hacer algo parecido para puerto 25

espero haber podido ayudar,
seguramente alguno te puede dar más información.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Error en UTL_SMTP

Publicado por EduardoC (75 intervenciones) el 23/10/2009 18:10:27
Gracias a todos , encontre la solucion

Para los que les pase algo similar,

El problema era el controlador ODBC.

Se debe utilizar el Microsoft ODBC for Oracle y funciona OK, yo estaba
utilizando el Oracle OBDC Driver.

gracias, a todos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Error en UTL_SMTP

Publicado por miguell (153 intervenciones) el 26/10/2009 13:04:29
Me alegro que lo hayas resuelto,

de todas formas ... entonces me parece que posiblemente más que nada era por la versión del odbc de oracle.

saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar