473,397 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Problem faced with OCIDate binding

1
Hi,

It would really be of great help if you could suggest a solution for me.

Program:

I need to execute a stored procedure from an Oracle server through a C++ program using oci.h (Oracle Call Interface) libraries of C.
Expand|Select|Wrap|Line Numbers
  1. #include <oci.h>
  2. #define FMT "DAY, MONTH DD, YYYY"
  3. #define LANG "American"
  4.  
  5. OCIDate       v1_sqlret7 ;
  6.  
  7. //binding for 7th output <This is because the Output Parameter No 7 would be in Date format>
  8.   retVal = OCIBindByName( mystmthp, &myempwhatbindhp, myerrhp,
  9.            (text *)":v_retval7", strlen(":v_retval7"), &v1_sqlret7,(sword) sizeof(v1_sqlret7) , SQLT
  10. _ODT, 0, 0, 0, 0,0, OCI_DEFAULT );
  11.  
  12.   if ( ( OCI_SUCCESS != retVal ) && ( OCI_SUCCESS_WITH_INFO != retVal ) )
  13.   {
  14.    OTCLIB_TRACER(MODULE) << "OCIBindByName failed for calling Output Parameter No 7" << endl;
  15.    cout<< "OCIBindByName failed for calling Output Parameter No 7" << endl;
  16.   }
  17.  
  18. which means that the OCIBindByName is successful.Else it would return an error code. But when I try to display what has been stored in the variable 'v1_sqlret7', I use the following function after binding at runtime, 
  19.  
  20. if(OCIDateToText(myerrhp,&v1_sqlret7,(text *)FMT, (ub1) sizeof(FMT)-1, (text *)LANG,(ub4) sizeof(LAN
  21. G)-1 ,&buflen, errbuf)!=OCI_SUCCESS)
  22. {
  23.         cout<<"OCI Error for converting date to Text"<<endl;
  24. }
  25. else
  26. {
  27.         cout<<"The date is :: "<<errbuf<<endl;
  28. }
  29.  
No compilation error was thrown.

Output Date displayed after bind during execution:

The date is :: MONDAY , SAT 00, 9202

Here the date is bound but is not correct.We have asked for the format <DAY, MONTH DD, YYYY> which is in defined variable FMT.

The strange and funny part in this is that the output always remains the same as above even when I try to retrieve a record pertaining to different dates. But if I try to retrieve the output in a variable by connecting to the Oracle server directly using Sqlplus, I receive the correct date in the default Oracle Date format, that is, 'DD-MON-YY' as '06-APR-07' or '07-APR-07'. This date is quite different than what I receive after binding which indicates that there is some problem with binding only.

I do not know whether any version mismatch may cause this issue and hence have attached the version details of both the Sun Compiler and also the Oracle server.

Oracle Server Version:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production


Compiler Version:
[manir@DEVCTDB manir]$ version
Machine hardware: sun4u
OS version: 5.8
Processor type: sparc
Hardware: SUNW,Sun-Fire-280R

The following components are installed on your system:


Sun Studio 9
Sun Studio 9 C Compiler
Sun Studio 9 C++ Compiler
Sun Studio 9 Tools.h++ 7.1
Sun Studio 9 C++ Standard 64-bit Class Library
Sun Studio 9 Garbage Collector
Sun Studio 9 Fortran 95
Sun Studio 9 Debugging Tools (including dbx)
Sun Studio 9 Debugger GUI
Sun Studio 9 Performance Tools (including collect, ...)
Sun Studio 9 X-Designer
Sun Studio 9 VIM editor
Sun Studio 9 XEmacs editor
Sun Studio 9 Native Connector Tool
Sun Studio 9 LockLint
Sun Studio 9 Building Software (including dmake)
Sun Studio 9 Documentation Set

version of "/opt/Forte6.2/SUNWspro/bin/../prod/bin/../../bin/cc": Sun C 5.6 2004/07/15
version of "/opt/Forte6.2/SUNWspro/bin/../prod/bin/../../bin/CC": Sun C++ 5.6 2004/07/15
version of "/opt/Forte6.2/SUNWspro/bin/../prod/bin/../../bin/f90": Sun Fortran 95 8.0 2004/07/15
version of "/opt/Forte6.2/SUNWspro/bin/../prod/bin/../../bin/dbx": Sun Dbx Debugger 7.3 2004/07/15
version of "/opt/Forte6.2/SUNWspro/bin/../prod/bin/../../bin/analyzer": Sun Performance Analyzer 7.3 2004/07/15
version of "/opt/Forte6.2/SUNWspro/bin/../prod/bin/../../bin/dmake": Sun Distributed Make 7.5 2004/07/15

Regards
Mani.R
Apr 9 '07 #1
0 2115

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jack | last post by:
What is the biggest problem you have faced in upgrading applications from Visual Studio 6 to Visual Studio .NET ? You are welcome to share your experiences. Thanks
4
by: Timothy Madden | last post by:
Hello everybody ! I have a function in a dll that will write bytes of data in a log file. The function has a local static FILE pointer like this: void VMLogPacket(BYTE *pData, size_t nSize) {...
5
by: Jeff | last post by:
IDE: VS 2003 :NET OS: XP Pro My app have a form with a tab-control on it. The tab-control have 2 tabpages. One of the tabpages displays a datagrid, and the other tabpage displays details (order...
4
by: Madhu Gopinathan | last post by:
Hi All, I am faced with a horrible hang problem. I have a COM exe server that executes some tasks. The task execution manager is a thread that manages the pool of threads, which is 4 per processor....
0
by: mjsterz | last post by:
I've been working with VB .NET for less than a year and this is the first time I've posted on one of these groups, so let me apologize beforehand if I'm being unclear, not posting my issue...
0
by: Wael Nofal | last post by:
I faced a problem with .Net 2.0 application working with oracle database using Entrprise Library Application installed on Win 2003 web server and oracle insalled on Sun Solaris 64 bit The...
3
by: shreya | last post by:
While generating client jar files from ant command using build.xml I am getting following error generate-client: Generating client jar for click2pstn.wsdl ... ...
2
by: =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post by:
I have a nested datagrid in a xaml file, the parent datagrid loads the vendor information and the details loads the documents for that vendor in a datagrid. Everything is working fine until I click...
0
by: furqanms | last post by:
Hello, I am new to WPF ,I am developing touch screen system using WPF. I am facing problem in Binding relative reference. Here is my code : <UserControl x:Class="uctlBrowser" ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.