Anybody had any luck writing BLOBS to ORACLE 8 via ODBC using MFC's CLongBinary? I can read from LONG RAW calumns inro CLongBinary objects but cannot exchange in the other direction. Any Ideas?
Printable View
Anybody had any luck writing BLOBS to ORACLE 8 via ODBC using MFC's CLongBinary? I can read from LONG RAW calumns inro CLongBinary objects but cannot exchange in the other direction. Any Ideas?
hi Chris,
I am also had the same problem some times back. But able to solve by the following way.
1.Find the length of the data and allocate memory and get handle for the memory in HGLOBAL type(HGLOBAL hGlobal).
2.GlobalLock fun lock the allocated memory area and assign a pointer to that memory(char *pcData).
3.Then move the data from the variable(apcFieldvalue) to memory(pcData) using for...loop. then UnLock memory .
4. Assign the handle to the memory area(hGlobal) to the member of CLongBinary(m_hData).and the length of the data to another member of CLongBinary(m_dwDataLength).
5. Then call SetFieldDirty and SetFieldNull functions to indicate changes.
6. Then call Update to data into table.
NOTE:
m_pSet--- Recordset pointer
m_Emailid ----member representing the long column in table
m_No ---------member representing varchar column in the table
hGlobal =::GlobalAllocGHND,auLength);
m_pSet->AddNew();
m_pSet->m_No = h+1;
pcData =(char *)::GlobalLock(hGlobal);
for(unsigned long j=0;j<auLength;j++)
{
pcData[j] = apcFieldvalue[j];
}
::GlobalUnlock(hGlobal);
m_pSet->m_EMailid.m_hData = hGlobal;
m_pSet->m_EMailid.m_dwDataLength = ::GlobalSize(m_pSet->m_EMailid.m_hData );
m_pSet->SetFieldDirty(&m_pSet->m_EMailid,TRUE);
m_pSet->SetFieldNull(&m_pSet->m_EMailid,FALSE);
m_pSet->Update();
I don't know how to read from the table using CLongBinary. It make a lot of problem for me. Can you help me how to read it?
-Kannan.A.
email::[email protected]
Hi Chris
you are very Lucck that you can read the longraw data from Oracle. My Problem is that I cannot even read the Data from the Oracle Blob. I believe that Code in VC++ should be same for reading long raw or BLOB.
can you please give me the Source code for reading the Blob data from Oracle.
As far as Storing of the Binary Data in the Oracle I am Using the Oracle Stored to do that , if you want to know how we can store the binary Data throught the Stored procedures I can give you the Source of the Oracle Stored Procedure :)))
Thanks in advance
Hi Chris
you are very Lucck that you can read the longraw data from Oracle. My Problem is that I cannot even read the Data from the Oracle Blob. I believe that Code in VC++ should be same for reading long raw or BLOB.
can you please give me the Source code for reading the Blob data from Oracle.
As far as Storing of the Binary Data in the Oracle I am Using the Oracle Stored to do that , if you want to know how we can store the binary Data through the Stored procedures I can give you the Source of the Oracle Stored Procedure :)))
Thanks in advance