10.12.2012 Views

Oracle C++ Call Interface Programmer's Guide

Oracle C++ Call Interface Programmer's Guide

Oracle C++ Call Interface Programmer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

OCCI Demonstration Programs<br />

}<br />

* default values of username & password<br />

*/<br />

username = "SCOTT";<br />

password = "TIGER";<br />

url = "";<br />

void setUsername (string u)<br />

{<br />

username = u;<br />

}<br />

void setPassword (string p)<br />

{<br />

password = p;<br />

}<br />

void setUrl (string u)<br />

{<br />

url = u;<br />

}<br />

void runSample ()<br />

throw (SQLException)<br />

{<br />

Environment *env = Environment::createEnvironment (<br />

Environment::DEFAULT);<br />

try<br />

{<br />

Connection *conn = env->createConnection (username, password, url);<br />

Statement *stmt1;<br />

insertRows (conn);<br />

/**<br />

* Reading a populated clob & printing its property.<br />

*/<br />

string sqlQuery = "SELECT ad_sourcetext FROM print_media WHERE product_<br />

id=3333";<br />

Statement *stmt = conn->createStatement (sqlQuery);<br />

ResultSet *rset = stmt->executeQuery ();<br />

while (rset->next ())<br />

{<br />

Clob clob = rset->getClob (1);<br />

cout

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!