473,657 Members | 2,626 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem faced with OCIDate binding

1 New Member
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 2142

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

Similar topics

1
1442
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
3013
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) { static FILE *dbg = fopen("pakets.log", "wbc"); if (dbg)
5
2584
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 date, name, address etc) about the selected row in the datagrid... My problem is when I enter a new record in the details tabpage (saves data to database), and go back to the datagrid. Only the data from the PM-table
4
6204
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. Each task is processed in a separate thread. Each of the executer threads is an STA thread, and it goes ahead and executes the task. No problems are encountered when tasks are executed one at a time, but when multiple tasks are executed...
0
2208
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 correctly, posting to the wrong forum, or committing some other sort of faux pas. My team is developing a Windows Forms application using VS 2005 with SQL Server 2005 on the back end and we're having a problem using ComboBoxes data bound to lookup...
0
1046
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 problem I faced was, in select statments, if i run a page have a select statement in page load, it's some times work and other times not work with no rules in this issue, this confused me too much
3
4693
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 ... weblogic.xml.schema.model.XSDException: Unable to resolve definition for :c2p:breezeAuthenticationE lementsType perhaps due to the lack of an import statement for namespace http://
2
6582
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 in the child datagrid and then go to the combobox and choose another vendor. When the new vendor is loaded nothing shows in the datagrid but the itemsource shows the info is there. Know if I click on the child cell and then click back on the...
0
2552
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" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="300" Height="300"> <Grid Width="Auto" Height="Auto">
0
8385
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8821
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7316
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.