Skip to content

Instantly share code, notes, and snippets.

@cx20
cx20 / hello.cpp
Created June 10, 2012 14:24
Hello, OCCI World!
#include <iostream>
#include <occi.h>
using namespace std;
using namespace oracle::occi;
int main( int argc, char* argv[] )
{
Environment* env = Environment::createEnvironment();
Connection* con = env->createConnection("scott", "tiger", "orcl");
@cx20
cx20 / hello.c
Created June 10, 2012 14:23
Hello, OCI World!
#include <stdio.h>
#include <string.h>
#include <oci.h>
int main( int argc, char* argv[] )
{
sword status = OCI_SUCCESS;
OCIEnv* envhp;
OCIError* errhp;
OCISvcCtx* svchp;
@cx20
cx20 / hello.cpp
Created June 10, 2012 14:21
Hello, ADO(C++) World! (ADO + OLEDB + SQL Server)
#include <stdio.h>
#include <tchar.h>
#import "msado15.dll" no_namespace rename("EOF", "adoEOF")
int _tmain( int argc, TCHAR* argv[] )
{
CoInitialize(NULL);
_ConnectionPtr cn("ADODB.Connection");
_RecordsetPtr rs("ADODB.Recordset");
@cx20
cx20 / hello.cpp
Created June 10, 2012 14:20
Hello, DAO(C++) World! (DAO12.0 + ACE)
#include <stdio.h>
#include <tchar.h>
#import "acedao.dll" no_namespace rename("EOF", "aceEOF")
int _tmain( int argc, TCHAR* argv[] )
{
CoInitialize(NULL);
_DBEnginePtr dbe("DAO.DBEngine.120");
DatabasePtr db = dbe->OpenDatabase( _T("hello.accdb") );
@cx20
cx20 / hello.cpp
Created June 10, 2012 14:19
Hello, DAO(C++) World! (DAO3.6 + Jet)
#include <stdio.h>
#include <tchar.h>
#import "dao360.dll" no_namespace rename("EOF", "daoEOF")
int _tmain( int argc, TCHAR* argv[] )
{
CoInitialize(NULL);
_DBEnginePtr dbe("DAO.DBEngine.36");
DatabasePtr db = dbe->OpenDatabase( _T("hello.mdb") );
@cx20
cx20 / hello.cpp
Created June 10, 2012 14:17
Hello, OLE DB(C++) World!
#include <atldbcli.h>
int _tmain( int argc, TCHAR* argv[] )
{
CoInitialize(NULL);
USES_CONVERSION;
CDataSource ds;
CSession ses;
CCommand<CDynamicAccessor> rs;
@cx20
cx20 / hello.cpp
Created June 10, 2012 14:16
Hello, DAO(MFC) World!
#include <afx.h>
#include <afxdao.h>
int _tmain( int argc, TCHAR* argv[] )
{
CDaoDatabase db;
db.Open( _T("hello.mdb") );
CDaoRecordset rs( &db );
CString strSQL = _T("SELECT 'Hello, DAO(MFC) World!' AS Message");
@cx20
cx20 / hello.cpp
Created June 10, 2012 14:15
Hello, ODBC(MFC) World!
#include <afx.h>
#include <afxdb.h>
int _tmain( int argc, TCHAR* argv[] )
{
CDatabase db;
CString strCon = _T("Driver={SQL Server};SERVER=(local);DATABASE=master;UID=sa;PWD=P@ssW0rd");
CString strSQL = _T("SELECT 'Hello, ODBC(MFC) World!' AS Message");
@cx20
cx20 / Hello.vb
Created June 10, 2012 14:13
Hello, ADO.NET World! (VB.NET + ADO.NET + SQL Server)
Imports System
Imports System.Data.SqlClient
Class Hello
Shared Sub Main()
Dim conStr As String = "SERVER=(local);" _
& "DATABASE=master;" _
& "UID=sa;" _
& "PWD=P@ssW0rd"
Dim sqlStr As String = "SELECT 'Hello, ADO.NET World!' AS Message"
@cx20
cx20 / Hello.cs
Created June 10, 2012 14:12
Hello, ADO.NET World! (C# + ADO.NET + SQL Server)
using System;
using System.Data.SqlClient;
class Hello
{
static void Main( String[] args )
{
string conStr = "SERVER=(local);"
+ "DATABASE=master;"
+ "UID=sa;"