The following describes how VC connects to the oracle database and SQL Server for your reference. If you are interested in connecting to the oracle database, take a look.
Connect VC to oracle Database
- _ ConnectionPtr m_pConn;
- CString m_sConn = "Provider = MSDAORA.1; Data Source = sode_192.168.3.9"; // use
- Ms Connection Library, sode is SID, 192.168.3.9 is the machine ip Address
- M_pConn.CreateInstance ("ADODB. Connection ");
- Try
- {
- HRESULT hr = m_pConn-> Open (_ bstr_t) m_sConn, "sodeUser", "sodePw", adConnectUnspecified );
- If (FAILED (hr ))
- {
- AfxMessageBox ("cannot connect to database source! ");
- Return FALSE;
- }
- }
- Catch (_ com_error e)
- {
- AfxMessageBox ("the database error cannot be opened! ");
- Return FALSE;
- }
Connect to the SQL Server database using VC
- _ ConnectionPtr m_pConn;
- CString m_sConn = "Provider = SQLOLEDB.1; Data Source = 192.168.3.9; Initial
- Catalog = sode "; // sode is a database on the database server 192.168.3.9.
- M_pConn.CreateInstance ("ADODB. Connection ");
- Try
- {
- HRESULT hr = m_pConn-> Open (_ bstr_t) m_sConn, "sa", "mapper", adConnectUnspecified );
- If (FAILED (hr ))
- {
- AfxMessageBox ("cannot connect to database source! ");
- Return FALSE;
- }
- }
- Catch (_ com_error e)
- {
- AfxMessageBox ("cannot connect to database error! ");
- Return FALSE;
- }
C # connect to the Oracle database to query data
Instances that use oracle Stored Procedure Paging
Oracle RMAN backup Optimization
Learn about Oracle OS backup
Provides you with an in-depth understanding of how ORACLE runs.