Sysdate from oracle db in mm/dd/yyyy hh24:mi:ss format
I am trying to get sysdate from oracle db in mm/dd/yyyy hh24:mi:ss format but the result it gives back is 00:00:00 for hh24:mi:ss.
code:
try
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection( connStr, userName, passWord );
PreparedStatement pstmtQuery = con.prepareStatement(" SELECT to_date(to_char(sysdate,'mm/dd/yyyy hh24:mi:ss'), 'mm/dd/yyyy hh24:mi:ss') SYS_DATE FROM DUAL" );
ResultSet rsQuery = pstmtQuery.executeQuery();
DateFormat localFormat1 = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
java.sql.Date date3 = null;
if(rsQuery.next())
date3 = rsQuery.getDate("SYS_DATE");
System.out.println("\ndatabase sysdate: " + localFormat1.format( date3 ));
catch (SQLException sqle)
sqle.printStackTrace();
catch (java.lang.Exception e)
e.printStackTrace();
}
When you use the to_date function, the result you get back will be in the default date format as specified by the nls_date_format property. The data is stored properly (i.e., it includes the time values), but when it's displayed it's displayed in the standard format. So even if the datetime is 10/11/2001 10:12:35, the value that will be displayed when you select sysdate will be 11-OCT-01 if you're using the default date format of DD-MON-YY.
Are you sure that your statement is returning the desired string when you type it directly into SQL? If so, then I have to guess that your default date format is set up the way you want it when you go into SQL directly, but that a different default date format is used when you're executing the statement via jdbc.
I've never tried setting the default date format through jdbc, so I don't know if it will work, but the way to set the format is to alter the session:
alter session set nls_date_format = 'mm/dd/yyyy hh24:mi:ss';
HTH,
Rich
Similar Messages
-
Copying from Oracle SQL Developer Worksheet doesn't retain formatting (font,color etc...)in Microsoft Word but copying from other programs such as
visual studio, chrome browser etc works fine. This doesn't work even after changed the setting to Keep Source formatting of Options-> Copy and Paste SettingsHi,
I notice that you have cross posted in Answers forum and Oracle forum. Have you tried Mr. Peter's suggestion?
Then, I recommend we check the Word settings:
1. Go to: Options > Advanced > Cut, Copy and Paste
2. Make sure that Use smart cut and paste is ticked.
3. Click the Settings button next to this option
4. Make sure that Smart Style
Behavior is checked.
If the issue still exists, please upload a sample through One Drive, I want to test.
Regards,
George Zhao
TechNet Community Support -
Extract data from Oracle Database and store it into a CSV file format
Hello.
I'm trying to export a table from an Oracle Database into CSV file format with any Oracle adaptor and store it into a HDFS system.
How could I do it?
Thanks in advance!Xavi wrote:
HI Charles. Could I use.. Oracle Data Integrator Application Adapter for Hadoop? For this purpose?
Thanks in advancePerhaps. I have to confess that I am not familiar enough with ODI to know if that is within its capabilities.
You might see if there is a forum for ODI and post your question to that.
Charles Lamb -
Migration from oracle to standard sap bw components
client using an oracle based corporate data warehouse management wants to migrate for sap bw. they are now using oracle for central reporting system.
what kind of extraction has to be used?
is table from oracle warehouse has to be converted to other any format(for extraction)? if yes what format is preferrable?Hi,
Oracle data base tables can extracted in SAP BW by using DB Connect and staged in SAP BW objects for reporting.
You may refer SAP library or various available artcles on DB Connect for details.
I hope it will help.
THanks,
S -
'dd-mm-yyyy hh24:mi:ss ' convertion
'20061106024500' i want to convert it into 'dd-mm-yyyy hh24:mi:ss format how will i do this.
This?
select
to_char(to_date('20061106024500', 'YYYYMMDDHH24MISS'),'dd-mm-yyyy hh24:mi:ss') new_format from dual -
Error while converting schema from oracle to SQL server
Hello,
I am getting following error while converting schema from oracle to SQL server using SSMA.
I get Errors 1-3 while migrating procedures and error 4 while migrating a table.
1- O2SS0050: Conversion of identifier 'SYSDATE' is not supported.
2- O2SS0050: Conversion of identifier 'to_date(VARCHAR2, CHAR)' is not supported.
3- O2SS0050: Conversion of identifier 'regexp_replace(VARCHAR2, CHAR)' is not supported.
4- O2SS0486: <Primary key name> constraint is disabled in Oracle and cannot be converted because SQL Server does not support disabling of primary or unique constraint.
Please suggest.
Thanks.The exact statement in oracle side which causing this error (O2SS0050:
Conversion of identifier 'to_date(VARCHAR2, CHAR)' is not supported.) is below:
dStartDate:= to_date(sStartDate,'MON-YYYY');
Statement causing error O2SS0050:
Conversion of identifier 'regexp_replace(VARCHAR2, CHAR)' is not supported is below.
nCount2:= length(regexp_replace(sDataRow,'[^,]'));
So there is no statement which is using to_date(VARCHAR2,
CHAR) and regexp_replace(VARCHAR2, CHAR) in as such. 'MON-YYYY' and '[^,]'
are CHAR values hence SSMA is unable to convert it from varchar2 to char.
Regarding SYSDATE issue, you mean to put below code in target(SQL) side in SSMA ?
dDate date := sysdate;
Thanks. -
How to mail pdf file from oracle database 11g
Hi,
Using following code to send pdf file from oracle database.
DECLARE
v_From VARCHAR2(80) := '[email protected]';
v_Recipient VARCHAR2(80) := '[email protected]';
v_Subject VARCHAR2(80) := 'test subject';
v_Mail_Host VARCHAR2(30) := '116.214.31.249';
v_Mail_Conn sys.utl_smtp.Connection;
crlf VARCHAR2(2) := chr(13)||chr(10);
BEGIN
v_Mail_Conn := sys.utl_smtp.Open_Connection(v_Mail_Host, 26);
sys.utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
sys.utl_smtp.Mail(v_Mail_Conn, v_From);
sys.utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
sys.utl_smtp.Data(v_Mail_Conn,
'Date: ' || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
'From: ' || v_From || crlf ||
'Subject: '|| v_Subject || crlf ||
'To: ' || v_Recipient || crlf ||
'MIME-Version: 1.0'|| crlf || -- Use MIME mail standard
'Content-Type: multipart/mixed;'|| crlf ||
' boundary="-----SECBOUND"'|| crlf ||
crlf ||
'-------SECBOUND'|| crlf ||
'Content-Type: text/plain;'|| crlf ||
'Content-Transfer_Encoding: 7bit'|| crlf ||
crlf ||
'some message text'|| crlf || -- Message body
'more message text'|| crlf ||
crlf ||
'-------SECBOUND'|| crlf ||
'Content-Type: file;'|| crlf ||
' name="D:\mail\pdfSample.pdf"'|| crlf ||
'Content-Transfer_Encoding: 8bit'|| crlf ||
'Content-Disposition: attachment;'|| crlf ||
' filename="D:\mail\pdfSample.pdf"'|| crlf ||
crlf ||
'CSV,file,attachement'|| crlf || -- Content of attachment
crlf ||
'-------SECBOUND--' -- End MIME mail
sys.utl_smtp.Quit(v_mail_conn);
EXCEPTION
WHEN sys.utl_smtp.Transient_Error OR sys.utl_smtp.Permanent_Error then
raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
END;
Above code executed successfully and mail is send to recipient but file is corrupted.
I think it doesn't pick file from specified location, attachment name is appearing like this 'D:mailpdfsample.pdf
Oracle Database : 11g R2
O.S : windows 7 Professional
Thanks in Advanceparapr wrote:
sys.utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);The above violates RFC 5321 section 4.1.1.1
'-------SECBOUND'|| crlf ||
'Content-Type: file;'|| crlf ||
' name="D:\mail\pdfSample.pdf"'|| crlf ||
'Content-Transfer_Encoding: 8bit'|| crlf ||
'Content-Disposition: attachment;'|| crlf ||
' filename="D:\mail\pdfSample.pdf"'|| crlf ||Invalid Mime header above. Filename are logical. Not physical. Loose the drive and directory names. The filename is there to name the Mime body's content.
crlf ||
'CSV,file,attachement'|| crlf || -- Content of attachmentHow is the above PDF content? This is a string containing the text CSV,file,attachement. Which means when this is what is saved as a PDF file by the mail reader.
EXCEPTION
WHEN sys.utl_smtp.Transient_Error OR sys.utl_smtp.Permanent_Error then
raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
END;Silly. Why change meaningful exceptions into a generic meaningless exception?? That does not make any sense. -
Sending Unicode HTML email from Oracle
Dear All,
How we can send the HTML email from Oracle in Unicode format (I am using Arabic Language, to be specific). So far I have tried the following solutions (using utl_smpt) without any success (either i see junk characters in the email or see question marks). Would you please help me in solving this?
Options Tried*
Option 1
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE PROCEDURE p_send_mail_test (
2 sender IN VARCHAR2,
3 recipient IN VARCHAR2,
4 subj IN VARCHAR2,
5 message IN VARCHAR2)
6 IS
7 mailhost VARCHAR2(30) := '<smtp Server>';
8 c utl_smtp.connection;
9 PROCEDURE send_header( name IN VARCHAR2, header IN VARCHAR2) AS
10 BEGIN
11 utl_smtp.write_data(c, name || ': ' || header || utl_tcp.CRLF);
12 END;
13 BEGIN
14 c := utl_smtp.open_connection(mailhost,25);
15 utl_smtp.helo(c, mailhost);
16 utl_smtp.mail(c, sender);
17 utl_smtp.rcpt(c, recipient);
18 utl_smtp.open_data(c);
19 send_header('From', sender);
20 send_header('To', recipient);
21 -- If you need to send mail to more than one receipient, uncomment the
22 -- following line(s) as appropriate. Please don't forget the ","
23 -- in the "To" line before the next receipient's email id. You can't
24 -- use a comma separated list in the receipient parameter.
25 -- For variable number of "To"'s and "Cc"'s have multiple calls to
26 -- "send_header" function inside a cursor for loop.
27 -- Similar comments apply for "Cc" too.
28 -- send_header('To', ',<email@domain>');
29 send_header('Cc', ',<email@domain>');
30 send_header('Subject', subj);
31 utl_smtp.write_data(c, utl_tcp.CRLF || message);
32 utl_smtp.close_data(c);
33 utl_smtp.quit(c);
34 EXCEPTION
35 WHEN utl_smtp.transient_error OR utl_smtp.permanent_error THEN
36 utl_smtp.quit(c);
37 raise_application_error(-20000,
38 'Failed to send mail due to the following error: ' || sqlerrm);
39* END;
SQL>
SQL> /
Procedure created.
SQL> ed
Wrote file afiedt.buf
1 declare
2 email_text varchar2(2000);
3 contract_end_date_v date := sysdate;
4 name_v varchar2(200) := 'Riaz';
5 begin
6 email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||' المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى <br/>.ولكم جزيل الشكر والتقدير </font></div>';
7 p_send_mail_test('<email@domain>','<email@domain>','Hello',email_text);
8* end;
SQL> /
PL/SQL procedure successfully completed.
Result_
<div align="right"><font size="4"><b>????? Riaz ???????</b>
???? ?????? ?????? ?? ????? ????? ??? ?????? ?????? 12-07-2011
.???? ???? ????? ???????? </font></div>
[Question marks along with all tags; this OTN page is converting that to HTML output]
Option2
SQL> ed
Wrote file afiedt.buf
1 create or replace procedure html_email(
2 p_to in varchar2,
3 p_from in varchar2,
4 p_subject in varchar2,
5 p_text in varchar2 default null,
6 p_html in varchar2 default null
7 )
8 is
9 l_boundary varchar2(255) default 'a1b2c3d4e3f2g1';
10 l_connection utl_smtp.connection;
11 l_body_html clob := empty_clob; --This LOB will be the email message
12 l_offset number;
13 l_ammount number;
14 l_temp varchar2(32767) default null;
15 l_smtp_hostname varchar2(50) := '<smtp Server>';
16 begin
17 l_connection := utl_smtp.open_connection( l_smtp_hostname, 25);
18 utl_smtp.helo( l_connection, l_smtp_hostname );
19 utl_smtp.mail( l_connection, p_from );
20 utl_smtp.rcpt( l_connection, p_to );
21 l_temp := l_temp || 'MIME-Version: 1.0' || chr(13) || chr(10);
22 l_temp := l_temp || 'To: ' || p_to || chr(13) || chr(10);
23 l_temp := l_temp || 'From: ' || p_from || chr(13) || chr(10);
24 l_temp := l_temp || 'Subject: ' || p_subject || chr(13) || chr(10);
25 l_temp := l_temp || 'Reply-To: ' || p_from || chr(13) || chr(10);
26 l_temp := l_temp || 'Content-Type: multipart/alternative; boundary=' ||
27 chr(34) || l_boundary || chr(34) || chr(13) ||
28 chr(10);
29 ----------------------------------------------------
30 -- Write the headers
31 dbms_lob.createtemporary( l_body_html, false, 10 );
32 dbms_lob.write(l_body_html,length(l_temp),1,l_temp);
33 ----------------------------------------------------
34 -- Write the text boundary
35 l_offset := dbms_lob.getlength(l_body_html) + 1;
36 l_temp := '--' || l_boundary || chr(13)||chr(10);
37 l_temp := l_temp || 'content-type: text/plain;charset=utf-8' ||
38 chr(13) || chr(10) || chr(13) || chr(10);
39 dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
40 ----------------------------------------------------
41 -- Write the plain text portion of the email
42 l_offset := dbms_lob.getlength(l_body_html) + 1;
43 dbms_lob.write(l_body_html,length(p_text),l_offset,p_text);
44 ----------------------------------------------------
45 -- Write the HTML boundary
46 l_temp := chr(13)||chr(10)||chr(13)||chr(10)||'--' || l_boundary ||
47 chr(13) || chr(10);
48 l_temp := l_temp || 'content-type: text/html;charset=utf-8' ||
49 chr(13) || chr(10) || chr(13) || chr(10);
50 l_offset := dbms_lob.getlength(l_body_html) + 1;
51 dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
52 ----------------------------------------------------
53 -- Write the HTML portion of the message
54 l_offset := dbms_lob.getlength(l_body_html) + 1;
55 dbms_lob.write(l_body_html,length(p_html),l_offset,p_html);
56 ----------------------------------------------------
57 -- Write the final html boundary
58 l_temp := chr(13) || chr(10) || '--' || l_boundary || '--' || chr(13);
59 l_offset := dbms_lob.getlength(l_body_html) + 1;
60 dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
61 ----------------------------------------------------
62 -- Send the email in 1900 byte chunks to UTL_SMTP
63 l_offset := 1;
64 l_ammount := 1900;
65 utl_smtp.open_data(l_connection);
66 while l_offset < dbms_lob.getlength(l_body_html) loop
67 utl_smtp.write_data(l_connection,
68 dbms_lob.substr(l_body_html,l_ammount,l_offset));
69 l_offset := l_offset + l_ammount ;
70 l_ammount := least(1900,dbms_lob.getlength(l_body_html) - l_ammount);
71 end loop;
72 utl_smtp.close_data(l_connection);
73 utl_smtp.quit( l_connection );
74 dbms_lob.freetemporary(l_body_html);
75* end;
SQL> /
Procedure created.
SQL> ed
Wrote file afiedt.buf
1 declare
2 email_text varchar2(2000);
3 contract_end_date_v date := sysdate;
4 name_v varchar2(200) := 'Riaz';
5 begin
6 email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||' المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى <br/>.ولكم جزيل الشكر والتقدير </font></div>';
7 html_email(p_to=>'<email@domain>',p_from=>'<email@domain>',p_subject=>'Hello',p_text=>'Hi', p_html=>email_text);
8* end;
SQL> /
PL/SQL procedure successfully completed.
Result*
????? Riaz ???????
???? ?????? ?????? ?? ????? ????? ??? ?????? ?????? 12-07-2011
Option3
SQL> ed
Wrote file afiedt.buf
1 create or replace procedure p_html_email_riaz(
2 p_to in varchar2,
3 p_from in varchar2,
4 p_subject in varchar2,
5 p_text in varchar2 default null,
6 p_html in varchar2 default null
7 )
8 is
9 l_boundary varchar2(255) default 'a1b2c3d4e3f2g1';
10 l_connection utl_smtp.connection;
11 l_body_html clob := empty_clob; --This LOB will be the email message
12 l_offset number;
13 l_ammount number;
14 l_temp varchar2(32767) default null;
15 l_smtp_hostname varchar2(50) := '<smtp Server>';
16 begin
17 l_connection := utl_smtp.open_connection( l_smtp_hostname, 25);
18 utl_smtp.helo( l_connection, l_smtp_hostname );
19 utl_smtp.mail( l_connection, p_from );
20 utl_smtp.rcpt( l_connection, p_to );
21 l_temp := l_temp || 'MIME-Version: 1.0' || chr(13) || chr(10);
22 l_temp := l_temp || 'To: ' || p_to || chr(13) || chr(10);
23 l_temp := l_temp || 'From: ' || p_from || chr(13) || chr(10);
24 l_temp := l_temp || 'Subject: ' || p_subject || chr(13) || chr(10);
25 l_temp := l_temp || 'Reply-To: ' || p_from || chr(13) || chr(10);
26 l_temp := l_temp || 'Content-Type: multipart/alternative; boundary=' ||
27 chr(34) || l_boundary || chr(34) || chr(13) ||
28 chr(10);
29 ----------------------------------------------------
30 -- Write the headers
31 dbms_lob.createtemporary( l_body_html, false, 10 );
32 dbms_lob.write(l_body_html,length(l_temp),1,l_temp);
33 ----------------------------------------------------
34 -- Write the text boundary
35 l_offset := dbms_lob.getlength(l_body_html) + 1;
36 l_temp := '--' || l_boundary || chr(13)||chr(10);
37 l_temp := l_temp || 'content-type: text/plain; charset=UTF-8' ||
38 chr(13) || chr(10) || chr(13) || chr(10);
39 dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
40 ----------------------------------------------------
41 -- Write the plain text portion of the email
42 /**
43 l_offset := dbms_lob.getlength(l_body_html) + 1;
44 dbms_lob.write(l_body_html,length(p_text),l_offset,p_text);
45 **/
46 ----------------------------------------------------
47 -- Write the HTML boundary
48 l_temp := chr(13)||chr(10)||chr(13)||chr(10)||'--' || l_boundary ||
49 chr(13) || chr(10);
50 l_temp := l_temp || 'content-type: text/html;' ||
51 chr(13) || chr(10) || chr(13) || chr(10);
52 l_offset := dbms_lob.getlength(l_body_html) + 1;
53 dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
54 ----------------------------------------------------
55 -- Write the HTML portion of the message
56 l_offset := dbms_lob.getlength(l_body_html) + 1;
57 dbms_lob.write(l_body_html,length(p_html),l_offset,p_html);
58 ----------------------------------------------------
59 -- Write the final html boundary
60 l_temp := chr(13) || chr(10) || '--' || l_boundary || '--' || chr(13);
61 l_offset := dbms_lob.getlength(l_body_html) + 1;
62 dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
63 ----------------------------------------------------
64 -- Send the email in 1900 byte chunks to UTL_SMTP
65 l_offset := 1;
66 l_ammount := 1900;
67 utl_smtp.open_data(l_connection);
68 while l_offset < dbms_lob.getlength(l_body_html) loop
69 utl_smtp.write_raw_data(l_connection,
70 utl_raw.cast_to_raw(
71 dbms_lob.substr(l_body_html,l_ammount,l_offset ) ) );
72 l_offset := l_offset + l_ammount ;
73 l_ammount := least(1900,dbms_lob.getlength(l_body_html) - l_ammount);
74 end loop;
75 utl_smtp.close_data(l_connection);
76 utl_smtp.quit( l_connection );
77 dbms_lob.freetemporary(l_body_html);
78* end;
SQL>
SQL> /
Procedure created.
SQL> ed
Wrote file afiedt.buf
1 declare
2 email_text varchar2(2000);
3 contract_end_date_v date := sysdate;
4 name_v varchar2(200) := 'Riaz';
5 begin
6 email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||' المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى <br/>.ولكم جزيل الشكر والتقدير </font></div>';
7 p_html_email_riaz(p_to=>'<email@domain>',p_from=>'<email@domain>',p_subject=>'Hello',p_text=>'Hi', p_html=>email_text);
8* end;
SQL> /
PL/SQL procedure successfully completed.
Result*
GaSmO Riaz GacMJQc
mQLl GaJ_Qc HGaZac Cd GaZ^O GaNGU H_c SmdJem HJGQmN 12-07-2011
. fZame mQL\l GaJ_\Qc HE]GOI EOGQI GacfGQO GaHTQmI ]m MGa ZOc Q[HJ_c HJLOmO GaZ^O NaGa cOI C^UeG CSHfZmd cd Gamfc fPa_ aaCecmI Ga^Ufl
.fa_c LRma GaT_Q fGaJ^OmQ
*Option4*
[code]
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE PROCEDURE send_email_html_test(
2 pi_from IN Varchar,
3 pi_to IN VARCHAR,
4 pi_cc IN Varchar,
5 pi_subj IN VARCHAR,
6 pi_msg CLOB
7 )
8 IS
9 conn utl_smtp.connection;
10 lv_mailhost varchar2(1000);
11 lv_port number;
12 BEGIN
13 lv_mailhost := '<smtp Server>';
14 lv_port := 25;
15 conn := utl_smtp.open_connection(lv_mailhost, lv_port);
16 utl_smtp.helo(conn, lv_mailhost);
17 utl_smtp.mail(conn, pi_from);
18 utl_smtp.rcpt(conn, pi_to);
19 IF pi_cc is not null THEN
20 utl_smtp.rcpt(conn, pi_cc);
21 END IF;
22 utl_smtp.open_data(conn);
23 utl_smtp.write_data(conn, 'MIME-version: 1.0' || utl_tcp.CRLF);
24 utl_smtp.write_data(conn, 'Content-Type: text/html; charset=iso-8859-6' ||
25 utl_tcp.CRLF);
26 utl_smtp.write_data(conn, 'Content-Transfer-Encoding: 8bit' ||
27 utl_tcp.CRLF);
28 utl_smtp.write_data(conn, 'From:' ||pi_from || utl_tcp.CRLF);
29 utl_smtp.write_data(conn, 'To:' ||pi_to || utl_tcp.CRLF);
30 utl_smtp.write_data(conn, 'Cc:' ||pi_cc || utl_tcp.CRLF);
31 utl_smtp.write_data(conn, 'Reply-To:' ||pi_from || utl_tcp.CRLF);
32 utl_smtp.write_data(conn, 'Subject:' ||pi_subj|| utl_tcp.CRLF);
33 utl_smtp.write_data(conn, utl_tcp.crlf);
34 utl_smtp.write_raw_data(conn, utl_raw.cast_to_raw(pi_msg));
35 utl_smtp.close_data(conn);
36 utl_smtp.quit(conn);
37 EXCEPTION WHEN others THEN
38 dbms_output.put_line(sqlerrm);
39* END;
40 /
Procedure created.
SQL> ed
Wrote file afiedt.buf
1 declare
2 email_text varchar2(2000);
3 contract_end_date_v date := sysdate;
4 name_v varchar2(200) := 'Riaz';
5 begin
6 email_text :='
<div align="right"><font size="4"><b>السيد '||name_v||' المحترم</b>
يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'
. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى
.ولكم جزيل الشكر والتقدير </font></div>';
7 send_email_html_test('<email@domain>',
8 '<email@domain>',
9 '<email@domain>',
10 'Hello',email_text);
11* end;
SQL> /
PL/SQL procedure successfully completed.
Result*
Riaz افكحترك
ٍرجٌ افترك بافغفك أل افغد افخاص بك سٍلتمٍ بتارٍخ 12-07-2011
. نغفٍم ٍرجٌ افترك بإادة إدارة افكنارد افبشرٍة ٍ حاف غدك ربتك بتجدٍد افغد خفاف كدة أصما أسبنغٍل كل افٍنك نذف ففأمكٍة افصنٌ
.نفك جزٍف افشر نافتدٍر
Option5
SQL> ed
Wrote file afiedt.buf
1 CREATE OR REPLACE PROCEDURE send_mail_test1 (p_to IN VARCHAR2,
2 p_from IN VARCHAR2,
3 p_subject IN VARCHAR2,
4 p_text_msg IN VARCHAR2 DEFAULT NULL,
5 p_html_msg IN VARCHAR2 DEFAULT NULL,
6 p_smtp_host IN VARCHAR2,
7 p_smtp_port IN NUMBER DEFAULT 25)
8 AS
9 l_mail_conn UTL_SMTP.connection;
10 l_boundary VARCHAR2(50) := '----=*#abc1234321cba#*=';
11 BEGIN
12 l_mail_conn := UTL_SMTP.open_connection(p_smtp_host, p_smtp_port);
13 UTL_SMTP.helo(l_mail_conn, p_smtp_host);
14 UTL_SMTP.mail(l_mail_conn, p_from);
15 UTL_SMTP.rcpt(l_mail_conn, p_to);
16 UTL_SMTP.open_data(l_mail_conn);
17 UTL_SMTP.write_data(l_mail_conn, 'Date: ' || TO_CHAR(SYSDATE, 'DD-MON-YYYY HH24:MI:SS') || UTL_TCP.crlf);
18 UTL_SMTP.write_data(l_mail_conn, 'To: ' || p_to || UTL_TCP.crlf);
19 UTL_SMTP.write_data(l_mail_conn, 'From: ' || p_from || UTL_TCP.crlf);
20 UTL_SMTP.write_data(l_mail_conn, 'Subject: ' || p_subject || UTL_TCP.crlf);
21 UTL_SMTP.write_data(l_mail_conn, 'Reply-To: ' || p_from || UTL_TCP.crlf);
22 UTL_SMTP.write_data(l_mail_conn, 'MIME-Version: 1.0' || UTL_TCP.crlf);
23 UTL_SMTP.write_data(l_mail_conn, 'Content-Type: multipart/alternative; boundary="' || l_boundary || '"' || UTL_TCP.crlf || UTL_TCP.crlf);
24 IF p_text_msg IS NOT NULL THEN
25 UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);
26 UTL_SMTP.write_data(l_mail_conn, 'Content-Type: text/plain; charset="utf-8"' || UTL_TCP.crlf || UTL_TCP.crlf);
27 UTL_SMTP.write_data(l_mail_conn, p_text_msg);
28 UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf || UTL_TCP.crlf);
29 END IF;
30 IF p_html_msg IS NOT NULL THEN
31 UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || UTL_TCP.crlf);
32 UTL_SMTP.write_data(l_mail_conn, 'Content-Type: text/html; charset="utf-8"' || UTL_TCP.crlf || UTL_TCP.crlf);
33 UTL_SMTP.write_data(l_mail_conn, p_html_msg);
34 UTL_SMTP.write_data(l_mail_conn, UTL_TCP.crlf || UTL_TCP.crlf);
35 END IF;
36 UTL_SMTP.write_data(l_mail_conn, '--' || l_boundary || '--' || UTL_TCP.crlf);
37 UTL_SMTP.close_data(l_mail_conn);
38 UTL_SMTP.quit(l_mail_conn);
39* END;
SQL> /
Procedure created.
SQL> ed
Wrote file afiedt.buf
1 declare
2 email_text varchar2(2000);
3 contract_end_date_v date := sysdate;
4 name_v varchar2(200) := 'Riaz';
5 begin
6 email_text :='<br/><div align="right"><font size="4"><b>السيد '||name_v||' المحترم</b><br/><br/> يرجى التكرم بالعلم أن العقد الخاص بكم سينتهي بتاريخ ' || to_char(contract_end_date_v,'dd-mm-yyyy')||'<br/>. وعليه يرجـى التكـرم بإفادة إدارة الموارد البشرية في حال عدم رغبتكم بتجديد العقد خلال مدة أقصها أسبوعين من اليوم وذلك للأهمية القصوى <br/>.ولكم جزيل الشكر والتقدير </font></div>';
7 send_mail_test1('<email@domain>',
8 '<email@domain>',
9 'Hello',
10 'msg',
11 email_text,
12 '<smtp Server>',
13 25);
14* end;
SQL> /
PL/SQL procedure successfully completed.
Result*
????? Riaz ???????
???? ?????? ?????? ?? ????? ????? ??? ?????? ?????? 12-07-2011
.???? ???? ????? ????????I worked with Oracle support and was able to find solution. The helping document ids were: 752309.1 & 404389.1
-
Passing a value for date parameter from Oracle Forms to BIP
Hi
I have created a report with the following SQL query:
select
d_tables.d_seq,
to_date(d_tables.d_created) creation_date,
d_tables.d_created_by created_by,
d_tables.d_pk,
d_tables.table_name,
d_tables.comments
from
d_tables, d_applications
where
d_tables.d_ppk = d_applications.d_pk
and to_date(d_tables.d_created) >= nvl(:P_CRE_DATE_FROM, to_date(d_tables.d_created))
and to_date(d_tables.d_created) <= nvl(:P_CRE_DATE_TO, to_date(d_tables.d_created))
The parameters P_CRE_DATE_FROM and P_CRE_DATE_TO have been set up as date in BI Publisher with format dd-MMM-yyyy
The report works fine when launched in BI Publisher.
I want to call this report from Oracle Forms and I'm trying to pass the values for both the parameters. However, the report does not generate output based on values passed.
Does it have to do with datatype? Does anyone know a solution for this?
Kind regards,
AparnaThanks for your suggestion. I am already referring to the whitepaper and have integrated Forms with BI Publisher. The parameter passing is working fine for a varchar2 type of parameter. However, for a date type, there seems to be some problem.
-
Need to add extra lines in email generating from oracle
Hi!
I am using Oracle 9i Enterprise Edition 9.2.0.6
I am facing a problem while generating the email from Oracle
Problem is that I want to display the data in following format
Terminal Statistics From: 30-MAR-2008 15:39:00 To: 06-JUN-2008 16:59:00
Containers Examined
Export: 2
Import: 30
but email shows data in following format
Terminal Statistics From: 30-MAR-2008 15:39:00 To: 06-JUN-2008 16:59:00 Containers Examined Export: 2 Import: 30
System combines the all the data in one line, while I have used following function to add new line when and where needed, but unable to get my desired result.
1. utl_tcp.CRLF
2. chr(130) || chr(10)
3. chr(10)
I have used following procedure to generate the email.
PROCEDURE send_html_email(
p_module_name in varchar2,
p_subject in varchar2,
p_text in varchar2 default null,
p_html in varchar2 default null
IS
l_boundary varchar2(32767) default 'a1b2c3d4e3f2g1';
l_connection utl_smtp.connection;
l_body_html clob := empty_clob; --This LOB will be the email message
l_offset number;
l_ammount number;
l_temp varchar2(32767) default null;
l_to varchar2(100);
l_cc varchar2(100);
l_bcc varchar2(100);
t_v_stpt Number:=0;
t_v_endpt Number:=0;
c_v_stpt Number:=0;
c_v_endpt Number:=0;
b_v_stpt Number:=0;
b_v_endpt Number:=0;
l_subject varchar2(255);
BEGIN
/*Function to retrieve the E-mail recipients list according to the Module/application*/
mail_recipient(p_module_name,l_to,l_cc,l_bcc);
l_connection := utl_smtp.open_connection( pk_parameter.setting('MAILSVR'), 25 );
utl_smtp.helo( l_connection, pk_parameter.setting('MAILSVR') );
utl_smtp.mail( l_connection, pk_parameter.setting('MAILFROM') );
l_temp := l_temp || 'MIME-Version: 1.0' || chr(13) || chr(10);
LOOP
t_v_stpt := t_v_stpt + 1;
t_v_endpt := INSTR (l_to, ',', t_v_stpt, 1);
IF l_to is null then
EXIT;
ELSIF t_v_endpt = 0 THEN
UTL_SMTP.rcpt (l_connection, SUBSTR (l_to, t_v_stpt));
EXIT;
ELSE
UTL_SMTP.rcpt (l_connection, SUBSTR (l_to, t_v_stpt, t_v_endpt -t_v_stpt));
END IF;
t_v_stpt := t_v_endpt;
END LOOP;
LOOP
c_v_stpt := c_v_stpt + 1;
c_v_endpt := INSTR (l_cc, ',', c_v_stpt, 1);
IF l_cc is null then
EXIT;
ELSIF c_v_endpt = 0 THEN
UTL_SMTP.rcpt (l_connection, SUBSTR (l_cc, c_v_stpt));
EXIT;
ELSE
UTL_SMTP.rcpt (l_connection, SUBSTR (l_cc, c_v_stpt, c_v_endpt -c_v_stpt));
END IF;
c_v_stpt := c_v_endpt;
END LOOP;
LOOP
b_v_stpt := b_v_stpt + 1;
b_v_endpt := INSTR (l_bcc, ',', b_v_stpt, 1);
IF l_bcc is null then
EXIT;
ELSIF b_v_endpt = 0 THEN
UTL_SMTP.rcpt (l_connection, SUBSTR (l_bcc, b_v_stpt));
EXIT;
ELSE
UTL_SMTP.rcpt (l_connection, SUBSTR (l_bcc, b_v_stpt, b_v_endpt -b_v_stpt));
END IF;
b_v_stpt := b_v_endpt;
END LOOP;
/*Header creation for email.*/
IF l_to is not null or l_cc is not null or l_bcc is not null THEN
l_temp := l_temp || 'To: ' || l_to || chr(13) || chr(10);
l_temp := l_temp || 'CC: ' || l_cc || chr(13) || chr(10);
l_temp := l_temp || 'BCC: ' || l_bcc || chr(13) || chr(10);
l_temp := l_temp || 'From: ' || pk_parameter.setting('MAILFROM') || chr(13) || chr(10);
l_temp := l_temp || 'Subject: ' || p_subject || chr(13) || chr(10);
l_temp := l_temp || 'Reply-To: ' || pk_parameter.setting('MAILFROM') || chr(13) || chr(10);
l_temp := l_temp || 'Content-Type: multipart/alternative; boundary=' ||
chr(34) || l_boundary || chr(34) || chr(13) ||
chr(10);
-- Write the headers
dbms_lob.createtemporary( l_body_html, false, 10 );
dbms_lob.write(l_body_html,length(l_temp),1,l_temp);
-- Write the text boundary
l_offset := dbms_lob.getlength(l_body_html) + 1;
l_temp := '--' || l_boundary || chr(13)||chr(10);
l_temp := l_temp || 'content-type: text/plain; charset=us-ascii' ||
chr(13) || chr(10) || chr(13) || chr(10);
dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
-- Write the plain text portion of the email
l_offset := dbms_lob.getlength(l_body_html) + 1;
dbms_lob.write(l_body_html,length(p_text),l_offset,p_text);
-- Write the HTML boundary
l_temp := chr(13)||chr(10)||chr(13)||chr(10)||'--' || l_boundary ||
chr(13) || chr(10);
l_temp := l_temp || 'content-type: text/html;' ||
chr(13) || chr(10) || chr(13) || chr(10);
l_offset := dbms_lob.getlength(l_body_html) + 1;
dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
-- Write the HTML portion of the message
l_offset := dbms_lob.getlength(l_body_html) + 1;
dbms_lob.write(l_body_html,length(p_html),l_offset,p_html);
-- Write the final html boundary
l_temp := chr(13) || chr(10) || '--' || l_boundary || '--' || chr(13);
l_offset := dbms_lob.getlength(l_body_html) + 1;
dbms_lob.write(l_body_html,length(l_temp),l_offset,l_temp);
-- Send the email in 1900 byte chunks to UTL_SMTP
l_offset := 1;
l_ammount := 32767;
utl_smtp.open_data(l_connection);
while l_offset < dbms_lob.getlength(l_body_html) loop
utl_smtp.write_data(l_connection, dbms_lob.substr(l_body_html,l_ammount,l_offset));
l_offset := l_offset + l_ammount ;
l_ammount := least(32767,dbms_lob.getlength(l_body_html) - l_ammount);
end loop;
utl_smtp.close_data(l_connection);
utl_smtp.quit( l_connection );
dbms_lob.freetemporary(l_body_html);
END IF;
END;
Following procedure calls the above function and generate the email
PROCEDURE generate_statistics
IS
l_minutes NUMBER:=0;
l_sub_type cg_ref_codes.rv_meaning%type;
l_gate_text VARCHAR2(5000);
l_ves_text VARCHAR2(5000);
l_exm_text VARCHAR2(5000);
l_email_text VARCHAR2(5000);
l_gate_tot NUMBER:=0;
l_load_tot NUMBER:=0;
l_discharge NUMBER:=0;
l_exm_tot NUMBER:=0;
/*Declare Cursor to get Examined Containers Summary*/
CURSOR cur_examined_ctrs IS
SELECT decode(eu.category,'I','Import','E','Export') Category, count(*) Total
FROM service_events se, equipment_uses eu
WHERE se.performed BETWEEN round(sysdate-l_minutes/1440,'mi')
AND round(sysdate,'mi')
AND se.tserv_id IN ('EXM')
AND eu.gkey = se.equse_gkey
AND eu.category IN ('I','E')
GROUP BY eu.category;
BEGIN
/*Retrieve parameterized minutes*/
l_minutes := nvl(pk_parameter.setting('STATSGMI'),0);
/*Assign Values to generate email*/
l_email_text := 'Terminal Statistics From: '||
to_char(round(sysdate-l_minutes/1440,'mi'),'DD-MON-RRRR HH24:MI:SS')||
' To: '||to_char(round(sysdate,'mi'),'DD-MON-RRRR HH24:MI:SS')||
chr(13) || chr(10)||chr(13) || chr(10);
l_exm_text := 'Containers Examined'||utl_tcp.CRLF;
FOR rec_examined_ctrs IN cur_examined_ctrs LOOP
/*Generate Text for email - Vessel Activity Crane Wise Starts*/
l_exm_text := l_exm_text ||rec_examined_ctrs.category ||': '||
rec_examined_ctrs.total||utl_tcp.CRLF;
l_exm_tot := l_exm_tot + rec_examined_ctrs.total;
END LOOP;
l_email_text := l_email_text||l_exm_text;
pk_kictl_email.send_html_email('TERM STATISTICS',
'Terminal Statistics Report',
l_email_text,
l_email_text
END;
I have been searching the reason and solution on net since last 2 days but hasn't find it yet.
would anybody plz help me regarding this.
Thanks
HassanI checked your suggestions after week end today and found that
the suggestion of Nalla did not provide the result in my required format
rewrite it as l_email_text := l_email_text||CHR(10)||l_exm_text;
Peter & Krithika:
I used html tag <BR> when and where needed and its gave me result in my required format
e.g.: l_exm_text := l_exm_text ||'<br>'||rec_examined_ctrs.category ||': '||
rec_examined_ctrs.total;
Now I want to know if there any html tag thru which I can define the column number so that my text will start from there.
means any html tag replacement of lpad (oracle funtion):
Thanks
Hassan -
Error While Querying DB Link from Oracle 10g to Postgres 8.2
Hi,
I have installed unixodbc 2.3.1, postgres odbc driver (psqlodbc-07.03) and dg4odbc 11.2
On querying : select sysdate from dual@dblink_postgresql, the following error occurs:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[unixODBC][Driver Manager]Can't open lib '/oracle/psqlodbc/lib/libpsqlodbc.a' : file not found {01000}
ORA-02063: preceding 2 lines from DBLINK_POSTGRES
Similar error appears in the trace file as well.
[unixODBC][Driver Manager]Can't open lib '/oracle/psqlodbc/lib/libpsqlodbc.a'
$ isql -v postgresql postgres postgres@2012
[01000][unixODBC][Driver Manager]Can't open lib '/oracle/psqlodbc/lib/libpsqlodbc.a' : file not found
[ISQL]ERROR: Could not SQLConnect
However the file is present in the location and has no permission related problems.
$ pwd
/oracle/psqlodbc/lib
$ ls -lrt
total 2952
-rwxr-xr-x 1 oracle oinstall 663 Mar 25 15:28 psqlodbc.la
-rw-r--r-- 1 oracle oinstall 731419 Mar 25 15:28 libpsqlodbc.a
-rw-r--r-- 1 oracle oinstall 12215 Mar 25 22:11 win_md5.o
-rw-r--r-- 1 oracle oinstall 18100 Mar 25 22:11 options.o
-rw-r--r-- 1 oracle oinstall 13196 Mar 25 22:11 misc.o
-rw-r--r-- 1 oracle oinstall 4234 Mar 25 22:11 lobj.o
-rw-r--r-- 1 oracle oinstall 122442 Mar 25 22:11 info.o
-rw-r--r-- 1 oracle oinstall 26464 Mar 25 22:11 execute.o
-rw-r--r-- 1 oracle oinstall 22070 Mar 25 22:11 environ.o
-rw-r--r-- 1 oracle oinstall 8633 Mar 25 22:11 drvconn.o
-rw-r--r-- 1 oracle oinstall 83758 Mar 25 22:11 convert.o
-rw-r--r-- 1 oracle oinstall 62529 Mar 25 22:11 connection.o
-rw-r--r-- 1 oracle oinstall 5685 Mar 25 22:11 columninfo.o
-rw-r--r-- 1 oracle oinstall 19724 Mar 25 22:11 bind.o
-rw-r--r-- 1 oracle oinstall 3768 Mar 25 22:11 tuplelist.o
-rw-r--r-- 1 oracle oinstall 2816 Mar 25 22:11 tuple.o
-rw-r--r-- 1 oracle oinstall 36770 Mar 25 22:11 statement.o
-rw-r--r-- 1 oracle oinstall 10490 Mar 25 22:11 socket.o
-rw-r--r-- 1 oracle oinstall 74140 Mar 25 22:11 results.o
-rw-r--r-- 1 oracle oinstall 22686 Mar 25 22:11 qresult.o
-rw-r--r-- 1 oracle oinstall 1977 Mar 25 22:11 psqlodbc.o
-rw-r--r-- 1 oracle oinstall 25893 Mar 25 22:11 pgtypes.o
-rw-r--r-- 1 oracle oinstall 706 Mar 25 22:11 pgapi30.o
-rw-r--r-- 1 oracle oinstall 34071 Mar 25 22:11 parse.o
-rw-r--r-- 1 oracle oinstall 706 Mar 25 22:11 odbcapi30.o
-rw-r--r-- 1 oracle oinstall 41540 Mar 25 22:11 odbcapi.o
-rw-r--r-- 1 oracle oinstall 11601 Mar 25 22:11 multibyte.o
-rw-r--r-- 1 oracle oinstall 706 Mar 25 22:11 info30.o
-rw-r--r-- 1 oracle oinstall 5972 Mar 25 22:11 gpps.o
-rw-r--r-- 1 oracle oinstall 37546 Mar 25 22:11 dlg_specific.o
My odbc.ini and init4dg4odbc looks like below:
$ pg odbc.ini
[postgresql]
Description = Test to Postgres
Driver = /oracle/psqlodbc/lib/libpsqlodbc.a
Trace = Yes
TraceFile = postgres.log
Database = postgres
Servername = TCLDSAPORTUAT
UserName = postgres
Password = postgres@2012
Port = 5432
Protocol = TCP
ReadOnly = Yes
RowVersioning = No
ShowSystemTables = No
ShowOidColumn = No
FakeOidIndex = No
$ pg initdg4odbc.ora
# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC
# HS init parameters
HS_FDS_CONNECT_INFO = postgresql
HS_FDS_TRACE_LEVEL = DEBUG
HS_FDS_SHAREABLE_NAME = /oracle/unixodbc64/lib/libodbc.so
# ODBC specific environment variables
set ODBCINI=/oracle/unixodbc64/etc/odbc.ini
# Environment variables required for the non-Oracle system
#set <envvar>=<value>
I found similar threads in the forum but could not find solution for this problem.
Please help to resolve this issue.
Thanks,
Akanksha
Edited by: 996208 on Mar 26, 2013 5:35 AMHi Mike,
I used the truss option for diagnosis, the output is really long and shows the same error at the end of execution:
$truss isql -v postgresql postgres postgres@2012
getuidx(4) = 207
getuidx(2) = 207
getuidx(1) = 207
getgidx(4) = 203
getgidx(2) = 203
getgidx(1) = 203
kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
getuidx(4) = 207
getuidx(2) = 207
getuidx(1) = 207
getgidx(4) = 203
getgidx(2) = 203
getgidx(1) = 203
kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
access("/usr/lib/nls/msg/en_US/execerr.cat", 0) = 0
_getpid() = 27262980
kopen("/usr/lib/nls/msg/en_US/execerr.cat", O_RDONLY) = 3
kioctl(3, 22528, 0x0000000000000000, 0x0000000000000000) Err#25 ENOTTY
kfcntl(3, F_SETFD, 0x0000000000000001) = 0
kioctl(3, 22528, 0x0000000000000000, 0x0000000000000000) Err#25 ENOTTY
kread(3, "\0\001 ù\001\001 I S O 8".., 4096) = 4096
lseek(3, 0, 1) = 4096
lseek(3, 0, 1) = 4096
lseek(3, 0, 1) = 4096
_getpid() = 27262980
lseek(3, 0, 1) = 4096
_getpid() = 27262980
lseek(3, 0, 1) = 4096
_getpid() = 27262980
lseek(3, 0, 1) = 4096
lseek(3, 4639, 0) = 4639
kread(3, "\t 0 5 0 9 - 1 9 4 E x".., 4096) = 1686
getuidx(4) = 207
getuidx(2) = 207
getuidx(1) = 207
getgidx(4) = 203
getgidx(2) = 203
getgidx(1) = 203
kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
getuidx(4) = 207
getuidx(2) = 207
getuidx(1) = 207
getgidx(4) = 203
getgidx(2) = 203
getgidx(1) = 203
kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
getuidx(4) = 207
getuidx(2) = 207
getuidx(1) = 207
getgidx(4) = 203
getgidx(2) = 203
getgidx(1) = 203
kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
getuidx(4) = 207
getuidx(2) = 207
getuidx(1) = 207
getgidx(4) = 203
getgidx(2) = 203
getgidx(1) = 203
kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
getuidx(4) = 207
getuidx(2) = 207
getuidx(1) = 207
getgidx(4) = 203
getgidx(2) = 203
getgidx(1) = 203
kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
getuidx(4) = 207
getuidx(2) = 207
getuidx(1) = 207
getgidx(4) = 203
getgidx(2) = 203
getgidx(1) = 203
kload("/usr/lib/nls/loc/en_US__64", 17301632, "/oracle/unixodbc64/lib") = 648518346072918576
kioctl(1, 22528, 0x0000000000000000, 0x0000000000000000) = 0
[01000][unixODBC][Driver Manager]Can't open lib '/oracle/psqlodbc/lib/psqlodbc.o' : file not found
kwrite(1, " [ 0 1 0 0 0 ] [ u n i x".., 99) = 99
[ISQL]ERROR: Could not SQLConnect
kwrite(2, " [ I S Q L ] E R R O R :".., 34) = 34
kfcntl(1, F_GETFL, 0x0000000010DF0051) = 67110914
kfcntl(2, F_GETFL, 0x0000000010DF0051) = 67110914
_exit(1)
Do I need to install postgres software also?
While installing postgres odbc driver in /oracle/psqlodbc only two folders were created viz. lib and share
In lib folder two files were created viz. psqlodbc.la and libpsqlodbc.a
And everybody on the net seems to refer psqlodbc.so in the "Driver = " parameter
Today, I extracted the libpsqlodbc.a by using ar -X 64 -xv libpsqlodbc.a again, still no file with .so has been created.
$ ls -lrt
total 2952
-rwxr-xr-x 1 oracle oinstall 663 Mar 25 15:28 psqlodbc.la
-rwxr-xr-x 1 oracle oinstall 731419 Mar 28 13:51 libpsqlodbc.a
-rw-r--r-- 1 oracle oinstall 12215 Apr 01 13:50 win_md5.o
-rw-r--r-- 1 oracle oinstall 3768 Apr 01 13:50 tuplelist.o
-rw-r--r-- 1 oracle oinstall 2816 Apr 01 13:50 tuple.o
-rw-r--r-- 1 oracle oinstall 36770 Apr 01 13:50 statement.o
-rw-r--r-- 1 oracle oinstall 10490 Apr 01 13:50 socket.o
-rw-r--r-- 1 oracle oinstall 74140 Apr 01 13:50 results.o
-rw-r--r-- 1 oracle oinstall 22686 Apr 01 13:50 qresult.o
-rw-r--r-- 1 oracle oinstall 1977 Apr 01 13:50 psqlodbc.o
-rw-r--r-- 1 oracle oinstall 25893 Apr 01 13:50 pgtypes.o
-rw-r--r-- 1 oracle oinstall 706 Apr 01 13:50 pgapi30.o
-rw-r--r-- 1 oracle oinstall 34071 Apr 01 13:50 parse.o
-rw-r--r-- 1 oracle oinstall 18100 Apr 01 13:50 options.o
-rw-r--r-- 1 oracle oinstall 706 Apr 01 13:50 odbcapi30.o
-rw-r--r-- 1 oracle oinstall 41540 Apr 01 13:50 odbcapi.o
-rw-r--r-- 1 oracle oinstall 11601 Apr 01 13:50 multibyte.o
-rw-r--r-- 1 oracle oinstall 13196 Apr 01 13:50 misc.o
-rw-r--r-- 1 oracle oinstall 4234 Apr 01 13:50 lobj.o
-rw-r--r-- 1 oracle oinstall 706 Apr 01 13:50 info30.o
-rw-r--r-- 1 oracle oinstall 122442 Apr 01 13:50 info.o
-rw-r--r-- 1 oracle oinstall 5972 Apr 01 13:50 gpps.o
-rw-r--r-- 1 oracle oinstall 26464 Apr 01 13:50 execute.o
-rw-r--r-- 1 oracle oinstall 22070 Apr 01 13:50 environ.o
-rw-r--r-- 1 oracle oinstall 8633 Apr 01 13:50 drvconn.o
-rw-r--r-- 1 oracle oinstall 37546 Apr 01 13:50 dlg_specific.o
-rw-r--r-- 1 oracle oinstall 83758 Apr 01 13:50 convert.o
-rw-r--r-- 1 oracle oinstall 62529 Apr 01 13:50 connection.o
-rw-r--r-- 1 oracle oinstall 5685 Apr 01 13:50 columninfo.o
-rw-r--r-- 1 oracle oinstall 19724 Apr 01 13:50 bind.o
Thanks,
Akanksha -
Error with DG4ODBC while setting up connectivity from oracle to IBM iSeries AS400 version V7R1
Hi,
I have Enterprise linux 64-bit hosting Oracle 11gR2 64-bit (11.2.0.1) database. I have access to IBM iSeries AS400 version V7R1. I am trying to connect to IBM iSeries from Oracle Database through ODBC connectivity using Database Link. The following is what I have done.
On the Database (Linux) host Installed iSeriesAccess-7.1.0-1.0.x86_64.rpm provided by IBM.
my odbcinst.ini has the following entries:
[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/libodbcpsql.so
Setup = /usr/lib/libodbcpsqlS.so
FileUsage = 1
[iSeries Access ODBC Driver]
Description = iSeries Access for Linux ODBC Driver
Driver = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
NOTE1 = If using unixODBC 2.2.11 or later and you want the 32 and 64-bit ODBC drivers to share DSN's,
NOTE2 = the following Driver64/Setup64 keywords will provide that support.
Driver64 = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup64 = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
Threading = 2
DontDLClose = 1
UsageCount = 1
[iSeries Access ODBC Driver 64-bit]
Description = iSeries Access for Linux 64-bit ODBC Driver
Driver = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Setup = /opt/ibm/iSeriesAccess/lib64/libcwbodbcs.so
Threading = 2
DontDLClose = 1
UsageCount = 1
The odbc.ini has the following entries:
[ODBC Data Sources]
dg4odbc = connection to db2
[dg4odbc]
Driver = /opt/ibm/iSeriesAccess/lib64/libcwbodbc.so
Description=iSeries Access for Linux ODBC Driver
LogonID=
Password=
Address= (IBM host IP Address)
location=Vm520
noprompt=true
system= (IBM host IP Address)
UNICODE=UTF-8
Naming = 0
ConnectionType = 0
CommitMode = 2
ExtendedDynamic = 0
AllowDataCompression = 1
LibraryView = 0
AllowUnsupportedChar = 0
ForceTranslation = 0
Trace = 0
made sure I could connect via ODBC and DSN using the following command:
isql dg4odbc oracle oracle1 -v
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
SQLRowCount returns -1
600 rows fetched
SQL>
could query the table in a library on AS400.
The $ORACLE_HOME/hs/admin/initdg4odbc.ora has the following entries:
# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC
# HS init parameters
HS_FDS_CONNECT_INFO = dg4odbc
HS_FDS_TRACE_LEVEL = off
HS_FDS_SHAREABLE_NAME=/etc/newlib/libodbc.so
HS_FDS_TRACE_LEVEL = 255
HS_FDS_SUPPORT_STATISTICS=FALSE
# ODBC specific environment variables
set ODBCINI=/etc/odbc.ini
# Environment variables required for the non-Oracle system
The listener entries are as follows:
(SID_DESC =
(SID_NAME = dg4odbc)
(ORACLE_HOME = /opt/oracle/dbs/product/11.2.0/dbhome_1)
(PROGRAM = dg4odbc)
Stopped and started the listener.
The TNS entry is as follows:
armcdb2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = vmw-dev-rmsdb.xxx.vmc)(PORT = 1521))
(CONNECT_DATA =
(SID=dg4odbc)
(HS=OK)
Could tnsping :
oracle@rmsdev[/opt/oracle/dbs/product/11.2.0/dbhome_1/network/admin]$ tnsping armcdb2
TNS Ping Utility for Linux: Version 11.2.0.1.0 - Production on 11-JUL-2013 16:01:23
Copyright (c) 1997, 2009, Oracle. All rights reserved.
Used parameter files:
/opt/oracle/dbs/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = vmw-dev-rmsdb.xxx.vmc)(PORT = 1521)) (CONNECT_DATA = (SID=dg4odbc)) (HS=OK))
OK (0 msec)
created a public database link as follows:
SQL> create database link samplink connect to "oracle" identified by "oracle1" using 'armcdb2';
Database link created.
When I run a select query I get errors as follows:
SQL> select * from mdiaz.AREMAIL@samplink;
select * from mdiaz.AREMAIL@samplink
ERROR at line 1:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
408
Below is the Trace file of dg4odbc:
Oracle Corporation --- THURSDAY JUL 11 2013 16:06:03.627
Heterogeneous Agent Release
11.2.0.1.0
Oracle Corporation --- THURSDAY JUL 11 2013 16:06:03.627
Version 11.2.0.1.0
Entered hgogprd
HOSGIP for "HS_FDS_TRACE_LEVEL" returned "255"
Entered hgosdip
setting HS_OPEN_CURSORS to default of 50
setting HS_FDS_RECOVERY_ACCOUNT to default of "RECOVER"
setting HS_FDS_RECOVERY_PWD to default value
setting HS_FDS_TRANSACTION_LOG to default of HS_TRANSACTION_LOG
setting HS_IDLE_TIMEOUT to default of 0
setting HS_FDS_TRANSACTION_ISOLATION to default of "READ_COMMITTED"
setting HS_NLS_NCHAR to default of "AL32UTF8"
setting HS_FDS_TIMESTAMP_MAPPING to default of "DATE"
setting HS_FDS_DATE_MAPPING to default of "DATE"
setting HS_RPC_FETCH_REBLOCKING to default of "ON"
setting HS_FDS_FETCH_ROWS to default of "100"
setting HS_FDS_RESULTSET_SUPPORT to default of "FALSE"
setting HS_FDS_RSET_RETURN_ROWCOUNT to default of "FALSE"
setting HS_FDS_PROC_IS_FUNC to default of "FALSE"
setting HS_FDS_CHARACTER_SEMANTICS to default of "FALSE"
setting HS_FDS_MAP_NCHAR to default of "TRUE"
setting HS_NLS_DATE_FORMAT to default of "YYYY-MM-DD HH24:MI:SS"
setting HS_FDS_REPORT_REAL_AS_DOUBLE to default of "FALSE"
setting HS_LONG_PIECE_TRANSFER_SIZE to default of "65536"
setting HS_SQL_HANDLE_STMT_REUSE to default of "FALSE"
setting HS_FDS_QUERY_DRIVER to default of "TRUE"
HOSGIP returned value of "FALSE" for HS_FDS_SUPPORT_STATISTICS
Parameter HS_FDS_QUOTE_IDENTIFIER is not set
setting HS_KEEP_REMOTE_COLUMN_SIZE to default of "OFF"
setting HS_FDS_GRAPHIC_TO_MBCS to default of "FALSE"
setting HS_FDS_MBCS_TO_GRAPHIC to default of "FALSE"
Default value of 64 assumed for HS_FDS_SQLLEN_INTERPRETATION
setting HS_CALL_NAME_ISP to "gtw$:SQLTables;gtw$:SQLColumns;gtw$:SQLPrimaryKeys;gtw$:SQLForeignKeys;gtw$:SQLProcedures;gtw$:SQLStatistics;gtw$:SQLGetInfo"
setting HS_FDS_DELAYED_OPEN to default of "TRUE"
setting HS_FDS_WORKAROUNDS to default of "0"
Exiting hgosdip, rc=0
ORACLE_SID is "dg4odbc"
Product-Info:
Port Rls/Upd:1/0 PrdStat:0
Agent:Oracle Database Gateway for ODBC
Facility:hsa
Class:ODBC, ClassVsn:11.2.0.1.0_0008, Instance:dg4odbc
Exiting hgogprd, rc=0
hostmstr: 0: HOA After hoagprd
hostmstr: 0: HOA Before hoainit
Entered hgoinit
HOCXU_COMP_CSET=1
HOCXU_DRV_CSET=871
HOCXU_DRV_NCHAR=873
HOCXU_DB_CSET=871
HOCXU_SEM_VER=112000
Entered hgolofn at 2013/07/11-16:06:03
HOSGIP for "HS_FDS_SHAREABLE_NAME" returned "/etc/newlib/libodbc.so"
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLAllocHandle
symbol_peflctx=0xaab7c2f0
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLBindCol
symbol_peflctx=0xaab7c9d0
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLBindParameter
symbol_peflctx=0xaab7cb6c
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLCancel
symbol_peflctx=0xaab7d416
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLDescribeParam
symbol_peflctx=0xaab7f7dc
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLDisconnect
symbol_peflctx=0xaab7f978
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLEndTran
symbol_peflctx=0xaab7fe42
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLExecute
symbol_peflctx=0xaab808ac
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLFetch
symbol_peflctx=0xaab80b5c
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLFreeHandle
symbol_peflctx=0xaab816aa
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLFreeStmt
symbol_peflctx=0xaab82144
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLGetData
symbol_peflctx=0xaab83ad8
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLGetEnvAttr
symbol_peflctx=0xaab84e42
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLGetFunctions
symbol_peflctx=0xaab84fce
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLMoreResults
symbol_peflctx=0xaab85a0a
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLNumResultCols
symbol_peflctx=0xaab85fba
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLParamData
symbol_peflctx=0xaab86102
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLPutData
symbol_peflctx=0xaab871fc
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLRowCount
symbol_peflctx=0xaab87364
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLSetEnvAttr
symbol_peflctx=0xaab89054
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLSetDescRec
symbol_peflctx=0xaab88e20
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLColAttributeW
symbol_peflctx=0xaab7d6ba
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLColumnsW
symbol_peflctx=0xaab7e264
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLConnectW
symbol_peflctx=0xaab7e6b4
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLDescribeColW
symbol_peflctx=0xaab7f39e
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLDriverConnectW
symbol_peflctx=0xaab7fa9a
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLExecDirectW
symbol_peflctx=0xaab805e6
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLForeignKeysW
symbol_peflctx=0xaab80de6
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLGetConnectAttrW
symbol_peflctx=0xaab82714
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLGetDescFieldW
symbol_peflctx=0xaab83c76
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLGetDescRecW
symbol_peflctx=0xaab83fbe
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLGetDiagFieldW
symbol_peflctx=0xaab8448a
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLGetDiagRecW
symbol_peflctx=0xaab84916
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLGetInfoW
symbol_peflctx=0xaab85136
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLGetStmtAttrW
symbol_peflctx=0xaab85456
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLGetTypeInfoW
symbol_peflctx=0xaab8576e
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLPrepareW
symbol_peflctx=0xaab863b0
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLPrimaryKeysW
symbol_peflctx=0xaab8667c
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLProcedureColumnsW
symbol_peflctx=0xaab86a14
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLProceduresW
symbol_peflctx=0xaab86e64
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLSetConnectAttrW
symbol_peflctx=0xaab874ac
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLSetStmtAttrW
symbol_peflctx=0xaab896c8
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLSetDescFieldW
symbol_peflctx=0xaab88b00
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLStatisticsW
symbol_peflctx=0xaab89e64
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Entered hgolofns at 2013/07/11-16:06:03
libname=/etc/newlib/libodbc.so, funcname=SQLTablesW
symbol_peflctx=0xaab8a668
hoaerr:0
Exiting hgolofns at 2013/07/11-16:06:03
Exiting hgolofn, rc=0 at 2013/07/11-16:06:03
HOSGIP for "HS_OPEN_CURSORS" returned "50"
HOSGIP for "HS_FDS_FETCH_ROWS" returned "100"
HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
HOSGIP for "HS_KEEP_REMOTE_COLUMN_SIZE" returned "OFF"
HOSGIP for "HS_FDS_DELAYED_OPEN" returned "TRUE"
HOSGIP for "HS_FDS_WORKAROUNDS" returned "0"
HOSGIP for "HS_FDS_MBCS_TO_GRAPHIC" returned "FALSE"
HOSGIP for "HS_FDS_GRAPHIC_TO_MBCS" returned "FALSE"
Invalid value of 64 given for HS_FDS_SQLLEN_INTERPRETATION
treat_SQLLEN_as_compiled = 1
Exiting hgoinit, rc=0 at 2013/07/11-16:06:03
hostmstr: 0: HOA After hoainit
hostmstr: 0: HOA Before hoalgon
Entered hgolgon at 2013/07/11-16:06:03
reco:0, name:oracle, tflag:0
Entered hgosuec at 2013/07/11-16:06:03
Exiting hgosuec, rc=0 at 2013/07/11-16:06:03
Entered hgopoer at 2013/07/11-16:06:03
hgopoer, line 233: got native error 408 and sqlstate 410; message follows...
408
Exiting hgopoer, rc=0 at 2013/07/11-16:06:03
hgolgon, line 193: calling SQLSetConnectAttr got sqlstate 410
Exiting hgolgon, rc=28500 at 2013/07/11-16:06:03 with error ptr FILE:hgolgon.c LINE:193 FUNCTION:hgolgon() ID:Connection Attribute: TRACE
hostmstr: 0: HOA After hoalgon
RPC Calling nscontrol(0), rc=0
hostmstr: 0: RPC Before Exit Agent
hostmstr: 0: HOA Before hoaexit
Entered hgoexit at 2013/07/11-16:06:03
Exiting hgoexit, rc=0
hostmstr: 0: HOA After hoaexit
hostmstr: 0: RPC After Exit Agent
I have looked up the errors on Oracle forums and could not get any valuable help anywhere.
Can someone kindly help out where I am going wrong?
Thanks,
Ram.Hello kgronau,
Thank You very much for your recommendations. I removed the parameter HS_FDS_TRACE_LEVEL = 255.
I added HS_FDS_FETCH_ROWS=1 and also HS_NLS_NCHAR = UCS2
Tested my sql statement, which yielded the result as follows:
SQL> select * from mdiaz.AREMAIL@samplink;
select * from mdiaz.AREMAIL@samplink
ERROR at line 1:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
㈵″㠵6
SO I thought I would give a try of removing the line HS_NLS_NCHAR = UCS2
and again tested my sql statement and it worked like a charm!!!!
I tested a count(*) and got the results back.
SQL> select count(*) from mdiaz.AREMAIL@samplink;
COUNT(*)
600
I really appreciate your valuable pointers and help.
Thanks once again!!!
Ram. -
Problem connecting from Oracle to MS Excel - 64 bit
Hello,
I have problem connecting to excel from oracle 11.2 using DG4ODBC.
OS - Windows 7 - 64 bit
Database version :- Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit
Created System DSN using ODBC:
Data Source Name = test12
Oracle home Path :- D:\app\11g64db\product\11.2.0\dbhome_1
Content of initdg4odbc.ora file :
# This is a sample agent init file that contains the HS parameters that are
# needed for the Database Gateway for ODBC
# HS init parameters
HS_FDS_CONNECT_INFO = test12
HS_FDS_TRACE_LEVEL = 255
# Environment variables required for the non-Oracle system
#set <envvar>=<value>
Content of listener.ora:
# listener.ora Network Configuration File: D:\app\11g64db\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = vis)
(ORACLE_HOME = D:\app\11g64db\product\11.2.0\dbhome_1)
(SID_NAME = vis)
(SID_DESC =
(PROGRAM = dg4odbc)
(SID_NAME = dg4odbc)
(ORACLE_HOME = D:\app\11g64db\product\11.2.0\dbhome_1)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
ADR_BASE_LISTENER = D:\app\11g64db
Content of tnsnames.ora:
# tnsnames.ora Network Configuration File: D:\app\11g64db\product\11.2.0\dbhome_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
excel_test =
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))
(CONNECT_DATA=(SID=dg4odbc))
(HS=OK)
VIS =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = vis)
Listener status
LSNRCTL for 64-bit Windows: Version 11.2.0.4.0 - Production on 29-AUG-2014 13:56
:11
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
Alias LISTENER
Version TNSLSNR for 64-bit Windows: Version 11.2.0.4.0 - Produ
ction
Start Date 29-AUG-2014 13:34:58
Uptime 0 days 0 hr. 21 min. 12 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File D:\app\11g64db\product\11.2.0\dbhome_1\network\admin\l
istener.ora
Listener Log File D:\app\11g64db\diag\tnslsnr\Est-Subramanya\listener\al
ert\log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "dg4odbc" has 1 instance(s).
Instance "dg4odbc", status UNKNOWN, has 1 handler(s) for this service...
Service "vis" has 2 instance(s).
Instance "vis", status UNKNOWN, has 1 handler(s) for this service...
Instance "vis", status READY, has 1 handler(s) for this service...
Service "visXDB" has 1 instance(s).
Instance "vis", status READY, has 1 handler(s) for this service...
The command completed successfully
DB Link:
CREATE PUBLIC DATABASE LINK TEST123 USING 'excel_test';
error while querying the data:
select * from test@test123;
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
ORA-02063: preceding line from TEST123
28500. 00000 - "connection from ORACLE to a non-Oracle system returned this message:"
*Cause: The cause is explained in the forwarded message.
*Action: See the non-Oracle system's documentation of the forwarded
message.
Error at Line: 1 Column: 20
Appreciate the help in advance............
Thanks...Also HS log file showed error.. Below are the contents of the trace file:
Oracle Corporation --- FRIDAY AUG 29 2014 14:01:06.212
Heterogeneous Agent Release
11.2.0.4.0
Oracle Corporation --- FRIDAY AUG 29 2014 14:01:06.211
Version 11.2.0.4.0
Entered hgogprd
HOSGIP for "HS_FDS_TRACE_LEVEL" returned "255"
Entered hgosdip
setting HS_OPEN_CURSORS to default of 50
setting HS_FDS_RECOVERY_ACCOUNT to default of "RECOVER"
setting HS_FDS_RECOVERY_PWD to default value
setting HS_FDS_TRANSACTION_LOG to default of HS_TRANSACTION_LOG
setting HS_IDLE_TIMEOUT to default of 0
setting HS_FDS_TRANSACTION_ISOLATION to default of "READ_COMMITTED"
setting HS_NLS_NCHAR to default of "UCS2"
setting HS_FDS_TIMESTAMP_MAPPING to default of "DATE"
setting HS_FDS_DATE_MAPPING to default of "DATE"
setting HS_RPC_FETCH_REBLOCKING to default of "ON"
setting HS_FDS_FETCH_ROWS to default of "100"
setting HS_FDS_RESULTSET_SUPPORT to default of "FALSE"
setting HS_FDS_RSET_RETURN_ROWCOUNT to default of "FALSE"
setting HS_FDS_PROC_IS_FUNC to default of "FALSE"
setting HS_FDS_MAP_NCHAR to default of "TRUE"
setting HS_NLS_DATE_FORMAT to default of "YYYY-MM-DD HH24:MI:SS"
setting HS_FDS_REPORT_REAL_AS_DOUBLE to default of "FALSE"
setting HS_LONG_PIECE_TRANSFER_SIZE to default of "65536"
setting HS_SQL_HANDLE_STMT_REUSE to default of "FALSE"
setting HS_FDS_QUERY_DRIVER to default of "TRUE"
setting HS_FDS_SUPPORT_STATISTICS to default of "FALSE"
setting HS_FDS_QUOTE_IDENTIFIER to default of "TRUE"
setting HS_KEEP_REMOTE_COLUMN_SIZE to default of "OFF"
setting HS_FDS_GRAPHIC_TO_MBCS to default of "FALSE"
setting HS_FDS_MBCS_TO_GRAPHIC to default of "FALSE"
Default value of 64 assumed for HS_FDS_SQLLEN_INTERPRETATION
setting HS_CALL_NAME_ISP to "gtw$:SQLTables;gtw$:SQLColumns;gtw$:SQLPrimaryKeys;gtw$:SQLForeignKeys;gtw$:SQLProcedures;gtw$:SQLStatistics;gtw$:SQLGetInfo"
setting HS_FDS_DELAYED_OPEN to default of "TRUE"
setting HS_FDS_WORKAROUNDS to default of "0"
Exiting hgosdip, rc=0
ORACLE_SID is "dg4odbc"
Product-Info:
Port Rls/Upd:4/0 PrdStat:0
Agent:Oracle Database Gateway for ODBC
Facility:hsa
Class:ODBC, ClassVsn:11.2.0.4.0_0019, Instance:dg4odbc
Exiting hgogprd, rc=0
hostmstr: 8795961769984: HOA After hoagprd
hostmstr: 8795961769984: HOA Before hoainit
Entered hgoinit
HOCXU_COMP_CSET=1
HOCXU_DRV_CSET=178
HOCXU_DRV_NCHAR=1000
HOCXU_DB_CSET=873
HS_LANGUAGE not specified
rc=1239980 attempting to get LANG environment variable.
HOCXU_SEM_VER=112000
Entered hgolofn at 2014/08/29-14:01:06
Exiting hgolofn, rc=0 at 2014/08/29-14:01:06
HOSGIP for "HS_OPEN_CURSORS" returned "50"
HOSGIP for "HS_FDS_FETCH_ROWS" returned "100"
HOSGIP for "HS_LONG_PIECE_TRANSFER_SIZE" returned "65536"
HOSGIP for "HS_NLS_NUMERIC_CHARACTER" returned ".,"
HOSGIP for "HS_KEEP_REMOTE_COLUMN_SIZE" returned "OFF"
HOSGIP for "HS_FDS_DELAYED_OPEN" returned "TRUE"
HOSGIP for "HS_FDS_WORKAROUNDS" returned "0"
HOSGIP for "HS_FDS_MBCS_TO_GRAPHIC" returned "FALSE"
HOSGIP for "HS_FDS_GRAPHIC_TO_MBCS" returned "FALSE"
Invalid value of 64 given for HS_FDS_SQLLEN_INTERPRETATION
treat_SQLLEN_as_compiled = 1
Exiting hgoinit, rc=0 at 2014/08/29-14:01:06
hostmstr: 8795961769984: HOA After hoainit
hostmstr: 8795961769984: HOA Before hoalgon
Entered hgolgon at 2014/08/29-14:01:06
reco:0, name:OPTIM, tflag:0
Entered hgosuec at 2014/08/29-14:01:06
Exiting hgosuec, rc=0 at 2014/08/29-14:01:06
HOSGIP for "HS_FDS_RECOVERY_ACCOUNT" returned "RECOVER"
HOSGIP for "HS_FDS_TRANSACTION_LOG" returned "HS_TRANSACTION_LOG"
HOSGIP for "HS_FDS_TIMESTAMP_MAPPING" returned "DATE"
HOSGIP for "HS_FDS_DATE_MAPPING" returned "DATE"
HOSGIP for "HS_FDS_MAP_NCHAR" returned "TRUE"
HOSGIP for "HS_FDS_RESULTSET_SUPPORT" returned "FALSE"
HOSGIP for "HS_FDS_RSET_RETURN_ROWCOUNT" returned "FALSE"
HOSGIP for "HS_FDS_PROC_IS_FUNC" returned "FALSE"
HOSGIP for "HS_FDS_REPORT_REAL_AS_DOUBLE" returned "FALSE"
using OPTIM as default value for "HS_FDS_DEFAULT_OWNER"
HOSGIP for "HS_SQL_HANDLE_STMT_REUSE" returned "FALSE"
Entered hgocont at 2014/08/29-14:01:06
HS_FDS_CONNECT_INFO = "test12"
RC=-1 from HOSGIP for "HS_FDS_CONNECT_STRING"
Entered hgogenconstr at 2014/08/29-14:01:06
dsn:test12, name:OPTIM
optn:
Entered hgocip at 2014/08/29-14:01:06
dsn:test12
Exiting hgocip, rc=0 at 2014/08/29-14:01:06
##>Connect Parameters (len=31)<##
## DSN=test12;
#! UID=OPTIM;
#! PWD=*
Exiting hgogenconstr, rc=0 at 2014/08/29-14:01:06
Entered hgopoer at 2014/08/29-14:01:06
SQLGetDiagRec returns rc=100 (SQL_NO_DATA) for handle 4619630 (SQL_HANDLE_DBC)
Exiting hgopoer, rc=0 at 2014/08/29-14:01:06 with error ptr FILE:hgopoer.c LINE:186 ID:GetDiagRec error
hgocont, line 2831: calling SqlDriverConnect got sqlstate
Exiting hgocont, rc=28500 at 2014/08/29-14:01:06 with error ptr FILE:hgocont.c LINE:2851 ID:Something other than invalid authorization
Exiting hgolgon, rc=28500 at 2014/08/29-14:01:06 with error ptr FILE:hgolgon.c LINE:806 ID:Calling hgocont
hostmstr: 8795908591616: HOA After hoalgon
RPC Calling nscontrol(0), rc=0
hostmstr: 8795908591616: RPC Before Exit Agent
hostmstr: 8795908591616: HOA Before hoaexit
Entered hgoexit at 2014/08/29-14:01:06
Exiting hgoexit, rc=0
hostmstr: 8795911442432: HOA After hoaexit
hostmstr: 8795911442432: RPC After Exit Agent -
Date Format in VC from Oracle Database
Hi all,
I created one BI JDBC system to access table from Oracle. I have written one query using SQL Editor. That Query displays the Valid From date and Valid To date. If I test the data service it displays the date correctly what we have given . But whenever I run that model, it displays Jan 01,2000 instead of all date. What is the problem?
The Date format in oracle is YYYY-MM-DD HH:MM:SS.0 .Whether VC is support this format or not? Why it is taking Jan 01,2000?
Help me in this regard. How can I resolve my problem?
Thanks& Regards,
Hemalatha Jhi
i think you have to change your web service interface, from Date to Time
so you can use time format function
holp it make help
good day -
Delay due to selecting sysdate from dual
Our application accessing dummy table dual frequently for getting current date and time. But some times this could reduce our database performance.
How could we overcome this problem.
ASH report_
Top Events_
latch: library cache 29.87 "5015593920","214","0" 26.57 address number tries
Top SQL Statements_
0vnruqfxmtu6q Select to_number(to_char(Sysdate, 'YYYYMMDD')) from dualorianmoon wrote:
Thanks for your replies,
Please check this below link which shows my database performance at the time of running a particular sql , which is selecting sysdate using table dual. It created Lbrary cache latch contention.
http://arun-itadmin.blogspot.com/2010/12/oracle-performance-screen.html
My question is
Is this the problem of frequent usage of table dual or usage of 'sysdate' ?
It there any way to get date and time other than using sysdate function?
Edited by: orianmoon on Dec 8, 2010 9:42 PMI don't see anything there that points the finger at SELECT SYSDATE FROM DUAL;
Maybe you are looking for
-
PI 7.1 memory settings ?
Hi Guys, I have installled PI 7.1 and i am looking for ABAP and Java memory settings. I am facing lot of short dump errors on the ABAP side when installing the support packs. I have restored the image back and now i want to set the memory parameters
-
My Nikon D810 will not tether with lightroom. I've tried three different USB 3.0 Cords, Two different computers and reinstalling lightroom and have made sure its up to date 5.6 Help?
-
How do I find if IMAP is enabled on my company's exchange server
I am thinking that IMAP is enabled on my company's exchange server. How ever, I cannot connect to the the exchange server using my iphone? Can some one enlighten me if they have got this working? telnet abc.xyz.com 143 Trying xx.yy.ww.zz... Connected
-
A report that shows all the elements with their setting
Hi Is there a way to write a report in discoverer which will show all the elements set up in Oracle with there settings e.g. are they taxable or niable etc. Alternatively is there a standard report in HRMS which would give the same results. Thanks in
-
[SOLVED] Renaming Desktop folder in XFCE, where to change the path?
I'd like to rename the folder Desktop to Czech equivalent Plocha, but of course when I do it, it prevents xfcedesktop from loading it's content to actual desktop (so I have empty desktop than, or only with Trash bin). I'd say I have to change the pat