Click to See Complete Forum and Search --> : c++ and Oracle connectivity


amitesh
September 4th, 2001, 07:39 AM
Sir,

I want to connect C++ with Oracle . So that I can take data from menu made in c++ and Store data in Oracle tables .
amitesh

ad

Duy Tran
September 4th, 2001, 07:11 PM
TESTHR(pConn.CreateInstance(__uuidof(Connection)));
TESTHR(pRS.CreateInstance(__uuidof(Recordset)));

try
{
pConn->Open("Provider=sqloledb;Data Source=Sydney;"
"Initial Catalog=radio;User Id=sa;Password=f1ng3rs;","","",adConnectUnspecified);
pRS->PutRefActiveConnection(pConn);
pRS->Open("SELECT artistname, albumname, songname, fileLocationASF, fileLocationRA, songID FROM song WHERE uploadedToISP=0 ORDER BY songID DESC;",
vtMissing, adOpenForwardOnly, adLockReadOnly, adCmdText);


while (!pRS->adoEOF)
{
vtArtist = pRS->Fields->GetItem((long)0)->GetValue();
vtAlbum = pRS->Fields->GetItem((long)1)->GetValue();
vtSong = pRS->Fields->GetItem((long)2)->GetValue();
vtFileLocationASF = pRS->Fields->GetItem((long)3)->GetValue();
vtFileLocationRA = pRS->Fields->GetItem((long)4)->GetValue();
vtSongID = pRS->Fields->GetItem((long)5)->GetValue();

strBuff.Format("%s - %s - %s", (char*)((_bstr_t)vtArtist), (char*)((_bstr_t)vtAlbum), (char*)((_bstr_t)vtSong));
BSTR bstrFilename = strBuff.AllocSysString();
if (ftpUploadFile(bstrFilename, m_strFTPServername, (char*)((_bstr_t)vtFileLocationASF), (char*)((_bstr_t)vtFileLocationRA), m_strFTPASFRoot, m_strFTPRARoot))
{
strBuff.Format("radioUpdateUploadedToISP %li", vtSongID.lVal);
//AfxMessageBox(strSQL);
BSTR bstrSQL = strBuff.AllocSysString();
pConn->Execute(bstrSQL, NULL, adExecuteNoRecords);
SysFreeString(bstrSQL);
pRS->MoveNext();
}
SysFreeString(bstrFilename);
}
pRS->Close();
pConn->Close();
}
catch (_com_error)
{

}

Paul McKenzie
September 4th, 2001, 08:29 PM
I have little experience with C++ and Oracle, but maybe you should take a look at this:

http://www.geocities.com/skuchin/otl/home.htm

Regards,

Paul McKenzie

Sayan Mukherjee
September 4th, 2001, 08:42 PM
Hi,

You can use the standard ODBC API, provided by Microsoft.
It is a set of functions to access and use any database. The
detailed help on these functions and their usage is available in
MSDN.

You will also need any ODBC driver for the Oracle RDBMS. Common
ones are those from Oracle and Microsoft.

The Oracle ODBC driver for Oracle RDBMS (SQORA32.DLL) gets
installed when you install Oracle client on your machine.

The Microsoft ODBC driver for Oracle RDBMS (MSORCL32.DLL)
comes bundled with Win2K.

Hope this helps.

With best regards,
Sayan



Sayan Mukherjee
Calcutta (INDIA)
Email: sayan1968@yahoo.com

Zeeshan
September 5th, 2001, 12:26 AM
I have done little bit work on it and make a small frame work which fullfill my requirment by directly calling Oracle Native API i.e. OCI (Oracle Call Interface).

you can take a look at

http://www.codeguru.com/mfc_database/OciClasses1.shtml
http://www.codeguru.com/mfc_database/Osql10.shtml
http://ocicpplib.sourceforge.net/
http://gsinfo.sogang.ac.kr/~nicepat/callinterface.html
http://www.firstobject.com/
http://www.netcologne.de/~nc-poitscka/
http://freespace.virgin.net/j.hatcher/ociwrap.htm

Hope it helps.