<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-17554078</id><updated>2025-12-18T21:19:40.574+00:00</updated><title type='text'>Mark Williams :: Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://oradim.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>46</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-17554078.post-4004292684960617043</id><published>2009-11-21T23:47:00.001+00:00</published><updated>2009-11-21T23:50:01.614+00:00</updated><title type='text'>Quick Tip: Counting Cursors</title><content type='html'>&lt;p&gt;Counting the number of open cursors in a database instance can be a confusing activity. Perhaps an application has received an &amp;quot;ORA-01000: maximum open cursors exceeded&amp;quot; error message or perhaps you simply want to get an idea of how many cursors an application has open at some point in its execution. No matter the reason, you&#39;ve attempted to determine the number of open cursors and have found what seems like incorrect or confusing results (i.e. the value is too high!).&lt;/p&gt;  &lt;p&gt;Your first inclination may be to simply execute a query such as the following to determine how many cursors are currently open in an instance:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;select count(*) from v$open_cursor&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;- or -&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;select sid, count(*) from v$open_cursor group by sid order by sid&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This seems like a perfectly reasonable thing to do given that you want to find out how many open cursors there are. However, it is just about a guarantee that this query will not give you what you really want. Why is this so? Some reasons for this are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Sessions that are no longer connected can be reported &lt;/li&gt;    &lt;li&gt;Cursors that are closed as far as the application is concerned but are cached on the server side can be reported (for example, by using release_cursor=no in Pro*C/C++) &lt;/li&gt;    &lt;li&gt;Cursors cached by PL/SQL can be counted &lt;/li&gt;    &lt;li&gt;Cursors from recursive SQL can be counted &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;In order to get a more representative value for the number of actual open cursors, try a query such as this:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;select&amp;#160;&amp;#160; a.sid,      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; a.value,       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; b.name       &lt;br /&gt;from&amp;#160;&amp;#160;&amp;#160;&amp;#160; v$sesstat a,       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; v$statname b       &lt;br /&gt;where&amp;#160;&amp;#160;&amp;#160; a.statistic# = b.statistic#       &lt;br /&gt;and&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; b.name = &#39;opened cursors current&#39;       &lt;br /&gt;and&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; a.value != 0       &lt;br /&gt;order by a.sid&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This query should be a good starting point and can be altered as necessary to suit your needs.&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/4004292684960617043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/4004292684960617043'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/11/quick-tip-counting-cursors.html' title='Quick Tip: Counting Cursors'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-7878071373294127123</id><published>2009-09-26T18:48:00.001+00:00</published><updated>2009-09-26T18:57:14.360+00:00</updated><title type='text'>Getting Started with Oracle Pro*C on Linux (Instant Client Zip Files)</title><content type='html'>&lt;p&gt;The Oracle Pro*C Precompiler is a popular choice for developing Oracle applications in the C/C++ languages. The primary advantage of using the precompiler is that it allows you to embed SQL (and PL/SQL) directly into your application. Used in combination with Oracle Instant Client packages you can easily begin to develop applications using the Pro*C Precompiler capabilities. For information on getting started using Pro*C on Windows, please see my previous post entitled &amp;quot;&lt;a href=&quot;http://oradim.blogspot.com/2009/05/oracle-proc-on-windows-with-express.html&quot; target=&quot;_blank&quot;&gt;Oracle Pro*C on Windows with Express Edition Products&lt;/a&gt;&amp;quot;.&lt;/p&gt;  &lt;p&gt;Many of the components used in the previous post are also used here and the steps are similar (if not the same). For this post, all components are installed on a single host (oel02) running Oracle Enterprise Linux. The components used are (valid at time of posting):&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Oracle Database 10g Express Edition (available &lt;a href=&quot;http://www.oracle.com/technology/software/products/database/index.html&quot;&gt;here&lt;/a&gt;) &lt;/li&gt;    &lt;li&gt;Oracle Enterprise Linux (available &lt;a href=&quot;http://edelivery.oracle.com/linux&quot;&gt;here&lt;/a&gt;) &lt;/li&gt;    &lt;li&gt;Oracle Instant Client 11.2.0.1 Packages for Linux x86 (available &lt;a href=&quot;http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;) &lt;/li&gt;    &lt;li&gt;&amp;#160;&amp;#160;&amp;#160; Instant Client Package - Basic Lite &lt;/li&gt;    &lt;li&gt;&amp;#160;&amp;#160;&amp;#160; Instant Client Package - SDK &lt;/li&gt;    &lt;li&gt;&amp;#160;&amp;#160;&amp;#160; Instant Client Package - Precompiler &lt;/li&gt;    &lt;li&gt;&amp;#160;&amp;#160;&amp;#160; Instant Client Package - SQL*Plus &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;NOTE: The precompiler uses the &amp;quot;standard&amp;quot; Oracle Technology Network license rather than the Instant Client license. Be sure to review the license!&lt;/p&gt;  &lt;p&gt;You can, of course, allow for some variation in the above; however, you may then need to make adjustments to the steps that follow. For example, the database can be on another host and/or platform. In order to keep things as simple as possible I have elected to use a single host for everything. In order for the sample code to work unaltered you should have access to the HR sample schema user (included in Express Edition). If you require character set or language support not provided by the &amp;quot;Basic Lite&amp;quot; Instant Client package you should use the &amp;quot;Basic&amp;quot; package. In addition, version 11.1.0.7 of the components should work as well (though I have not tested it).&lt;/p&gt;  &lt;h3&gt;Installing the Instant Client Packages&lt;/h3&gt;  &lt;p&gt;I downloaded the following Instant Client packages using the above provided link to my home directory on oel02:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;instantclient-basiclite-linux32-11.2.0.1.zip &lt;/li&gt;    &lt;li&gt;instantclient-precomp-linux32-11.2.0.1.zip &lt;/li&gt;    &lt;li&gt;instantclient-sdk-linux32-11.2.0.1.zip &lt;/li&gt;    &lt;li&gt;instantclient-sqlplus-linux32-11.2.0.1.zip &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Installing each one is simply a matter of unzipping each file:&lt;/p&gt;  &lt;p&gt;[markwill@oel02 ~]$ unzip instantclient-basiclite-linux32-11.2.0.1.zip    &lt;br /&gt;[markwill@oel02 ~]$ unzip instantclient-precomp-linux32-11.2.0.1.zip     &lt;br /&gt;[markwill@oel02 ~]$ unzip instantclient-sdk-linux32-11.2.0.1.zip     &lt;br /&gt;[markwill@oel02 ~]$ unzip instantclient-sqlplus-linux32-11.2.0.1.zip&lt;/p&gt;  &lt;p&gt;The act of unzipping the files will create an &amp;quot;instantclient_11_2&amp;quot; directory in the directory where the files are unzipped (/home/markwill in my case). The complete list of files installed after unzipping each file is as follows:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@oel02 ~]$ cd instantclient_11_2/      &lt;br /&gt;[markwill@oel02 instantclient_11_2]$ pwd       &lt;br /&gt;/home/markwill/instantclient_11_2       &lt;br /&gt;[markwill@oel02 instantclient_11_2]$ find .       &lt;br /&gt;.       &lt;br /&gt;./libsqlplusic.so       &lt;br /&gt;./libclntsh.so.11.1       &lt;br /&gt;./cobsqlintf.o       &lt;br /&gt;./ojdbc6.jar       &lt;br /&gt;./sqlplus       &lt;br /&gt;./adrci       &lt;br /&gt;./libnnz11.so       &lt;br /&gt;./SQLPLUS_README       &lt;br /&gt;./PRECOMP_README       &lt;br /&gt;./libociicus.so       &lt;br /&gt;./ojdbc5.jar       &lt;br /&gt;./sdk       &lt;br /&gt;./sdk/demo       &lt;br /&gt;./sdk/demo/demo_procob_ic.mk       &lt;br /&gt;./sdk/demo/occiobj.cpp       &lt;br /&gt;./sdk/demo/occidemo.sql       &lt;br /&gt;./sdk/demo/occiobj.typ       &lt;br /&gt;./sdk/demo/occidemod.sql       &lt;br /&gt;./sdk/demo/demo_proc_ic.mk       &lt;br /&gt;./sdk/demo/demo.mk       &lt;br /&gt;./sdk/demo/occidml.cpp       &lt;br /&gt;./sdk/demo/procdemo.pc       &lt;br /&gt;./sdk/demo/procobdemo.pco       &lt;br /&gt;./sdk/demo/cdemo81.c       &lt;br /&gt;./sdk/procob       &lt;br /&gt;./sdk/rtsora       &lt;br /&gt;./sdk/SDK_README       &lt;br /&gt;./sdk/ott       &lt;br /&gt;./sdk/ottclasses.zip       &lt;br /&gt;./sdk/include       &lt;br /&gt;./sdk/include/orid.h       &lt;br /&gt;./sdk/include/occiAQ.h       &lt;br /&gt;./sdk/include/oratypes.h       &lt;br /&gt;./sdk/include/nzerror.h       &lt;br /&gt;./sdk/include/sqlkpr.h       &lt;br /&gt;./sdk/include/oci1.h       &lt;br /&gt;./sdk/include/sql2oci.h       &lt;br /&gt;./sdk/include/ocikpr.h       &lt;br /&gt;./sdk/include/ocidef.h       &lt;br /&gt;./sdk/include/oci.h       &lt;br /&gt;./sdk/include/ldap.h       &lt;br /&gt;./sdk/include/ort.h       &lt;br /&gt;./sdk/include/ocixmldb.h       &lt;br /&gt;./sdk/include/ocidfn.h       &lt;br /&gt;./sdk/include/ocixstream.h       &lt;br /&gt;./sdk/include/oraca.h       &lt;br /&gt;./sdk/include/sqlcpr.h       &lt;br /&gt;./sdk/include/odci.h       &lt;br /&gt;./sdk/include/ori.h       &lt;br /&gt;./sdk/include/occiCommon.h       &lt;br /&gt;./sdk/include/occi.h       &lt;br /&gt;./sdk/include/ociapr.h       &lt;br /&gt;./sdk/include/sqlca.h       &lt;br /&gt;./sdk/include/occiObjects.h       &lt;br /&gt;./sdk/include/sqlucs2.h       &lt;br /&gt;./sdk/include/occiControl.h       &lt;br /&gt;./sdk/include/sqlda.h       &lt;br /&gt;./sdk/include/xa.h       &lt;br /&gt;./sdk/include/ocidem.h       &lt;br /&gt;./sdk/include/oci8dp.h       &lt;br /&gt;./sdk/include/ociextp.h       &lt;br /&gt;./sdk/include/occiData.h       &lt;br /&gt;./sdk/include/ociap.h       &lt;br /&gt;./sdk/include/nzt.h       &lt;br /&gt;./sdk/include/orl.h       &lt;br /&gt;./sdk/include/oro.h       &lt;br /&gt;./sdk/include/sqlapr.h       &lt;br /&gt;./sdk/proc       &lt;br /&gt;./libocci.so.11.1       &lt;br /&gt;./libocijdbc11.so       &lt;br /&gt;./genezi       &lt;br /&gt;./BASIC_LITE_README       &lt;br /&gt;./xstreams.jar       &lt;br /&gt;./libsqlplus.so       &lt;br /&gt;./glogin.sql       &lt;br /&gt;./precomp       &lt;br /&gt;./precomp/admin       &lt;br /&gt;./precomp/admin/pcscfg.cfg       &lt;br /&gt;./precomp/admin/pcbcfg.cfg       &lt;br /&gt;[markwill@oel02 instantclient_11_2]$&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;Configure the Environment&lt;/h3&gt;  &lt;p&gt;One of the nice things about using Pro*C on Linux (and UNIX) is that we do not normally have to configure the Pro*C configuration file (pcscfg.cfg) as would generally be necessary in Windows. As a convenience for setting environment variables (such as the PATH), in my home directory I have created a file I use to do this (I&#39;m using the bash shell here):&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@oel02 ~]$ cat oic11.env      &lt;br /&gt;export ORACLE_BASE=/home/markwill       &lt;br /&gt;export ORACLE_HOME=$ORACLE_BASE/instantclient_11_2       &lt;br /&gt;export LD_LIBRARY_PATH=$ORACLE_HOME       &lt;br /&gt;export PATH=$ORACLE_HOME:$ORACLE_HOME/sdk:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:~/bin       &lt;br /&gt;[markwill@oel02 ~]$&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;I can then set my environment to use the newly installed Oracle components as follows:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@oel02 ~]$ . ./oic11.env&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;Test the Oracle Installation&lt;/h3&gt;  &lt;p&gt;Since SQL*Plus was installed as part of the above packages, it can be used to quickly and easily test the installation. Here I connect to the Express Edition database as the HR sample schema user using the EZConnect syntax (host:port/Service_Name):&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@oel02 ~]$ sqlplus hr/hr@oel02:1521/XE &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;SQL*Plus: Release 11.2.0.1.0 Production on Sat Sep 26 13:27:59 2009 &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;Copyright (c) 1982, 2009, Oracle.&amp;#160; All rights reserved. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;Connected to:      &lt;br /&gt;Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;SQL&amp;gt; select user from dual; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;USER      &lt;br /&gt;------------------------------       &lt;br /&gt;HR &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;SQL&amp;gt; exit      &lt;br /&gt;Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production       &lt;br /&gt;[markwill@oel02 ~]$&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;Create a Test Application&lt;/h3&gt;  &lt;p&gt;Now that I have tested that the Oracle software is working correctly, I create a simple test application. I call the test application &amp;quot;proctest&amp;quot; and create a new directory to hold the files:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@oel02 ~]$ mkdir -p Projects/proc/proctest     &lt;br /&gt;[markwill@oel02 ~]$ cd Projects/proc/proctest&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Here&#39;s the content of the proctest.pc source file:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@oel02 proctest]$ cat proctest.pc     &lt;br /&gt;/*      &lt;br /&gt;** standard include files for Pro*C application      &lt;br /&gt;*/      &lt;br /&gt;#include &amp;lt;stdio.h&amp;gt;      &lt;br /&gt;#include &amp;lt;string.h&amp;gt;      &lt;br /&gt;#include &amp;lt;stdlib.h&amp;gt;      &lt;br /&gt;#include &amp;lt;sqlca.h&amp;gt;      &lt;br /&gt;#include &amp;lt;sqlda.h&amp;gt;      &lt;br /&gt;#include &amp;lt;sqlcpr.h&amp;gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;#define NAME_LEN 30     &lt;br /&gt;#define ERR_LEN 512 &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;VARCHAR username[NAME_LEN];     &lt;br /&gt;VARCHAR password[NAME_LEN];      &lt;br /&gt;VARCHAR database[NAME_LEN]; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;/*     &lt;br /&gt;** host variables to hold results of query      &lt;br /&gt;*/      &lt;br /&gt;int&amp;#160;&amp;#160;&amp;#160;&amp;#160; dept;      &lt;br /&gt;VARCHAR fname[NAME_LEN];      &lt;br /&gt;VARCHAR lname[NAME_LEN];      &lt;br /&gt;int&amp;#160;&amp;#160;&amp;#160;&amp;#160; sal;      &lt;br /&gt;int&amp;#160;&amp;#160;&amp;#160;&amp;#160; rn; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;/*     &lt;br /&gt;** indicator variables used to determine null-ness      &lt;br /&gt;*/      &lt;br /&gt;short dept_ind;      &lt;br /&gt;short fname_ind;      &lt;br /&gt;short lname_ind;      &lt;br /&gt;short sal_ind;      &lt;br /&gt;short rn_ind; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;/*     &lt;br /&gt;** standard Pro*C error handler function      &lt;br /&gt;*/      &lt;br /&gt;void sql_error(char *msg)      &lt;br /&gt;{      &lt;br /&gt;&amp;#160; char err_msg[ERR_LEN];      &lt;br /&gt;&amp;#160; size_t buf_len, msg_len; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; EXEC SQL WHENEVER SQLERROR CONTINUE; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; printf(&amp;quot;\n&amp;quot;); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; if (msg)     &lt;br /&gt;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; printf(&amp;quot;%s\n&amp;quot;, msg);      &lt;br /&gt;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; buf_len = sizeof (err_msg);     &lt;br /&gt;&amp;#160; sqlglm(err_msg, &amp;amp;buf_len, &amp;amp;msg_len);      &lt;br /&gt;&amp;#160; printf(&amp;quot;%.*s&amp;quot;, msg_len, err_msg); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; EXEC SQL ROLLBACK RELEASE; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; exit(EXIT_FAILURE);     &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;int main(int argc, char *argv[])     &lt;br /&gt;{      &lt;br /&gt;&amp;#160; /*      &lt;br /&gt;&amp;#160; ** setup username, password and database (ezconnect format)      &lt;br /&gt;&amp;#160; */      &lt;br /&gt;&amp;#160; strncpy((char *) username.arr, &amp;quot;hr&amp;quot;, NAME_LEN);      &lt;br /&gt;&amp;#160; username.len = (unsigned short) strlen((char *) username.arr); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; strncpy((char *) password.arr, &amp;quot;hr&amp;quot;, NAME_LEN);     &lt;br /&gt;&amp;#160; password.len = (unsigned short) strlen((char *) password.arr); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; strncpy((char *) database.arr, &amp;quot;oel02:1521/XE&amp;quot;, NAME_LEN);     &lt;br /&gt;&amp;#160; database.len = (unsigned short) strlen((char *) database.arr); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; /*     &lt;br /&gt;&amp;#160; ** register the error handler function      &lt;br /&gt;&amp;#160; */      &lt;br /&gt;&amp;#160; EXEC SQL WHENEVER SQLERROR DO sql_error(&amp;quot;ORACLE error: \n&amp;quot;); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; /*     &lt;br /&gt;&amp;#160; ** attempt to connect to the database      &lt;br /&gt;&amp;#160; */      &lt;br /&gt;&amp;#160; EXEC SQL CONNECT :username IDENTIFIED BY :password USING :database; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; /*     &lt;br /&gt;&amp;#160; ** indicate we want to break out of the loop when we get a no data      &lt;br /&gt;&amp;#160; ** found message (i.e. at end of fetch)      &lt;br /&gt;&amp;#160; */      &lt;br /&gt;&amp;#160; EXEC SQL WHENEVER NOT FOUND DO break; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; /*     &lt;br /&gt;&amp;#160; ** declare and open cursor using analytic function      &lt;br /&gt;&amp;#160; ** to get &amp;quot;top 3&amp;quot; in department by highest salary      &lt;br /&gt;&amp;#160; */      &lt;br /&gt;&amp;#160; EXEC SQL DECLARE emp_cursor CURSOR FOR      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; select&amp;#160;&amp;#160; *      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; from      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; (      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; select&amp;#160;&amp;#160; department_id,      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; first_name,      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; last_name,      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; salary,      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; row_number() over (partition by department_id      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; order by salary desc) rn      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; from&amp;#160;&amp;#160;&amp;#160;&amp;#160; employees      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; where&amp;#160;&amp;#160;&amp;#160; department_id is not null      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; )      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; where&amp;#160;&amp;#160; rn &amp;lt;= 3; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; EXEC SQL OPEN emp_cursor; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; /*     &lt;br /&gt;&amp;#160; ** loop through cursor fetching results      &lt;br /&gt;&amp;#160; ** and printing as we go      &lt;br /&gt;&amp;#160; */      &lt;br /&gt;&amp;#160; for (;;)      &lt;br /&gt;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; EXEC SQL FETCH emp_cursor      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; INTO :dept:dept_ind,      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; :fname:fname_ind,      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; :lname:lname_ind,      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; :sal:sal_ind,      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; :rn:rn_ind; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; fname.arr[fname.len] = &#39;\0&#39;;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; lname.arr[lname.len] = &#39;\0&#39;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; printf(&amp;quot;%d, %s %s, %d, %d\n&amp;quot;, dept, fname.arr, lname.arr, sal, rn);     &lt;br /&gt;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; /*     &lt;br /&gt;&amp;#160; ** clean-up and exit      &lt;br /&gt;&amp;#160; */      &lt;br /&gt;&amp;#160; EXEC SQL CLOSE emp_cursor; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; EXEC SQL COMMIT RELEASE; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; return EXIT_SUCCESS;     &lt;br /&gt;}      &lt;br /&gt;[markwill@oel02 proctest]$&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The sample application is pretty bland - the only real point of interest is the use of an analytic function to get the &amp;quot;top 3&amp;quot; ranking of salaries by department. The use of the analytic function will allow us to see how options can be passed to the Pro*C precompiler.&lt;/p&gt;  &lt;h3&gt;Building the Sample&lt;/h3&gt;  &lt;p&gt;Rather than craft a custom Makefile or enter the various build/compiler commands by hand, the demonstration Makefile that is provided as part of the precompiler package installed earlier can be used with only small modification. To use this Makefile, copy it into the directory with the source file. On my system this was done as follows:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@oel02 proctest]$ cp $ORACLE_HOME/sdk/demo/demo_proc_ic.mk .&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;I use VIM to edit the file. Of course you can use whatever editor you wish.&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@oel02 proctest]$ vi demo_proc_ic.mk&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The important part is listed in the &amp;quot;NOTES&amp;quot; section in the Makefile:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;# NOTES:     &lt;br /&gt;#&amp;#160;&amp;#160;&amp;#160; 1. Please change &amp;quot;cc/CC&amp;quot; and the &amp;quot;InstantClient directories&amp;quot; to point to      &lt;br /&gt;#&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; appropiate locations on your machine before using this makefile.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Because the CC and cc entries are already correct, I did not alter them. I did, however, change the Instant Client directory entries as follows:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;# InstantClient Directories.     &lt;br /&gt;ICSDKHOME=$(ORACLE_HOME)/sdk/      &lt;br /&gt;ICLIBHOME=$(ORACLE_HOME)/&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;By using the ORACLE_HOME environment variable (which is set in my oic11.env file) in the Makefile I do not need to hard-code the actual path.&lt;/p&gt;  &lt;p&gt;Before building the sample, take a minute or two to review the Makefile comments. I build the sample using the following command-line:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@oel02 proctest]$ make -f demo_proc_ic.mk build PROCFLAGS=&amp;quot;common_parser=yes&amp;quot; \     &lt;br /&gt;&amp;gt; EXE=proctest OBJS=&amp;quot;proctest.o&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Notice how PROCFLAGS is used to pass the &amp;quot;common_parser=yes&amp;quot; to the proc binary (i.e the Pro*C program itself). The EXE option determines the name of the binary executable produced and the OBJS option determines what object files are needed. In this case the options are simple, but larger and more complex projects likely use more than a single object file and possibly other Pro*C options.&lt;/p&gt;  &lt;p&gt;Once the build has completed test the application:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@oel02 proctest]$ ./proctest     &lt;br /&gt;10, Jennifer Whalen, 4400, 1      &lt;br /&gt;20, Michael Hartstein, 13000, 1      &lt;br /&gt;20, Pat Fay, 6000, 2&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[ snip ]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;100, Nancy Greenberg, 12000, 1     &lt;br /&gt;100, Daniel Faviet, 9000, 2      &lt;br /&gt;100, John Chen, 8200, 3      &lt;br /&gt;110, Shelley Higgins, 12000, 1      &lt;br /&gt;110, William Gietz, 8300, 2      &lt;br /&gt;[markwill@oel02 proctest]$&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;One final addition I make to the Makefile is creating a new target called &amp;quot;dust&amp;quot;. A Makefile traditionally has a &amp;quot;clean&amp;quot; target which can be used to remove various (non-source!) files. These files are generally used during the build process, but are not needed by the final executable. The &amp;quot;clean&amp;quot; target also removes the executable, however. Since I like the idea of being able to clean the no longer necessary files, but want to keep the executable, I add a target called &amp;quot;dust&amp;quot;. Here&#39;s the &amp;quot;end&amp;quot; of the Makefile with the &amp;quot;dust&amp;quot; target added:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;# Clean up all executables, *.o and generated *.c files     &lt;br /&gt;clean: $(CLNCACHE)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $(REMOVE) $(PROCDEMO) $(PROCDEMO).o $(PROCDEMO).c $(PROCDEMO).lis &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;dust: $(CLNCACHE)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $(REMOVE) $(PROCDEMO).o $(PROCDEMO).c $(PROCDEMO).lis &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;cleancache:     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $(REMOVE) $(CACHEDIR)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $(REMOVE) $(ICLIBHOME)libclntsh$(SO_EXT)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Of course, adding this target is purely optional; however, after building the sample, I then &amp;quot;dust&amp;quot; the directory:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@oel02 proctest]$ make -f demo_proc_ic.mk dust PROCDEMO=proctest     &lt;br /&gt;rm -rf SunWS_cachea      &lt;br /&gt;rm -rf /home/markwill/instantclient_11_2/libclntsh.so      &lt;br /&gt;rm -rf proctest.o proctest.c proctest.lis      &lt;br /&gt;[markwill@oel02 proctest]$&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This then leaves the directory a bit cleaner with only the Makefile, source file, and executable:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@oel02 proctest]$ ls -al     &lt;br /&gt;total 28      &lt;br /&gt;drwxrwxr-x&amp;#160; 2 markwill markwill 4096 Sep 26 14:31 .      &lt;br /&gt;drwxrwxr-x&amp;#160; 3 markwill markwill 4096 Sep 26 13:40 ..      &lt;br /&gt;-rw-rw-r--&amp;#160; 1 markwill markwill 3617 Sep 26 14:31 demo_proc_ic.mk      &lt;br /&gt;-rwxrwxr-x&amp;#160; 1 markwill markwill 9798 Sep 26 14:29 proctest      &lt;br /&gt;-rw-rw-r--&amp;#160; 1 markwill markwill 2900 Sep 26 14:14 proctest.pc      &lt;br /&gt;[markwill@oel02 proctest]$&lt;/font&gt;&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/7878071373294127123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/7878071373294127123'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/09/getting-started-with-oracle-proc-on.html' title='Getting Started with Oracle Pro*C on Linux (Instant Client Zip Files)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-4986742494518672059</id><published>2009-09-16T18:39:00.002+00:00</published><updated>2009-09-16T18:50:04.659+00:00</updated><title type='text'>ODAC 11.1.0.7.20 Production Release Available</title><content type='html'>The new ODAC 11.1.0.7.20 Production release is now available. See these links for more information and to download. &lt;br /&gt;&lt;br /&gt;- &lt;a href=&quot;http://www.oracle.com/technology/software/tech/windows/odpnet/index.html&quot;&gt;Download&lt;/a&gt;&lt;br /&gt;- &lt;a href=&quot;http://www.oracle.com/technology/tech/windows/odpnet/newfeatures.html&quot;&gt;New Features List&lt;/a&gt;&lt;br /&gt;- &lt;a href=&quot;http://www.oracle.com/technology/tech/dotnet/viewlets/sqltuneadvisor_viewlet/sqltuneadvisor.html&quot;&gt;ODT SQL Tuning Advisor Viewlet&lt;/a&gt;&lt;br /&gt;- &lt;a href=&quot;http://www.oracle.com/technology/tech/dotnet/viewlets/addm_viewlet/addm_viewlet.html&quot;&gt;ODT Oracle Performance Analyzer Viewlet&lt;/a&gt;&lt;br /&gt;- &lt;a href=&quot;http://www.oracle.com/technology/tech/windows/odpnet/col/odp.net_11.1.0.7.20_twp.pdf&quot;&gt;ODP.NET 11.1.07.20 White Paper&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Happy coding.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/4986742494518672059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/4986742494518672059'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/09/odac-1110720-production-release.html' title='ODAC 11.1.0.7.20 Production Release Available'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-1942495266895462564</id><published>2009-09-05T00:59:00.001+00:00</published><updated>2009-09-05T13:10:30.659+00:00</updated><title type='text'>ODP.NET: The provider is not compatible with the version of Oracle client</title><content type='html'>&lt;p&gt;One potentially perplexing error that may be raised when using Oracle Data Provider for .NET (ODP.NET) is &amp;quot;The provider is not compatible with the version of Oracle client&amp;quot;. The reason I say &amp;quot;potentially perplexing&amp;quot; is that the error can be raised in a situation that doesn&#39;t necessarily seem to agree with the wording of the message. More on that later.&lt;/p&gt;  &lt;p&gt;ODP.NET consists of both managed and unmanaged components. The managed component is the Oracle.DataAccess.dll and one of the key unmanaged components is the OraOpsXX.dll which I refer to as the bridge dll. The exact name of OraOpsXX.dll depends on the ODP.NET version as well as the .NET Framework version. In this post I am using ODAC 11.1.0.6.21 which includes ODP.NET versions targeted to the .NET Framework 1.x and 2.x versions. Beginning with the 10.2 versions of ODP.NET the .NET Framework major version is pre-pended to the ODP.NET version to differentiate between 1.x and 2.x of the .NET Framework. Therefore, the Oracle.DataAccess.dll I am using will report 2.111.6.20 as its version number. The corresponding OraOpsXX.dll will be named OraOps11w.dll and is found in the %ORACLE_HOME%\bin directory if using a full install or (typically) in the root folder of an Instant Client install.&lt;/p&gt;  &lt;p&gt;I&#39;ll show what I think are the three most common reasons for this error. In order to do so, I use a (very) simple C# console application:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;using System;      &lt;br /&gt;using System.Data;       &lt;br /&gt;using Oracle.DataAccess.Types;       &lt;br /&gt;using Oracle.DataAccess.Client; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;namespace NotCompatibleTest      &lt;br /&gt;{       &lt;br /&gt;&amp;#160; class Program       &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; static void Main(string[] args)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /*       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; * connection string using EZCONNECT format       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; * be sure to change for your environment       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; */       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; string constr = &amp;quot;user id=hr;&amp;quot; +       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;password=hr;&amp;quot; +       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;data source=liverpool:1521/V112;&amp;quot; +       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;enlist=false;&amp;quot; +       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;pooling=false&amp;quot;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /*      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; * create and open connection       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; */       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; OracleConnection con = new OracleConnection(constr);       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; con.Open(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /*      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; * write server version to console       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; */       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console.WriteLine(&amp;quot;Connected to Oracle version {0}&amp;quot;,       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; con.ServerVersion); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; /*      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; * explicit clean-up       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; */       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; con.Dispose();       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;&amp;#160; }       &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;As you can see this simply connects to a database, writes the server version to the console window, and exits. However, it is sufficient to use ODP.NET and for the purposes here. I simply execute this sample in debug mode from within Visual Studio for each of the &amp;quot;tests&amp;quot;.&lt;/p&gt;  &lt;h3&gt;Cause 1: OraOpsXX.dll is Wrong Version (and Hence the Client is Too)&lt;/h3&gt;  &lt;p&gt;This is a typical case and the message text makes the most sense for this case. Here, the correct version can not be found. How might this occur? One easy way is when you develop your application using 11.1.0.6 of Oracle Client and ODP.NET and then deploy to a machine that has a lower version of Oracle Client and ODP.NET installed. This is what the error looks like in debug mode with an unhandled TypeInitializationException when instantiating the OracleConnection object in the sample code:&lt;/p&gt;  &lt;h3&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1-noaetkor4z4R25bNyeN_MyDBH4N8ZvKDz6Mvvsy_zey5qPxY5NHH1ZTurDG4gAKRngmPxvdWGbqecEOLmO3WfOx8nDRGQeABYbDSPeMJRCaZYLL3QPjS5918U78rKXYKjJpZA/s1600-h/PNC_Cause1%5B3%5D.png&quot;&gt;&lt;img title=&quot;PNC_Cause1&quot; style=&quot;border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;276&quot; alt=&quot;PNC_Cause1&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbtJzPCavt5eQvQbtEAQfm7Fwh4PppbUf7PIKL7z5_xymdRLhKtY-ZLhoy2FLmhhUusnKxJzcAmatQKsYrp9VtZvrgbNNksMLluzN111Nwt-z7vVBrz2SY71IFjGZdOvzSlYfm7w/?imgmax=800&quot; width=&quot;622&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/h3&gt;  &lt;h3&gt;&amp;#160;&lt;/h3&gt;  &lt;h3&gt;Cause 2: OraOpsXX.dll is Missing&lt;/h3&gt;  &lt;p&gt;In order to simulate OraOpsXX.dll missing, I rename my OraOps11w.dll in %ORACLE_HOME%\bin to OraOps11wXX.dll and execute the sample. Sure enough, I get the same error as above. Here the message may not make as much sense. Instead of &amp;quot;The provider is not compatible with the version of Oracle client&amp;quot; it might be better if the message indicated the real issue is that OraOpsXX.dll can&#39;t be located.&lt;/p&gt;  &lt;h3&gt;Cause 3: The tricky one&lt;/h3&gt;  &lt;p&gt;This cause is certainly less intuitive than either Cause 1 or Cause 2. As mentioned earlier, OraOpsXX.dll is unmanaged code. It also has a dependency on the Microsoft C runtime, in particular version 7 of the C runtime which lives in msvcr71.dll and which many systems have on the system path. However, if that file is not on the system path or in the same directory as OraOpsXX.dll you will receive the &amp;quot;The provider is not compatible with the version of Oracle client&amp;quot; message!&lt;/p&gt;  &lt;p&gt;If you are receiving &amp;quot;The provider is not compatible with the version of Oracle client&amp;quot; messages in your environment perhaps it is due to one of the three causes here.&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/1942495266895462564'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/1942495266895462564'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/09/odpnet-provider-is-not-compatible-with.html' title='ODP.NET: The provider is not compatible with the version of Oracle client'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhbtJzPCavt5eQvQbtEAQfm7Fwh4PppbUf7PIKL7z5_xymdRLhKtY-ZLhoy2FLmhhUusnKxJzcAmatQKsYrp9VtZvrgbNNksMLluzN111Nwt-z7vVBrz2SY71IFjGZdOvzSlYfm7w/s72-c?imgmax=800" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-625269607994462937</id><published>2009-08-16T19:28:00.002+00:00</published><updated>2009-08-17T22:29:01.726+00:00</updated><title type='text'>Getting Started with OCCI (Linux Version with RPM Instant Client)</title><content type='html'>&lt;p&gt;This is a follow-on post to the &amp;quot;&lt;a href=&quot;http://oradim.blogspot.com/2009/08/getting-started-with-occi-linux-version.html&quot; target=&quot;_blank&quot;&gt;Getting Started with OCCI (Linux Version)&lt;/a&gt;&amp;quot; and &amp;quot;&lt;a href=&quot;http://oradim.blogspot.com/2009/07/getting-started-with-occi-windows.html&quot; target=&quot;_blank&quot;&gt;Getting Started with OCCI (Windows Version)&lt;/a&gt;&amp;quot; posts. In the previous post on getting started with OCCI on Linux, I illustrated using the .zip file method of installing the Oracle Instant Client software. In this post I will cover using the .rpm file downloads rather than the .zip files. Much of the content is intentionally the same, however. This means I will need to use the &amp;quot;root&amp;quot; user to install the .rpm Instant Client packages. With the .zip file method this is not required.&lt;/p&gt;  &lt;p&gt;The steps should be general enough to easily mould them to your environment and/or needs.&lt;/p&gt;  &lt;p&gt;The Oracle C++ Call Interface, also known as OCCI, is an application programming interface (API) built upon the Oracle Call Interface (OCI - another lower level API from Oracle). One of the goals of OCCI is to offer C++ programmers easy access to Oracle Database in a fashion similar to what Java Database Connectivity (JDBC) affords Java developers. If you would like to learn more about what OCCI is (and isn&#39;t), pay a visit to the OCCI documentation on Oracle Technology Network (OTN) here:&lt;/p&gt;  &lt;p&gt;&lt;a title=&quot;http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28390/toc.htm&quot; href=&quot;http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28390/toc.htm&quot;&gt;http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28390/toc.htm&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;My goal with this &amp;quot;Getting Started&amp;quot; post is to give you one method of setting up an environment in which you can use OCCI to develop C++ applications under Linux that access Oracle Database. I am not in any way covering all possible scenarios or delving deep into OCCI itself. Please note that the database itself can be on any supported host.&lt;/p&gt;  &lt;h3&gt;The Environment&lt;/h3&gt;  &lt;p&gt;Your environment is likely to differ from mine; however, it is important to be familiar with the various components in the environment used here so that you can make adaptations as necessary for your specific environment.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Oracle Database Server/Host: oel01 (Oracle Enterprise Linux 32-bit server) &lt;/li&gt;    &lt;li&gt;Oracle Database: SID value of OEL11GR1, Service Name value of OEL11GR1.SAND, version 11.1.0.7 &lt;/li&gt;    &lt;li&gt;Development Machine: Hostname of &amp;quot;gerrard&amp;quot;, Oracle Enterprise Linux 32-bit (2.6.9 kernel) &lt;/li&gt;    &lt;li&gt;Development IDE: VIM (any text editor or IDE you can configure should work) &lt;/li&gt;    &lt;li&gt;Oracle Client: Oracle Instant Client with OCCI &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Important Information&lt;/h3&gt;  &lt;p&gt;One of the most crucial attributes of working with OCCI is that you &lt;em&gt;must&lt;/em&gt; ensure that &lt;em&gt;all&lt;/em&gt; of the components of the development environment &lt;em&gt;and&lt;/em&gt; the runtime environment are supported combinations and correct versions. I can not emphasize this enough. If you deviate from this, you will almost certainly find trouble! In order to find the correct combinations of products and versions, see the following links on OTN:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/tech/oci/occi/index.html&quot; target=&quot;_blank&quot;&gt;Oracle C++ Call Interface&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/tech/oci/occi/occidownloads.html&quot; target=&quot;_blank&quot;&gt;OCCI Downloads page&lt;/a&gt; (NOTE: you do not need to download any OCCI components for this walkthrough) &lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/tech/oci/instantclient/index.html&quot; target=&quot;_blank&quot;&gt;Oracle Database Instant Client&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/software/tech/oci/instantclient/index.html&quot; target=&quot;_blank&quot;&gt;Instant Client Downloads&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html&quot; target=&quot;_blank&quot;&gt;Instant Client Downloads for Linux 32-bit&lt;/a&gt; (NOTE: the necessary OCCI components are included in this package) &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Download the Correct Packages&lt;/h3&gt;  &lt;p&gt;The Linux packages come in two varieties: a .zip file or a .rpm file. For this install I have used the .rpm files.&lt;/p&gt;&lt;p&gt;From the download links above, you should download the following components to your development machine.&lt;ul&gt;   &lt;li&gt;Instant Client Package – Basic: oracle-instantclient11.1-basic-11.1.0.7.0-1.i386.rpm &lt;/li&gt;    &lt;li&gt;Instant Client Package - SDK: oracle-instantclient11.1-devel-11.1.0.7.0-1.i386.rpm &lt;/li&gt;    &lt;li&gt;Instant Client Package - SQL*Plus: oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.i386.rpm&amp;#160; (optional, but I always install it) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;NOTE: I am using the &amp;quot;Basic&amp;quot; version of the main Instant Client packages and not the &amp;quot;Basic Lite&amp;quot; version for this install. Whilst the &amp;quot;Basic Lite&amp;quot; version is a smaller download, the oracle-instantclient11.1-devel-11.1.0.7.0-1.i386.rpm package wants the full &amp;quot;Basic&amp;quot; rather than the &amp;quot;Basic Lite&amp;quot; package as a prerequisite. You could probably force the install anyway by using &amp;quot;--nodeps&amp;quot; but using the full package is not any more difficult. It also provides additional language support not present in the &amp;quot;lite&amp;quot; package.&lt;/p&gt;  &lt;h3&gt;Install the Instant Client Packages&lt;/h3&gt;  &lt;p&gt;Installing the Instant Client packages provided as .rpm files is simply a matter of downloading them and then using rpm in the normal fashion – there&#39;s really not too much to go wrong here! I downloaded each of them (3 total) into a directory called &amp;quot;/downloads&amp;quot; on &amp;quot;gerrard&amp;quot;. Each of the packages will provide the following files:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[root@gerrard downloads]# rpm -qlp oracle-instantclient11.1-basic-11.1.0.7.0-1.i386.rpm      &lt;br /&gt;/usr/lib/oracle/11.1/client/bin/adrci       &lt;br /&gt;/usr/lib/oracle/11.1/client/bin/genezi       &lt;br /&gt;/usr/lib/oracle/11.1/client/lib/libclntsh.so.11.1       &lt;br /&gt;/usr/lib/oracle/11.1/client/lib/libnnz11.so       &lt;br /&gt;/usr/lib/oracle/11.1/client/lib/libocci.so.11.1       &lt;br /&gt;/usr/lib/oracle/11.1/client/lib/libociei.so       &lt;br /&gt;/usr/lib/oracle/11.1/client/lib/libocijdbc11.so       &lt;br /&gt;/usr/lib/oracle/11.1/client/lib/ojdbc5.jar       &lt;br /&gt;/usr/lib/oracle/11.1/client/lib/ojdbc6.jar &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[root@gerrard downloads]# rpm -qlp oracle-instantclient11.1-devel-11.1.0.7.0-1.i386.rpm      &lt;br /&gt;/usr/include/oracle/11.1/client/nzerror.h       &lt;br /&gt;/usr/include/oracle/11.1/client/nzt.h       &lt;br /&gt;/usr/include/oracle/11.1/client/occi.h       &lt;br /&gt;/usr/include/oracle/11.1/client/occiAQ.h       &lt;br /&gt;/usr/include/oracle/11.1/client/occiCommon.h       &lt;br /&gt;/usr/include/oracle/11.1/client/occiControl.h       &lt;br /&gt;/usr/include/oracle/11.1/client/occiData.h       &lt;br /&gt;/usr/include/oracle/11.1/client/occiObjects.h       &lt;br /&gt;/usr/include/oracle/11.1/client/oci.h       &lt;br /&gt;/usr/include/oracle/11.1/client/oci1.h       &lt;br /&gt;/usr/include/oracle/11.1/client/oci8dp.h       &lt;br /&gt;/usr/include/oracle/11.1/client/ociap.h       &lt;br /&gt;/usr/include/oracle/11.1/client/ociapr.h       &lt;br /&gt;/usr/include/oracle/11.1/client/ocidef.h       &lt;br /&gt;/usr/include/oracle/11.1/client/ocidem.h       &lt;br /&gt;/usr/include/oracle/11.1/client/ocidfn.h       &lt;br /&gt;/usr/include/oracle/11.1/client/ociextp.h       &lt;br /&gt;/usr/include/oracle/11.1/client/ocikpr.h       &lt;br /&gt;/usr/include/oracle/11.1/client/ocixmldb.h       &lt;br /&gt;/usr/include/oracle/11.1/client/odci.h       &lt;br /&gt;/usr/include/oracle/11.1/client/oratypes.h       &lt;br /&gt;/usr/include/oracle/11.1/client/ori.h       &lt;br /&gt;/usr/include/oracle/11.1/client/orid.h       &lt;br /&gt;/usr/include/oracle/11.1/client/orl.h       &lt;br /&gt;/usr/include/oracle/11.1/client/oro.h       &lt;br /&gt;/usr/include/oracle/11.1/client/ort.h       &lt;br /&gt;/usr/include/oracle/11.1/client/xa.h       &lt;br /&gt;/usr/lib/oracle/11.1/client/lib/libclntsh.so       &lt;br /&gt;/usr/lib/oracle/11.1/client/lib/libocci.so       &lt;br /&gt;/usr/lib/oracle/11.1/client/lib/ottclasses.zip       &lt;br /&gt;/usr/share/oracle/11.1/client/cdemo81.c       &lt;br /&gt;/usr/share/oracle/11.1/client/demo.mk       &lt;br /&gt;/usr/share/oracle/11.1/client/occidemo.sql       &lt;br /&gt;/usr/share/oracle/11.1/client/occidemod.sql       &lt;br /&gt;/usr/share/oracle/11.1/client/occidml.cpp       &lt;br /&gt;/usr/share/oracle/11.1/client/occiobj.cpp       &lt;br /&gt;/usr/share/oracle/11.1/client/occiobj.typ       &lt;br /&gt;/usr/share/oracle/11.1/client/ott &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[root@gerrard downloads]# rpm -qlp oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.i386.rpm      &lt;br /&gt;/usr/bin/sqlplus       &lt;br /&gt;/usr/lib/oracle/11.1/client/bin/sqlplus       &lt;br /&gt;/usr/lib/oracle/11.1/client/lib/glogin.sql       &lt;br /&gt;/usr/lib/oracle/11.1/client/lib/libsqlplus.so       &lt;br /&gt;/usr/lib/oracle/11.1/client/lib/libsqlplusic.so&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;I then installed each of them as follows:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;rpm -ivh oracle-instantclient11.1-basic-11.1.0.7.0-1.i386.rpm      &lt;br /&gt;rpm -ivh oracle-instantclient11.1-devel-11.1.0.7.0-1.i386.rpm       &lt;br /&gt;rpm -ivh oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.i386.rpm&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;Configure The Environment&lt;/h3&gt;  &lt;p&gt;To facilitate easily using the new installation I create a file I can source to set my environment correctly. I use the csh (well, tcsh really) as my primary shell and I created a file called &amp;quot;oic11.csh&amp;quot; in my home directory to setup the environment for me:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@gerrard ~]$ cat oic11.csh      &lt;br /&gt;#       &lt;br /&gt;setenv ORACLE_BASE /usr/lib/oracle       &lt;br /&gt;setenv ORACLE_HOME ${ORACLE_BASE}/11.1/client       &lt;br /&gt;setenv LD_LIBRARY_PATH ${ORACLE_HOME}/lib       &lt;br /&gt;set path = (${ORACLE_HOME}/bin /usr/local/bin /bin /usr/bin /usr/X11R6/bin ~/bin)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;If you are using the bash shell, you may find something like the following helpful:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@gerrard ~]&amp;gt; cat oic11.env      &lt;br /&gt;export ORACLE_BASE=/usr/lib/oracle       &lt;br /&gt;export ORACLE_HOME=$ORACLE_BASE/11.1/client       &lt;br /&gt;export LD_LIBRARY_PATH=$ORACLE_HOME/lib       &lt;br /&gt;export PATH=$ORACLE_HOME/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:~/bin&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;I can then set my environment to use the new install as follows (in csh):&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;[markwill@gerrard ~]&amp;gt; source ./oic11.csh&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This could be done as follows for bash:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@gerrard ~]&amp;gt; . ./oic11.env&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;I also created a configuration file for the dynamic linker and updated the links/cache as follows:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[root@gerrard ~]# echo &amp;quot;/usr/lib/oracle/11.1/client/lib&amp;quot; &amp;gt; /etc/ld.so.conf.d/oic.conf      &lt;br /&gt;[root@gerrard ~]# /sbin/ldconfig&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;   &lt;br /&gt;Create a Simple Test Project&lt;/h3&gt;  &lt;p&gt;All the setup work is now complete and the environment is configured! If needed, you can use the following (very!) basic application as a simple test to verify things are working as expected. Again, this is a simple example only to verify things are setup correctly. It is not intended to be a complete template for &amp;quot;proper&amp;quot; code development, etc. Be sure to set the environment correctly!&lt;/p&gt;  &lt;p&gt;I created a &amp;quot;Projects&amp;quot; directory under my home directory and then a directory called &amp;quot;Employees&amp;quot; under the &amp;quot;Projects&amp;quot; directory. I then used VIM to create the Employees.h and Employees.cpp files.&lt;/p&gt;  &lt;p&gt;Here&#39;s the content of the Employees.h file on my system:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;     &lt;br /&gt;/*       &lt;br /&gt;&amp;nbsp;* A simple OCCI test application       &lt;br /&gt;&amp;nbsp;* This file contains the Employees class declaration       &lt;br /&gt;&amp;nbsp;*/ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;#include &amp;lt;occi.h&amp;gt;      &lt;br /&gt;#include &amp;lt;iostream&amp;gt;       &lt;br /&gt;#include &amp;lt;iomanip&amp;gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;using namespace oracle::occi;      &lt;br /&gt;using namespace std; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;class Employees {      &lt;br /&gt;public:       &lt;br /&gt;&amp;#160; Employees();       &lt;br /&gt;&amp;#160; virtual ~Employees(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; void List(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;private:      &lt;br /&gt;&amp;#160; Environment *env;       &lt;br /&gt;&amp;#160; Connection&amp;#160; *con; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; string user;      &lt;br /&gt;&amp;#160; string passwd;       &lt;br /&gt;&amp;#160; string db;       &lt;br /&gt;};&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Here&#39;s the content of the Employees.cpp file on my system:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;     &lt;br /&gt;/*       &lt;br /&gt;&amp;nbsp;* A simple OCCI test application       &lt;br /&gt;&amp;nbsp;* This file contains the Employees class implementation       &lt;br /&gt;&amp;nbsp;*/ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;#include &amp;quot;Employees.h&amp;quot; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;using namespace std;      &lt;br /&gt;using namespace oracle::occi; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;int main (void)      &lt;br /&gt;{       &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160;&amp;#160; * create an instance of the Employees class,       &lt;br /&gt;&amp;#160;&amp;#160; * invoke the List member, delete the instance,       &lt;br /&gt;&amp;#160;&amp;#160; * and prompt to continue...       &lt;br /&gt;&amp;#160;&amp;#160; */ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; Employees *pEmployees = new Employees(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; pEmployees-&amp;gt;List(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; delete pEmployees; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; cout &amp;lt;&amp;lt; &amp;quot;ENTER to continue...&amp;quot;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; cin.get(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; return 0;      &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;Employees::Employees()      &lt;br /&gt;{       &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160;&amp;#160; * connect to the test database as the HR       &lt;br /&gt;&amp;#160;&amp;#160; * sample user and use the EZCONNECT method       &lt;br /&gt;&amp;#160;&amp;#160; * of specifying the connect string. Be sure       &lt;br /&gt;&amp;#160;&amp;#160; * to adjust for your environment! The format       &lt;br /&gt;&amp;#160;&amp;#160; * of the string is host:port/service_name&lt;/font&gt;&lt;font face=&quot;Courier New&quot;&gt;      &lt;br /&gt;&amp;#160;&amp;#160; */ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; user = &amp;quot;hr&amp;quot;;      &lt;br /&gt;&amp;#160; passwd = &amp;quot;hr&amp;quot;;       &lt;br /&gt;&amp;#160; db = &amp;quot;oel01:1521/OEL11GR1.SAND&amp;quot;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; env = Environment::createEnvironment(Environment::DEFAULT); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; try      &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; con = env-&amp;gt;createConnection(user, passwd, db);       &lt;br /&gt;&amp;#160; }       &lt;br /&gt;&amp;#160; catch (SQLException&amp;amp; ex)       &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; ex.getMessage(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; exit(EXIT_FAILURE);      &lt;br /&gt;&amp;#160; }       &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;Employees::~Employees()      &lt;br /&gt;{       &lt;br /&gt;&amp;#160; env-&amp;gt;terminateConnection (con); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; Environment::terminateEnvironment (env);      &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;void Employees::List()      &lt;br /&gt;{       &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160;&amp;#160; * simple test method to select data from       &lt;br /&gt;&amp;#160;&amp;#160; * the employees table and display the results       &lt;br /&gt;&amp;#160;&amp;#160; */ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; Statement *stmt = NULL;      &lt;br /&gt;&amp;#160; ResultSet *rs = NULL;       &lt;br /&gt;&amp;#160; string sql = &amp;quot;select employee_id, first_name, last_name &amp;quot; \       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;from employees order by last_name, first_name&amp;quot;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; try      &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; stmt = con-&amp;gt;createStatement(sql);       &lt;br /&gt;&amp;#160; }       &lt;br /&gt;&amp;#160; catch (SQLException&amp;amp; ex)       &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; ex.getMessage();       &lt;br /&gt;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; if (stmt)      &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; try       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; stmt-&amp;gt;setPrefetchRowCount(32); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; rs = stmt-&amp;gt;executeQuery();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; catch (SQLException&amp;amp; ex)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; ex.getMessage();       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; if (rs)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; setw(8) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;ID&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(22) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;FIRST NAME&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(27) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;LAST NAME&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; endl;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; setw(8) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;======&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(22) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;====================&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(27) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;=========================&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; endl; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; while (rs-&amp;gt;next()) {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; setw(8) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; rs-&amp;gt;getString(1)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(22) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; (rs-&amp;gt;isNull(2) ? &amp;quot;n/a&amp;quot; : rs-&amp;gt;getString(2))       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(27) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; rs-&amp;gt;getString(3)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; endl;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; endl; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; stmt-&amp;gt;closeResultSet(rs);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; con-&amp;gt;terminateStatement(stmt);      &lt;br /&gt;&amp;#160; }       &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;To build the simple test I created a simplistic Makefile:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@gerrard Employees]&amp;gt; cat Makefile      &lt;br /&gt;Employees: Employees.cpp       &lt;br /&gt;&amp;#160; g++ -o Employees Employees.cpp \       &lt;br /&gt;&amp;#160; -I/usr/include/oracle/11.1/client \       &lt;br /&gt;&amp;#160; -L$(ORACLE_HOME)/lib -lclntsh -locci &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;debug: Employees.cpp      &lt;br /&gt;&amp;#160; g++ -ggdb3 -o Employees Employees.cpp \       &lt;br /&gt;&amp;#160; -I/usr/include/oracle/11.1/client \       &lt;br /&gt;&amp;#160; -L$(ORACLE_HOME)/lib -lclntsh -locci &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;clean:      &lt;br /&gt;&amp;#160; rm -f Employees&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;NOTE: The indented lines are tabs and not spaces in the Makefile&lt;/p&gt;  &lt;p&gt;Whilst certainly not destined to win any awards for Makefile creativity it suffices for the purpose at hand.&lt;/p&gt;  &lt;p&gt;I then built the application in debug mode by typing &amp;quot;make debug&amp;quot;.&lt;/p&gt;  &lt;p&gt;Executing the sample should result in output as follows:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@gerrard Employees]&amp;gt; ./Employees&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;ID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; FIRST NAME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; LAST NAME      &lt;br /&gt;======&amp;#160; ====================&amp;#160; =========================       &lt;br /&gt;174&amp;#160;&amp;#160;&amp;#160;&amp;#160; Ellen&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Abel       &lt;br /&gt;166&amp;#160;&amp;#160;&amp;#160;&amp;#160; Sundar&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Ande       &lt;br /&gt;130&amp;#160;&amp;#160;&amp;#160;&amp;#160; Mozhe&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Atkinson       &lt;br /&gt;105&amp;#160;&amp;#160;&amp;#160;&amp;#160; David&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Austin       &lt;br /&gt;204&amp;#160;&amp;#160;&amp;#160;&amp;#160; Hermann&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Baer       &lt;br /&gt;116&amp;#160;&amp;#160;&amp;#160;&amp;#160; Shelli&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Baida       &lt;br /&gt;167&amp;#160;&amp;#160;&amp;#160;&amp;#160; Amit&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Banda       &lt;br /&gt;172&amp;#160;&amp;#160;&amp;#160;&amp;#160; Elizabeth&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Bates&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[ snip ]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;120&amp;#160;&amp;#160;&amp;#160;&amp;#160; Matthew&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Weiss      &lt;br /&gt;200&amp;#160;&amp;#160;&amp;#160;&amp;#160; Jennifer&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Whalen       &lt;br /&gt;149&amp;#160;&amp;#160;&amp;#160;&amp;#160; Eleni&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Zlotkey &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;ENTER to continue...&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;If you are new to using OCCI on Linux and have used the .rpm file method of installing the Instant Client components, perhaps the above will be helpful in getting started!&lt;/p&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/625269607994462937'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/625269607994462937'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/08/getting-started-with-occi-linux-version_16.html' title='Getting Started with OCCI (Linux Version with RPM Instant Client)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-1670990589098232647</id><published>2009-08-15T23:57:00.001+00:00</published><updated>2009-08-16T00:09:44.748+00:00</updated><title type='text'>Getting Started with OCCI (Linux Version)</title><content type='html'>&lt;p&gt;This is a follow-on post to the &amp;quot;&lt;a href=&quot;http://oradim.blogspot.com/2009/07/getting-started-with-occi-windows.html&quot; target=&quot;_blank&quot;&gt;Getting Started with OCCI (Windows Version)&lt;/a&gt;&amp;quot; with the not too minor change of swapping out Windows for Linux as the development machine. Much of the content is intentionally the same, however. For this particular &amp;quot;walkthrough&amp;quot; (for lack of a better term) I illustrate creating a &amp;quot;private&amp;quot; installation of the Oracle software. That is, I extract the software under my user&#39;s home directory. This has the advantage that it is completely separate from any other user&#39;s software. Of course, it also has the disadvantage that if many users have the same software installed there will be duplication. As this machine has no other &amp;quot;normal&amp;quot; user accounts (i.e. non-system accounts such as &amp;quot;root&amp;quot;) other than my account this is not an issue for me.&lt;/p&gt;  &lt;p&gt;The steps should be general enough to easily mould them to your environment and/or needs.&lt;/p&gt;  &lt;p&gt;The Oracle C++ Call Interface, also known as OCCI, is an application programming interface (API) built upon the Oracle Call Interface (OCI - another lower level API from Oracle). One of the goals of OCCI is to offer C++ programmers easy access to Oracle Database in a fashion similar to what Java Database Connectivity (JDBC) affords Java developers. If you would like to learn more about what OCCI is (and isn&#39;t), pay a visit to the OCCI documentation on Oracle Technology Network (OTN) here:&lt;/p&gt;  &lt;p&gt;&lt;a title=&quot;http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28390/toc.htm&quot; href=&quot;http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28390/toc.htm&quot;&gt;http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28390/toc.htm&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;My goal with this &amp;quot;Getting Started&amp;quot; post is to give you one method of setting up an environment in which you can use OCCI to develop C++ applications under Linux that access Oracle Database. I am not in any way covering all possible scenarios or delving deep into OCCI itself. Please note that the database itself can be on any supported host.&lt;/p&gt;  &lt;h3&gt;The Environment&lt;/h3&gt;  &lt;p&gt;Your environment is likely to differ from mine; however, it is important to be familiar with the various components in the environment used here so that you can make adaptations as necessary for your specific environment.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Oracle Database Server/Host: oel01 (Oracle Enterprise Linux 32-bit server) &lt;/li&gt;    &lt;li&gt;Oracle Database: SID value of OEL11GR1, Service Name value of OEL11GR1.SAND, version 11.1.0.7 &lt;/li&gt;    &lt;li&gt;Development Machine: Hostname of &amp;quot;gerrard&amp;quot;, Oracle Enterprise Linux 32-bit (2.6.9 kernel) &lt;/li&gt;    &lt;li&gt;Development IDE: VIM (any text editor or IDE you can configure should work) &lt;/li&gt;    &lt;li&gt;Oracle Client: Oracle Instant Client with OCCI &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Important Information&lt;/h3&gt;  &lt;p&gt;One of the most crucial attributes of working with OCCI is that you &lt;em&gt;must&lt;/em&gt; ensure that &lt;em&gt;all&lt;/em&gt; of the components of the development environment &lt;em&gt;and&lt;/em&gt; the runtime environment are supported combinations and correct versions. I can not emphasize this enough. If you deviate from this, you will almost certainly find trouble! In order to find the correct combinations of products and versions, see the following links on OTN:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/tech/oci/occi/index.html&quot; target=&quot;_blank&quot;&gt;Oracle C++ Call Interface&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/tech/oci/occi/occidownloads.html&quot; target=&quot;_blank&quot;&gt;OCCI Downloads page&lt;/a&gt; (NOTE: you do not need to download any OCCI components for this walkthrough) &lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/tech/oci/instantclient/index.html&quot; target=&quot;_blank&quot;&gt;Oracle Database Instant Client&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/software/tech/oci/instantclient/index.html&quot; target=&quot;_blank&quot;&gt;Instant Client Downloads&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html&quot; target=&quot;_blank&quot;&gt;Instant Client Downloads for Linux 32-bit&lt;/a&gt; (NOTE: the necessary OCCI components are included in this package) &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Download the Correct Packages&lt;/h3&gt;  &lt;p&gt;The Linux packages come in two varieties: a .zip file or a .rpm file. I have used the .zip files since I will be creating a private install under my user&#39;s home directory. The .rpm files require a user with the ability to install them (such as &amp;quot;root&amp;quot;) and use directories such as &amp;quot;/usr/lib&amp;quot; and &amp;quot;/usr/bin&amp;quot;. I want to keep this install as simple as possible and the .zip files work well for this.&lt;/p&gt;  &lt;p&gt;From the download links above, you should download the following components to your development machine. I downloaded them to my home directory.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Instant Client Package – Basic Lite: instantclient-basiclite-linux32-11.1.0.7.zip &lt;/li&gt;    &lt;li&gt;Instant Client Package - SDK: instantclient-sdk-linux32-11.1.0.7.zip &lt;/li&gt;    &lt;li&gt;Instant Client Package - SQL*Plus: instantclient-sqlplus-linux32-11.1.0.7.zip&amp;#160; (optional, but I always install it) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;NOTE: I am using the &amp;quot;Basic Lite&amp;quot; version of the main Instant Client packages. This is a smaller download and meets my needs; however, if you require character set or language support not provided by the &amp;quot;Basic Lite&amp;quot; version of Instant Client you should use the &amp;quot;basic&amp;quot; version instead. See the Instant Client home page (link above) for additional information.&lt;/p&gt;  &lt;h3&gt;Install the Instant Client Packages&lt;/h3&gt;  &lt;p&gt;Installing the Instant Client packages provided as .zip files is simply a matter of unzipping them – not much to go wrong here! I unzipped each of them (3 total) in my user&#39;s home directory on &amp;quot;gerrard&amp;quot;. A new directory (instantclient_11_1) will be created and all the necessary files/directories will be under this single directory. This machine has no other Oracle software installed. Unzipping the files should result in the following:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;[markwill@gerrard ~/instantclient_11_1]&amp;gt; find .      &lt;br /&gt;.       &lt;br /&gt;./libsqlplusic.so       &lt;br /&gt;./libclntsh.so.11.1       &lt;br /&gt;./ojdbc6.jar       &lt;br /&gt;./sqlplus       &lt;br /&gt;./adrci       &lt;br /&gt;./libnnz11.so       &lt;br /&gt;./SQLPLUS_README       &lt;br /&gt;./libociicus.so       &lt;br /&gt;./ojdbc5.jar       &lt;br /&gt;./sdk       &lt;br /&gt;./sdk/demo       &lt;br /&gt;./sdk/demo/occiobj.cpp       &lt;br /&gt;./sdk/demo/occidemo.sql       &lt;br /&gt;./sdk/demo/occiobj.typ       &lt;br /&gt;./sdk/demo/occidemod.sql       &lt;br /&gt;./sdk/demo/demo.mk       &lt;br /&gt;./sdk/demo/occidml.cpp       &lt;br /&gt;./sdk/demo/cdemo81.c       &lt;br /&gt;./sdk/SDK_README       &lt;br /&gt;./sdk/ott       &lt;br /&gt;./sdk/ottclasses.zip       &lt;br /&gt;./sdk/include       &lt;br /&gt;./sdk/include/orid.h       &lt;br /&gt;./sdk/include/occiAQ.h       &lt;br /&gt;./sdk/include/oratypes.h       &lt;br /&gt;./sdk/include/nzerror.h       &lt;br /&gt;./sdk/include/oci1.h       &lt;br /&gt;./sdk/include/ocikpr.h       &lt;br /&gt;./sdk/include/ocidef.h       &lt;br /&gt;./sdk/include/oci.h       &lt;br /&gt;./sdk/include/ort.h       &lt;br /&gt;./sdk/include/ocixmldb.h       &lt;br /&gt;./sdk/include/ocidfn.h       &lt;br /&gt;./sdk/include/odci.h       &lt;br /&gt;./sdk/include/ori.h       &lt;br /&gt;./sdk/include/occiCommon.h       &lt;br /&gt;./sdk/include/occi.h       &lt;br /&gt;./sdk/include/ociapr.h       &lt;br /&gt;./sdk/include/occiObjects.h       &lt;br /&gt;./sdk/include/occiControl.h       &lt;br /&gt;./sdk/include/xa.h       &lt;br /&gt;./sdk/include/ocidem.h       &lt;br /&gt;./sdk/include/oci8dp.h       &lt;br /&gt;./sdk/include/ociextp.h       &lt;br /&gt;./sdk/include/occiData.h       &lt;br /&gt;./sdk/include/ociap.h       &lt;br /&gt;./sdk/include/nzt.h       &lt;br /&gt;./sdk/include/orl.h       &lt;br /&gt;./sdk/include/oro.h       &lt;br /&gt;./libocci.so.11.1       &lt;br /&gt;./libocijdbc11.so       &lt;br /&gt;./genezi       &lt;br /&gt;./BASIC_LITE_README       &lt;br /&gt;./libsqlplus.so       &lt;br /&gt;./glogin.sql       &lt;br /&gt;[markwill@gerrard ~/instantclient_11_1]&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;   &lt;br /&gt;Create Links&lt;/h3&gt;  &lt;p&gt;To ensure proper operation of SQL*Plus and linking executables, two links should be created in the &amp;quot;instantclient_11_1&amp;quot; directory. The first is the Oracle Client Shared Library and the second is the OCCI Library:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;ln -s ./libclntsh.so.11.1 ./libclntsh.so      &lt;br /&gt;ln -s ./libocci.so.11.1&amp;#160; ./libocci.so&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;After creating the links you should see the following when performing an &amp;quot;ls&amp;quot; on them:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;[markwill@gerrard ~/instantclient_11_1]&amp;gt; ls -l libclntsh.so      &lt;br /&gt;lrwxrwxrwx&amp;#160; 1 markwill markwill 19 Aug 15 19:17 libclntsh.so -&amp;gt; ./libclntsh.so.11.1       &lt;br /&gt;      &lt;br /&gt;[markwill@gerrard ~/instantclient_11_1]&amp;gt; ls -l libocci.so       &lt;br /&gt;lrwxrwxrwx&amp;#160; 1 markwill markwill 17 Aug 15 19:17 libocci.so -&amp;gt; ./libocci.so.11.1&lt;/font&gt;     &lt;br /&gt;    &lt;br /&gt;&lt;/p&gt;  &lt;h3&gt;Configure The Environment&lt;/h3&gt;  &lt;p&gt;To facilitate easily using the new installation I create a file I can source to set my environment correctly. I use the csh (well, tcsh really) as my primary shell and I created a file called &amp;quot;oic11.csh&amp;quot; in my home directory to setup the environment for me:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;[markwill@gerrard ~]&amp;gt; cat oic11.csh      &lt;br /&gt;#       &lt;br /&gt;setenv ORACLE_BASE /home/markwill       &lt;br /&gt;setenv ORACLE_HOME ${ORACLE_BASE}/instantclient_11_1       &lt;br /&gt;setenv LD_LIBRARY_PATH ${ORACLE_HOME}       &lt;br /&gt;set path = (${ORACLE_HOME} /usr/local/bin /bin /usr/bin /usr/X11R6/bin ~/bin)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;If you are using the bash shell, you may find something like the following helpful:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;[markwill@gerrard ~]&amp;gt; cat oic11.env      &lt;br /&gt;export ORACLE_BASE=/home/markwill       &lt;br /&gt;export ORACLE_HOME=$ORACLE_BASE/instantclient_11_1       &lt;br /&gt;export LD_LIBRARY_PATH=$ORACLE_HOME       &lt;br /&gt;export PATH=$ORACLE_HOME:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:~/bin&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;I can then set my environment to use the new install as follows (in csh):&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;[markwill@gerrard ~]&amp;gt; source ./oic11.csh&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This could be done as follows for bash:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@gerrard ~]&amp;gt; . ./oic11.env&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;Create a Simple Test Project&lt;/h3&gt;  &lt;p&gt;All the setup work is now complete and the environment is configured! If needed, you can use the following (very!) basic application as a simple test to verify things are working as expected. Again, this is a simple example only to verify things are setup correctly. It is not intended to be a complete template for &amp;quot;proper&amp;quot; code development, etc. Be sure to set the environment correctly!&lt;/p&gt;  &lt;p&gt;I created a &amp;quot;Projects&amp;quot; directory under my home directory and then a directory called &amp;quot;Employees&amp;quot; under the &amp;quot;Projects&amp;quot; directory. I then used VIM to create the Employees.h and Employees.cpp files.&lt;/p&gt;  &lt;p&gt;Here&#39;s the content of the Employees.h file on my system:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;/*      &lt;br /&gt; * A simple OCCI test application       &lt;br /&gt; * This file contains the Employees class declaration       &lt;br /&gt; */ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;#include &amp;lt;occi.h&amp;gt;      &lt;br /&gt;#include &amp;lt;iostream&amp;gt;       &lt;br /&gt;#include &amp;lt;iomanip&amp;gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;using namespace oracle::occi;      &lt;br /&gt;using namespace std; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;class Employees {      &lt;br /&gt;public:       &lt;br /&gt;&amp;#160; Employees();       &lt;br /&gt;&amp;#160; virtual ~Employees(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; void List(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;private:      &lt;br /&gt;&amp;#160; Environment *env;       &lt;br /&gt;&amp;#160; Connection&amp;#160; *con; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; string user;      &lt;br /&gt;&amp;#160; string passwd;       &lt;br /&gt;&amp;#160; string db;       &lt;br /&gt;};&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Here&#39;s the content of the Employees.cpp file on my system:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;/*      &lt;br /&gt; * A simple OCCI test application       &lt;br /&gt; * This file contains the Employees class implementation       &lt;br /&gt; */ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;#include &amp;quot;Employees.h&amp;quot; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;using namespace std;      &lt;br /&gt;using namespace oracle::occi; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;int main (void)      &lt;br /&gt;{       &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160;&amp;#160; * create an instance of the Employees class,       &lt;br /&gt;&amp;#160;&amp;#160; * invoke the List member, delete the instance,       &lt;br /&gt;&amp;#160;&amp;#160; * and prompt to continue...       &lt;br /&gt;&amp;#160;&amp;#160; */ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; Employees *pEmployees = new Employees(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; pEmployees-&amp;gt;List(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; delete pEmployees; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; cout &amp;lt;&amp;lt; &amp;quot;ENTER to continue...&amp;quot;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; cin.get(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; return 0;      &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;Employees::Employees()      &lt;br /&gt;{       &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160;&amp;#160; * connect to the test database as the HR       &lt;br /&gt;&amp;#160;&amp;#160; * sample user and use the EZCONNECT method       &lt;br /&gt;&amp;#160;&amp;#160; * of specifying the connect string. Be sure       &lt;br /&gt;&amp;#160;&amp;#160; * to adjust for your environment! The format       &lt;br /&gt;&amp;#160;&amp;#160; * of the string is host:port/service_name&lt;/font&gt;&lt;font face=&quot;Courier New&quot;&gt;      &lt;br /&gt;&amp;#160;&amp;#160; */ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; user = &amp;quot;hr&amp;quot;;      &lt;br /&gt;&amp;#160; passwd = &amp;quot;hr&amp;quot;;       &lt;br /&gt;&amp;#160; db = &amp;quot;oel01:1521/OEL11GR1.SAND&amp;quot;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; env = Environment::createEnvironment(Environment::DEFAULT); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; try      &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; con = env-&amp;gt;createConnection(user, passwd, db);       &lt;br /&gt;&amp;#160; }       &lt;br /&gt;&amp;#160; catch (SQLException&amp;amp; ex)       &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; ex.getMessage(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; exit(EXIT_FAILURE);      &lt;br /&gt;&amp;#160; }       &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;Employees::~Employees()      &lt;br /&gt;{       &lt;br /&gt;&amp;#160; env-&amp;gt;terminateConnection (con); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; Environment::terminateEnvironment (env);      &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;void Employees::List()      &lt;br /&gt;{       &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160;&amp;#160; * simple test method to select data from       &lt;br /&gt;&amp;#160;&amp;#160; * the employees table and display the results       &lt;br /&gt;&amp;#160;&amp;#160; */ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; Statement *stmt = NULL;      &lt;br /&gt;&amp;#160; ResultSet *rs = NULL;       &lt;br /&gt;&amp;#160; string sql = &amp;quot;select employee_id, first_name, last_name &amp;quot; \       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;from employees order by last_name, first_name&amp;quot;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; try      &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; stmt = con-&amp;gt;createStatement(sql);       &lt;br /&gt;&amp;#160; }       &lt;br /&gt;&amp;#160; catch (SQLException&amp;amp; ex)       &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; ex.getMessage();       &lt;br /&gt;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; if (stmt)      &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; try       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; stmt-&amp;gt;setPrefetchRowCount(32); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; rs = stmt-&amp;gt;executeQuery();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; catch (SQLException&amp;amp; ex)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; ex.getMessage();       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; if (rs)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; setw(8) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;ID&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(22) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;FIRST NAME&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(27) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;LAST NAME&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; endl;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; setw(8) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;======&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(22) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;====================&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(27) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;=========================&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; endl; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; while (rs-&amp;gt;next()) {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; setw(8) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; rs-&amp;gt;getString(1)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(22) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; (rs-&amp;gt;isNull(2) ? &amp;quot;n/a&amp;quot; : rs-&amp;gt;getString(2))       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(27) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; rs-&amp;gt;getString(3)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; endl;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; endl; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; stmt-&amp;gt;closeResultSet(rs);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; con-&amp;gt;terminateStatement(stmt);      &lt;br /&gt;&amp;#160; }       &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;To build the simple test I created a simplistic Makefile:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@gerrard Employees]&amp;gt; cat Makefile      &lt;br /&gt;Employees: Employees.cpp       &lt;br /&gt;&amp;#160; g++ -o Employees Employees.cpp \       &lt;br /&gt;&amp;#160; -I$(ORACLE_HOME)/sdk/include \       &lt;br /&gt;&amp;#160; -L$(ORACLE_HOME) -lclntsh -locci &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;debug: Employees.cpp      &lt;br /&gt;&amp;#160; g++ -ggdb3 -o Employees Employees.cpp \       &lt;br /&gt;&amp;#160; -I$(ORACLE_HOME)/sdk/include \       &lt;br /&gt;&amp;#160; -L$(ORACLE_HOME) -lclntsh -locci &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;clean:      &lt;br /&gt;&amp;#160; rm -f Employees&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;NOTE: The indented lines are tabs and not spaces in the Makefile&lt;/p&gt;  &lt;p&gt;Whilst certainly not destined to win any awards for Makefile creativity it suffices for the purpose at hand.&lt;/p&gt;  &lt;p&gt;I then built the application in debug mode by typing &amp;quot;make debug&amp;quot;.&lt;/p&gt;  &lt;p&gt;Executing the sample should result in output as follows:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[markwill@gerrard Employees]&amp;gt; ./Employees&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;ID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; FIRST NAME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; LAST NAME      &lt;br /&gt;======&amp;#160; ====================&amp;#160; =========================       &lt;br /&gt;174&amp;#160;&amp;#160;&amp;#160;&amp;#160; Ellen&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Abel       &lt;br /&gt;166&amp;#160;&amp;#160;&amp;#160;&amp;#160; Sundar&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Ande       &lt;br /&gt;130&amp;#160;&amp;#160;&amp;#160;&amp;#160; Mozhe&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Atkinson       &lt;br /&gt;105&amp;#160;&amp;#160;&amp;#160;&amp;#160; David&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Austin       &lt;br /&gt;204&amp;#160;&amp;#160;&amp;#160;&amp;#160; Hermann&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Baer       &lt;br /&gt;116&amp;#160;&amp;#160;&amp;#160;&amp;#160; Shelli&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Baida       &lt;br /&gt;167&amp;#160;&amp;#160;&amp;#160;&amp;#160; Amit&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Banda       &lt;br /&gt;172&amp;#160;&amp;#160;&amp;#160;&amp;#160; Elizabeth&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Bates&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[ snip ]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;120&amp;#160;&amp;#160;&amp;#160;&amp;#160; Matthew&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Weiss      &lt;br /&gt;200&amp;#160;&amp;#160;&amp;#160;&amp;#160; Jennifer&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Whalen       &lt;br /&gt;149&amp;#160;&amp;#160;&amp;#160;&amp;#160; Eleni&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Zlotkey &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;ENTER to continue...&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;If you are new to using OCCI on Linux, perhaps the above will be helpful in getting started!&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/1670990589098232647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/1670990589098232647'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/08/getting-started-with-occi-linux-version.html' title='Getting Started with OCCI (Linux Version)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-5971878967907142081</id><published>2009-08-14T16:53:00.001+00:00</published><updated>2009-08-15T03:18:01.435+00:00</updated><title type='text'>ODP.NET, VB, and &amp;quot;Conversion from type &amp;#39;OracleDecimal&amp;#39; to type &amp;#39;Integer&amp;#39; is not valid.&amp;quot;</title><content type='html'>&lt;p&gt;It starts innocently enough: you have a PL/SQL procedure or function that returns a number (either as an OUT parameter or a return value respectively) to your VB client application. You know for a fact that the returned value will be less than the possible maximum value for the CLR type Int32 (represented as Integer in your VB code). It&#39;s dead easy and nothing can go wrong here, right? Except that from the title of this post you already know something is going to go unexpectedly. But let&#39;s not get too far ahead.&lt;/p&gt;  &lt;p&gt;In order to understand what may (or may not) go wrong here, let&#39;s create a PL/SQL function that is guaranteed to return a valid Int32 value:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;create or replace function getone return number      &lt;br /&gt;as       &lt;br /&gt;begin       &lt;br /&gt;&amp;#160; return 1;       &lt;br /&gt;end;       &lt;br /&gt;/&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This function does nothing but return the value &amp;quot;1&amp;quot; (as a number) to the caller and that number is clearly an acceptable Int32 value – there&#39;s no trickery here.&lt;/p&gt;  &lt;p&gt;We can use trusty old SQL*Plus to verify that it does what it says it does:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;SQL&amp;gt; select getone from dual; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; GETONE      &lt;br /&gt;----------       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; 1 &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;1 row selected. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;SQL&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;It sure does return the expected value, so let&#39;s create a simple VB project to test this out. I&#39;m using ODP.NET version 10.2.0.4 for this experiment and here&#39;s the first version of the VB code:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier n&quot;&gt;Imports Oracle.DataAccess.Client      &lt;br /&gt;Imports Oracle.DataAccess.Types &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier n&quot;&gt;Module Module1      &lt;br /&gt;&amp;#160; Sub Main()       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &#39; change connection string for your environment       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Dim constr As String = &amp;quot;User Id=hr;&amp;quot; &amp;amp; _       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;Password=hr;&amp;quot; &amp;amp; _       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;Data Source=oel11gr1;&amp;quot; &amp;amp; _       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;Enlist=false;&amp;quot; &amp;amp; _       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;Pooling=false&amp;quot; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier n&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &#39; create and open connection      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Dim con As OracleConnection = New OracleConnection(constr)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; con.Open() &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier n&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &#39; create command and setup to call test function      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Dim cmd As OracleCommand = con.CreateCommand()       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cmd.CommandType = CommandType.StoredProcedure       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cmd.CommandText = &amp;quot;getone&amp;quot; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier n&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &#39; create parameter for the test function return value      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Dim retval As OracleParameter = New OracleParameter()       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; retval.Direction = ParameterDirection.ReturnValue       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; retval.OracleDbType = OracleDbType.Int32 &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier n&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &#39; add the parameter to the parameters collection      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cmd.Parameters.Add(retval) &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier n&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &#39; execute the function      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cmd.ExecuteNonQuery() &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier n&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &#39; get the return value in a local variable      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Dim my_one As Integer = retval.Value &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier n&quot;&gt;&amp;#160;&amp;#160;&amp;#160; &#39; basic cleanup      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; retval.Dispose()       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cmd.Dispose()       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; con.Dispose()       &lt;br /&gt;&amp;#160; End Sub       &lt;br /&gt;End Module&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;NOTE: I added a reference to the ODP.NET assembly to the project.&lt;/p&gt;  &lt;p&gt;After entering the above code I built the project and got the all-important &amp;quot;success&amp;quot; message:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[ snip ]      &lt;br /&gt;ConversionTest -&amp;gt; C:\My Projects\Test\VB\ConversionTest\bin\Debug\ConversionTest.exe       &lt;br /&gt;========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;So, let&#39;s go ahead and run this in debug mode from the IDE and see what happens…&lt;/p&gt;  &lt;p&gt;Oops. It stops on the &amp;quot;Dim my_one As Integer = retval.Value&amp;quot; source line and pops up a dialog indicating that &amp;quot;System.InvalidCastException was unhandled&amp;quot;. Digging a bit deeper we see &amp;quot;Conversion from type &#39;OracleDecimal&#39; to type &#39;Integer&#39; is not valid.&amp;quot;&lt;/p&gt;  &lt;p&gt;What? The code compiled with no problem, so what does this mean? Quickly looking at the code again we see that we declared the parameter as &amp;quot;OracleDbType.Int32&amp;quot; which should be able to handle the function return value with no issues, and we also see &amp;quot;Integer&amp;quot; which is the VB flavor of Int32! But why are we seeing &amp;quot;OracleDecimal&amp;quot; in the output and why is that being converted to Integer? We didn&#39;t declare an OracleDecimal in our code.&lt;/p&gt;  &lt;p&gt;One thing we might try is going to the project properties, clicking the Compile tab, and setting &amp;quot;Option strict:&amp;quot; to &amp;quot;On&amp;quot;. OK, done. Now, let&#39;s recompile. Hmm, now the project does not compile due to the error: Option Strict On disallows implicit conversions from &#39;Object&#39; to &#39;Integer&#39;.&lt;/p&gt;  &lt;p&gt;Yuck. There was an implicit conversion that wasn&#39;t reported during the first compile due to the default of &amp;quot;Option strict&amp;quot; being &amp;quot;Off&amp;quot;. OK, so now we have determined that there is a conversion problem happening, but that doesn&#39;t really explain &lt;strong&gt;why&lt;/strong&gt;. For that we can consult the ODP.NET documentation and in particular the section that discusses &lt;a href=&quot;http://download.oracle.com/docs/html/B28089_01/featOraCommand.htm#i1007242&quot; target=&quot;_blank&quot;&gt;Parameter Binding&lt;/a&gt;. In summary, that part of the documentation details how setting the OracleDbType or the DbType property of an OracleParameter object determines the data type of the output parameter. As stated in the documentation, &amp;quot;ODP.NET allows applications to obtain an output parameter as either a .NET Framework type or an ODP.NET type.&amp;quot;&lt;/p&gt;  &lt;p&gt;Ahhh, so we got an OracleDecimal as the return value because we specified OracleDbType.Int32 as the parameter type. Since we want an Int32 (or Integer) as the return value we can change the code to set the DbType instead of the OracleDbType:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;retval.DbType = DbType.Int32&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Now recompile and everything will work great. Except that you may get the following error: Option Strict On disallows implicit conversions from &#39;Object&#39; to &#39;Integer&#39;.&lt;/p&gt;  &lt;p&gt;If &amp;quot;Option strict&amp;quot; is left &amp;quot;On&amp;quot; you will receive the above message. This is because the OracleParameter.Value is returned as an Object. An easy way out is to set &amp;quot;Option strict&amp;quot; back to &amp;quot;Off&amp;quot; and the implicit conversion will be done behind the scenes and the code will work as expected albeit because of a hidden conversion. To take the explicit route you can change the declaration of &amp;quot;my_one&amp;quot; as follows:&lt;/p&gt;  &lt;p&gt;Dim my_one As Integer = DirectCast(retval.Value, Int32)&lt;/p&gt;  &lt;p&gt;Now you are getting the value back as an Int32/Integer (wrapped in an object) and explicitly (rather than implicitly) extracting the value via DirectCast as an Int32/Integer. With the implicit conversion the compiler will inject a call to a conversion function into the code and with the DirectCast method an &amp;quot;unbox&amp;quot; operation will take place.&lt;/p&gt;  &lt;p&gt;Incidentally, the same sort of thing would need to happen with C#; however, the compiler would warn you of this during the initial compile run since it doesn&#39;t do the implicit conversion that VB would try if &amp;quot;Option strict&amp;quot; is &amp;quot;Off&amp;quot;.&lt;/p&gt;  &lt;p&gt;If you are having conversion problems in your code with &amp;quot;output&amp;quot; or &amp;quot;return values&amp;quot; keep in mind that setting OracleDbType vs. DbType will determine whether a .NET Framework type or an Oracle provider type is returned. Also, the current ODP.NET Beta (11.1.7.10) exposes a new property for the OracleParameter class: OracleDbTypeEx&amp;#160; This property allows you to bind values using the OracleDbType but will return values as .NET types.&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/5971878967907142081'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/5971878967907142081'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/08/odpnet-vb-and-from-type-to-type-is-not.html' title='ODP.NET, VB, and &amp;quot;Conversion from type &amp;#39;OracleDecimal&amp;#39; to type &amp;#39;Integer&amp;#39; is not valid.&amp;quot;'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-3094187844286194170</id><published>2009-07-28T22:43:00.002+00:00</published><updated>2009-07-28T22:45:58.173+00:00</updated><title type='text'>Empezando con OCCI</title><content type='html'>&lt;span xmlns=&#39;&#39;&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;font-family:Trebuchet MS; font-size:12pt&#39;&gt;&lt;span style=&#39;color:black&#39;&gt;Luis Neri was kind enough to translate my &quot;&lt;a href=&#39;http://oradim.blogspot.com/2009/07/getting-started-with-occi-windows.html&#39;/&gt;&lt;/span&gt;Getting Started with OCCI (Windows Version)&lt;/a&gt;&lt;span style=&#39;color:black&#39;&gt;&quot; post into Spanish. Below is his translation of the original post. Thanks very much to Luis for this. However, please note that I do not speak Spanish, so I won&#39;t be able to respond to any comments in that language.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;- Mark&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;La Oracle C++ Call Interface, también conocida como OCCI, es una API construida sobre otras API&#39;s de bajo nivel de Oracle. Uno de los objetivos de OCCI es ofrecer a los programadores de C++ una forma de acceso fácil a las bases de datos de Oracle en una forma similar a la que tienen los programadores de Java con &lt;em&gt;&quot;Java Database Connectivity (JDBC) &quot;&lt;/em&gt;. Este documento trata de dar una vista rápida para empezar con esta tecnología, la cual puede ser incorporada a los desarrollos y aplicaciones GIS del SIRAN; si se desea, existe más información en la documentación en línea de Oracle. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;a title=&#39;http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28390/toc.htm&#39; href=&#39;http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28390/toc.htm&#39;&gt;&lt;span style=&#39;color:#de7008; font-family:Trebuchet MS; font-size:12pt; text-decoration:underline&#39;&gt;http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28390/toc.htm&lt;/span&gt;&lt;/a&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;&lt;br /&gt;    &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Este  &lt;em&gt;&quot;Empezando con OCCI&quot;&lt;/em&gt; tiene el objeto de dar un método para la puesta del ambiente el cual usa OCCI en los desarrollos con C++ bajo Windows para acceder  a las bases de datos de Oracle. &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:13pt&#39;&gt;&lt;strong&gt;El ambiente &lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;El ambiente en que se realizarón las pruebas para la puesta en funcionamiento de esta tecnología es el que abajo se detalla, tenga en cuenta que a este ambiente se pueden hacer pequeñas adaptaciones para que funcione en el suyo en particular.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Oracle Database Client: Oracle 11.0.2&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Oracle Database: Oracle 10.2&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Development Machine: Usser3 Geoware, Windows Vista Home Premium 32 bits &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Development IDE: Microsoft Visual C++ 2008 Profesional (Windows SDK also installed) SP1&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Oracle Client: Oracle Instant Client with OCCI &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:13pt&#39;&gt;&lt;strong&gt;Información importante&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Uno de las características más importantes al trabajar con OCCI es que se debe asegurar que todos los componentes del ambiente de desarrollo y de runtime están soportados en las combinaciones y tener las versiones correctas. Se hace un fuerte énfasis en esto, si usted no observa con atención esta recomendación seguramente encontrara problemas. Para lograr esto por favor encuentre las combinaciones correctas de las versiones en la pagina de Oracle Technology Network (OTN).&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;a target=&#39;_blank&#39; href=&#39;http://www.oracle.com/technology/tech/oci/occi/index.html&#39;&gt;&lt;span style=&#39;color:#de7008; font-family:Trebuchet MS; font-size:12pt; text-decoration:underline&#39;&gt;Oracle C++ Call Interface&lt;/span&gt;&lt;/a&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;a target=&#39;_blank&#39; href=&#39;http://www.oracle.com/technology/tech/oci/occi/occidownloads.html&#39;&gt;&lt;span style=&#39;color:#de7008; font-family:Trebuchet MS; font-size:12pt; text-decoration:underline&#39;&gt;OCCI Downloads page&lt;/span&gt;&lt;/a&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;a target=&#39;_blank&#39; href=&#39;http://www.oracle.com/technology/tech/oci/instantclient/index.html&#39;&gt;&lt;span style=&#39;color:#de7008; font-family:Trebuchet MS; font-size:12pt; text-decoration:underline&#39;&gt;Oracle Database Instant Client&lt;/span&gt;&lt;/a&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;a target=&#39;_blank&#39; href=&#39;http://www.oracle.com/technology/software/tech/oci/instantclient/index.html&#39;&gt;&lt;span style=&#39;color:#de7008; font-family:Trebuchet MS; font-size:12pt; text-decoration:underline&#39;&gt;Instant Client Downloads&lt;/span&gt;&lt;/a&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;a target=&#39;_blank&#39; href=&#39;http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html&#39;&gt;&lt;span style=&#39;color:#de7008; font-family:Trebuchet MS; font-size:12pt; text-decoration:underline&#39;&gt;Instant Client Downloads for Windows 32-bit&lt;/span&gt;&lt;/a&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:13pt&#39;&gt;&lt;strong&gt;Descargue los componentes correctos &lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Al momento de escribir este documento se encontraron para el ambiente descrito arriba los siguientes componentes &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;OCCI 11.1.0.6 (Visual C++9 (VS 2008)[Windows 32-bit]) &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Instant Client Version 11.1.0.6 &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Estos componentes se deben descargar en la máquina de desarrollo. Yo lo hice en el escritorio.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;OCCI 11.1.0.6 (Visual C++9 (VS 2008)[Windows 32-bit]) - occivc9win32_111060.zip &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Instant Client Package - Basic: instantclient-basic-win32-11.1.0.6.0.zip &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Instant Client Package - SDK: instantclient-sdk-win32-11.1.0.6.0.zip &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Instant Client Package - SQL*Plus: instantclient-sqlplus-win32-11.1.0.6.0.zip  (Opcional, pero se recomienda instalarlo) &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:13pt&#39;&gt;&lt;strong&gt;Instalación de Instant Client &lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;La instalación es tan simple como descomprimir el archivo, descomprímalo sobre C:\ , el resultado será una carpeta C:\instantclient_11_1 con las subcarpetas &quot;sdk&quot;, &quot;vc8&quot; y &quot;vc7&quot;, las cuales no serán utilizadas en el desarrollo sobre nuestro ambiente.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:13pt&#39;&gt;&lt;strong&gt;Instalación del OCCI Package&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Al igual que la instalación de Instant Client, los paquetes Occi pueden ser descomprimidos, pero sin embargo en vez de crear un directorio sobre c:\, los descomprimí sobre el escritorio, una vez descomprimidos,  me desvié un poco de lo quel archivo occivc9_111060_readme.txt dice, y realice los siguiente:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Cree un directorio  &quot;vc9&quot; dentro del directorio &quot;sdk&quot; como sigue:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;C:\instantclient_11_1\sdk\lib\msvc\vc9&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Cree una carpeta &quot;vc9&quot; dentro de &quot;instantclient_11_1&quot; como sigue:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;C:\instantclient_11_1\vc9&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Borre el archivo oraocci11.dll  y oraocci11.sym del directorio C:\instantclient_11_1. Estos archives no están hechos para construir o compilar con Visual Studio 2008 y como se dijo anteriormente es importante que se empaten las versiones.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Se extrajeron los archivos  OCCI en la carpeta del escritorio moviendo los dos archivos a la carpeta C:\instantclient_11_1\sdk\lib\msvc\vc9 antes creada:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;div style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;oraocci11.lib &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;oraocci11d.lib &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;de la misma carpeta en el escritorio, se mueven los siguientes archivos a la carpeta C:\instantclient_11_1\vc9 antes creada:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;oraocci11.dll &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;oraocci11.dll.manifest &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;oraocci11d.dll &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;oraocci11d.dll.manifest &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Finalmente se borra el archivo oraocci11.lib de: &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;C:\instantclient_11_1\sdk\lib\msvc &lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Otra vez este archivo no es compatible con nuestro ambiente.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Despues de realizar estos pasos, los archivos .lib deben estar bajo la carpeta C:\instantclient_11_1\sdk\lib\msvc y los archivos .dll y .manifest deben estar bajo la carpeta C:\instantclient_11_1. Esto pasos parecen  trabajo extra, pero resultan de una separación completa de las varias versiones OCCI y  lo hace más fácil y explicito.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;Para especificar que versión de librerías OCCI usar, añada estas carpetas al path del sistema. Estas dos carpetas deben estar al inicio del path:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:12pt&#39;&gt;C:\instantclient_11_1\vc9;C:\instantclient_11_1;{y lo demás del path…}&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:13pt&#39;&gt;&lt;strong&gt;Configuración de Visual Studio&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;El ambiente Windows ha sido configurado para el uso de los nuevos paquetes OCCI y Instan Client (los adecuados para nuestro ambiente), pero antes de empezar un desarrollo en Visual Studio, es necesario establecer algunas opciones. Sin estas opciones Visual Studio es incapaz de encontrar los archivos correctos y construir aplicaciones. Hay dos opciones las cuales necesitan ser especificadas:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;div style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;Include files – permite a Visual Studio encontrar los header files para OCCI &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;Library files – permite a Visual Studio encontrar los library files para OCCI &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;UsandoVisual C++ 2008, las rutas de  menu donde se especifican estas opciones son:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;div style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;Tools –&amp;gt; Options… expanda el nodo &quot;Projects and Solutions&quot;, seleccione &quot;VC++ Directories&quot;, bajo &quot;Show directories for:&quot; seleccione &quot;Include files&quot;, doble-click bajo la ultima entrada para abrir una nueva pantalla e introduzca la ruta &quot;C:\instantclient_11_1\sdk\include&quot; presione  enter &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;Bajo  &quot;Show directories for:&quot; seleccione&quot;Library files&quot;, doble-click bajo la ultima entrada para abrir una nueva pantalla e introduzca la ruta &quot;C:\instantclient_11_1\sdk\lib\msvc\vc9&quot; and presione enter &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&lt;div style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;Presione OK para guardar las opciones. &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS; font-size:13pt&#39;&gt;&lt;strong&gt;Cree un proyecto simple de prueba&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;Ya que se ha hecho todo la puesta en funcionamiento el ambiente está configurado!, Utilice la siguiente proyecto como prueba para verificar que todo funciona como se espera. Otra vez, este es un simple ejemplo para verificar que las cosas funcionan correctamente. No es un templeate de desarrollo.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;Cree en Visual C++ 2008 un proyecto  seleccionando  File –&amp;gt; New –&amp;gt; Project… del menú principal, seleccione &quot;Win32&quot; como tipo de proyecto, seleccione &quot;Win32 Console Application&quot;, dele un nombre al proyecto (yo usé prueba_occi), seleccione un carpeta  donde guardar deseleccione &quot;Create directory for solution&quot;, y presione OK.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;Presione Next en el Wizard, deseleccione Precompiled header, presione Empty project, y presione Finish.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;En el explorador de la solucion, click-izquierdo en Header Files, seleccione Add, seleccione New Item…&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;En Add New Item, seleccione Header File (.h), introduzca Employees.h (o cualquier otro nombre) en nombre y presione Add.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;/* &lt;br/&gt; * A simple OCCI test application &lt;br/&gt; * This file contains the Employees class declaration &lt;br/&gt; */ &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;#include &amp;lt;occi.h&amp;gt; &lt;br/&gt;#include &amp;lt;iostream&amp;gt; &lt;br/&gt;#include &amp;lt;iomanip&amp;gt; &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;using namespace oracle::occi; &lt;br/&gt;using namespace std; &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;class Employees { &lt;br/&gt;public: &lt;br/&gt;  Employees(); &lt;br/&gt;  virtual ~Employees(); &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  void List(); &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;private: &lt;br/&gt;  Environment *env; &lt;br/&gt;  Connection  *con; &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  string user; &lt;br/&gt;  string passwd; &lt;br/&gt;  string db; &lt;br/&gt;};&lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;en  Solution Explorer, click-izquierdo en Source Files, seleccione Add, seleccione New Item…&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;en Add New Item, seleccione C++ File (.cpp), introduzca Employees.cpp ((o cualquier otro nombre) en nombre y presione Add.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;Este es el contenido de mi archivo en el sistema:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;/* &lt;br/&gt; * A simple OCCI test application &lt;br/&gt; * This file contains the Employees class implementation &lt;br/&gt; */ &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;#include &quot;Employees.h&quot; &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;using namespace std; &lt;br/&gt;using namespace oracle::occi; &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;int main (void) &lt;br/&gt;{ &lt;br/&gt;  /* &lt;br/&gt;   * create an instance of the Employees class, &lt;br/&gt;   * invoke the List member, delete the instance, &lt;br/&gt;   * and prompt to continue... &lt;br/&gt;   */ &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  Employees *pEmployees = new Employees(); &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  pEmployees-&amp;gt;List(); &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  delete pEmployees; &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  cout &amp;lt;&amp;lt; &quot;ENTER to continue...&quot;; &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  cin.get(); &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  return 0; &lt;br/&gt;} &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;Employees::Employees() &lt;br/&gt;{ &lt;br/&gt;  /* &lt;br/&gt;   * connect to the test database as the HR &lt;br/&gt;   * sample user and use the EZCONNECT method &lt;br/&gt;   * of specifying the connect string. Be sure &lt;br/&gt;   * to adjust for your environment! The format &lt;br/&gt;   * of the string is host:port/service_name &lt;br/&gt;   */ &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  user = &quot;hr&quot;; &lt;br/&gt;  passwd = &quot;hr&quot;; &lt;br/&gt;  db = &quot;oel01:1521/OEL11GR1.SAND&quot;; &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  env = Environment::createEnvironment(Environment::DEFAULT); &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  try &lt;br/&gt;  { &lt;br/&gt;    con = env-&amp;gt;createConnection(user, passwd, db); &lt;br/&gt;  } &lt;br/&gt;  catch (SQLException&amp;amp; ex) &lt;br/&gt;  { &lt;br/&gt;    cout &amp;lt;&amp;lt; ex.getMessage(); &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;    exit(EXIT_FAILURE); &lt;br/&gt;  } &lt;br/&gt;} &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;Employees::~Employees() &lt;br/&gt;{ &lt;br/&gt;  env-&amp;gt;terminateConnection (con); &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  Environment::terminateEnvironment (env); &lt;br/&gt;} &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;void Employees::List() &lt;br/&gt;{ &lt;br/&gt;  /* &lt;br/&gt;   * simple test method to select data from &lt;br/&gt;   * the employees table and display the results &lt;br/&gt;   */ &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  Statement *stmt = NULL; &lt;br/&gt;  ResultSet *rs = NULL; &lt;br/&gt;  string sql = &quot;select employee_id, first_name, last_name &quot; \ &lt;br/&gt;               &quot;from employees order by last_name, first_name&quot;; &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  try &lt;br/&gt;  { &lt;br/&gt;    stmt = con-&amp;gt;createStatement(sql); &lt;br/&gt;  } &lt;br/&gt;  catch (SQLException&amp;amp; ex) &lt;br/&gt;  { &lt;br/&gt;    cout &amp;lt;&amp;lt; ex.getMessage(); &lt;br/&gt;  } &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;  if (stmt) &lt;br/&gt;  { &lt;br/&gt;    try &lt;br/&gt;    { &lt;br/&gt;      stmt-&amp;gt;setPrefetchRowCount(32); &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;      rs = stmt-&amp;gt;executeQuery(); &lt;br/&gt;    } &lt;br/&gt;    catch (SQLException&amp;amp; ex) &lt;br/&gt;    { &lt;br/&gt;      cout &amp;lt;&amp;lt; ex.getMessage(); &lt;br/&gt;    } &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;    if (rs) &lt;br/&gt;    { &lt;br/&gt;      cout &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; setw(8) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &quot;ID&quot; &lt;br/&gt;           &amp;lt;&amp;lt; setw(22) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &quot;FIRST NAME&quot; &lt;br/&gt;           &amp;lt;&amp;lt; setw(27) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &quot;LAST NAME&quot; &lt;br/&gt;           &amp;lt;&amp;lt; endl; &lt;br/&gt;      cout &amp;lt;&amp;lt; setw(8) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &quot;======&quot; &lt;br/&gt;           &amp;lt;&amp;lt; setw(22) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &quot;====================&quot; &lt;br/&gt;           &amp;lt;&amp;lt; setw(27) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &quot;=========================&quot; &lt;br/&gt;           &amp;lt;&amp;lt; endl; &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;      while (rs-&amp;gt;next()) { &lt;br/&gt;        cout &amp;lt;&amp;lt; setw(8) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; rs-&amp;gt;getString(1) &lt;br/&gt;             &amp;lt;&amp;lt; setw(22) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; (rs-&amp;gt;isNull(2) ? &quot;n/a&quot; : rs-&amp;gt;getString(2)) &lt;br/&gt;             &amp;lt;&amp;lt; setw(27) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; rs-&amp;gt;getString(3) &lt;br/&gt;             &amp;lt;&amp;lt; endl; &lt;br/&gt;      } &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;      cout &amp;lt;&amp;lt; endl; &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;      stmt-&amp;gt;closeResultSet(rs); &lt;br/&gt;    } &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;    con-&amp;gt;terminateStatement(stmt); &lt;br/&gt;  } &lt;br/&gt;}&lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt; &lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;Antes de construir el ejemplo (build), se necesita añadir la librería OCCI a la lista de entradas del linker:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;Seleccione Project –&amp;gt; prueba_occi Properties... del menu (Sustituya el nombre por el proio si es necesario)&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;Expanda el nodo Configuration Properties, expanda el nodo Linker, seleccione Input item, introduzca &quot;oraocci11d.lib&quot; para debug build o &quot;oraocci11.lib&quot; para release build.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&#39;text-align: justify&#39;&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;Seleccione Build –&amp;gt; Build Solution del menú para construir la solución. Si todo está puesto correctamente no debería haber errores. Si existen error busque donde pueden estar y corrija. La pantalla de ejecución seria como esta:&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;ID      FIRST NAME            LAST NAME &lt;br/&gt;======  ====================  ========================= &lt;br/&gt;174     Ellen                 Abel &lt;br/&gt;166     Sundar                Ande &lt;br/&gt;130     Mozhe                 Atkinson &lt;br/&gt;105     David                 Austin &lt;br/&gt;204     Hermann               Baer &lt;br/&gt;116     Shelli                Baida &lt;br/&gt;167     Amit                  Banda &lt;br/&gt;172     Elizabeth             Bates&lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;[ snip ]&lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;120     Matthew               Weiss &lt;br/&gt;200     Jennifer              Whalen &lt;br/&gt;149     Eleni                 Zlotkey &lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-size:12pt&#39;&gt;&lt;span style=&#39;font-family:Courier New&#39;&gt;ENTER to continue...&lt;/span&gt;&lt;span style=&#39;font-family:Trebuchet MS&#39;&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&#39;color:black; font-family:Trebuchet MS&#39;&gt;Si eres nuevo en el uso de OCCI sobre Windows con Visual Studio 2008, quizá el ejemplo de arriba puede ser de ayuda al inicio.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/3094187844286194170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/3094187844286194170'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/07/empezando-con-occi.html' title='Empezando con OCCI'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-5538698361884360474</id><published>2009-07-11T15:18:00.016+00:00</published><updated>2009-07-11T17:06:36.583+00:00</updated><title type='text'>SQL*Plus, EZCONNECT, Password Prompt, and ORA-12504</title><content type='html'>I use SQL*Plus a great deal and I find the &quot;&lt;a href=&quot;http://download.oracle.com/docs/cd/B28359_01/network.111/b28316/naming.htm#BABIHAAA&quot; target=&quot;_blank&quot;&gt;Easy Connect Naming Method&lt;/a&gt;&quot; a convenient option.&lt;br /&gt;&lt;br /&gt;Before you get any further in this post, let me be perfectly clear that this post &lt;b&gt;only&lt;/b&gt; addresses ORA-12504 in the context of using the &quot;Easy Connect Naming Method&quot; with SQL*Plus and password prompting. It does &lt;b&gt;not&lt;/b&gt; address ORA-12504 outside of this context. The documentation (see the link above) has several examples of using and configuring this method, so I won&#39;t go into them all here. This method is also known as &quot;EZCONNECT&quot; presumably because &quot;Z&quot; in the American dialect is pronounced like &quot;zee&quot; rather than &quot;zed&quot;.&lt;br /&gt;&lt;br /&gt;You are likely already familiar with the password prompting behavior of SQL*Plus. For example, when using a tnsnames.ora file alias to connect to a database, if the password is not specified, SQL*Plus will prompt you for it (i.e. &quot;Enter password:&quot;):&lt;br /&gt;&lt;p&gt;&lt;nobr&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;br /&gt;[oracle@liverpool&amp;nbsp;~]$&amp;nbsp;sqlplus&amp;nbsp;hr@orademo&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;SQL*Plus:&amp;nbsp;Release&amp;nbsp;11.1.0.7.0&amp;nbsp;-&amp;nbsp;Production&amp;nbsp;on&amp;nbsp;Sat&amp;nbsp;Jul&amp;nbsp;11&amp;nbsp;11:42:08&amp;nbsp;2009&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Copyright&amp;nbsp;(c)&amp;nbsp;1982,&amp;nbsp;2008,&amp;nbsp;Oracle.&amp;nbsp;&amp;nbsp;All&amp;nbsp;rights&amp;nbsp;reserved.&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Enter&amp;nbsp;password:&amp;nbsp;&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Connected&amp;nbsp;to:&lt;br /&gt;Oracle&amp;nbsp;Database&amp;nbsp;11g&amp;nbsp;Enterprise&amp;nbsp;Edition&amp;nbsp;Release&amp;nbsp;11.1.0.7.0&amp;nbsp;-&amp;nbsp;Production&lt;br /&gt;With&amp;nbsp;the&amp;nbsp;Partitioning,&amp;nbsp;OLAP,&amp;nbsp;Data&amp;nbsp;Mining&amp;nbsp;and&amp;nbsp;Real&amp;nbsp;Application&amp;nbsp;Testing&amp;nbsp;options&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;SQL&gt;&amp;nbsp;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;/nobr&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;Nice and easy.&lt;br /&gt;&lt;br /&gt;So, let&#39;s try the equivalent using EZCONNECT:&lt;br /&gt;&lt;p&gt;&lt;nobr&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;br /&gt;[oracle@liverpool&amp;nbsp;~]$&amp;nbsp;sqlplus&amp;nbsp;hr@liverpool:1521/DEMO&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;SQL*Plus:&amp;nbsp;Release&amp;nbsp;11.1.0.7.0&amp;nbsp;-&amp;nbsp;Production&amp;nbsp;on&amp;nbsp;Sat&amp;nbsp;Jul&amp;nbsp;11&amp;nbsp;11:43:20&amp;nbsp;2009&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Copyright&amp;nbsp;(c)&amp;nbsp;1982,&amp;nbsp;2008,&amp;nbsp;Oracle.&amp;nbsp;&amp;nbsp;All&amp;nbsp;rights&amp;nbsp;reserved.&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;ERROR:&lt;br /&gt;ORA-12504:&amp;nbsp;TNS:listener&amp;nbsp;was&amp;nbsp;not&amp;nbsp;given&amp;nbsp;the&amp;nbsp;SERVICE_NAME&amp;nbsp;in&amp;nbsp;CONNECT_DATA&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Enter&amp;nbsp;user-name:&amp;nbsp;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;/nobr&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;Hmm... well, that&#39;s interesting. Rather than getting prompted for the password we get an error (ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA) and then we get presented with the &quot;Enter user-name:&quot; prompt again. Funny that the error is saying the SERVICE_NAME was not specified, but it sure is there - DEMO in this case. This is giving us a clue though...&lt;br /&gt;&lt;br /&gt;OK, so let&#39;s go ahead and specify the password:&lt;br /&gt;&lt;p&gt;&lt;nobr&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;br /&gt;[oracle@liverpool&amp;nbsp;~]$&amp;nbsp;sqlplus&amp;nbsp;hr/hr@liverpool:1521/DEMO&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;SQL*Plus:&amp;nbsp;Release&amp;nbsp;11.1.0.7.0&amp;nbsp;-&amp;nbsp;Production&amp;nbsp;on&amp;nbsp;Sat&amp;nbsp;Jul&amp;nbsp;11&amp;nbsp;11:44:02&amp;nbsp;2009&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Copyright&amp;nbsp;(c)&amp;nbsp;1982,&amp;nbsp;2008,&amp;nbsp;Oracle.&amp;nbsp;&amp;nbsp;All&amp;nbsp;rights&amp;nbsp;reserved.&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Connected&amp;nbsp;to:&lt;br /&gt;Oracle&amp;nbsp;Database&amp;nbsp;11g&amp;nbsp;Enterprise&amp;nbsp;Edition&amp;nbsp;Release&amp;nbsp;11.1.0.7.0&amp;nbsp;-&amp;nbsp;Production&lt;br /&gt;With&amp;nbsp;the&amp;nbsp;Partitioning,&amp;nbsp;OLAP,&amp;nbsp;Data&amp;nbsp;Mining&amp;nbsp;and&amp;nbsp;Real&amp;nbsp;Application&amp;nbsp;Testing&amp;nbsp;options&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;SQL&gt;&amp;nbsp;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;/nobr&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;Much better, it works, but what if you (reasonably) don&#39;t want to specify the password on the command-line?&lt;br /&gt;&lt;br /&gt;Taking a look at the documentation (really - that stuff does come in handy!) for the &lt;a href=&quot;http://download.oracle.com/docs/cd/B28359_01/server.111/b31189/ch12015.htm#i2697450&quot; target=&quot;blank&quot;&gt;CONNECT&lt;/a&gt; SQL*Plus command we can see this:&lt;br /&gt;&lt;br /&gt;username[/password] [@connect_identifier]&lt;br /&gt;&lt;br /&gt;Pay particular attention that the &quot;/&quot; precedes the password. In the case of using EZCONNECT we have:&lt;br /&gt;&lt;br /&gt;sqlplus hr@liverpool:1521/DEMO&lt;br /&gt;&lt;br /&gt;So, in this case the &quot;/&quot; precedes the SERVICE_NAME and not the password. How should we tell SQL*Plus that the &quot;/&quot; is not preceding the password? We quote the connection string!&lt;br /&gt;&lt;p&gt;&lt;nobr&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;br /&gt;[oracle@liverpool&amp;nbsp;~]$&amp;nbsp;sqlplus&amp;nbsp;hr@\&quot;liverpool:1521/DEMO\&quot;&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;SQL*Plus:&amp;nbsp;Release&amp;nbsp;11.1.0.7.0&amp;nbsp;-&amp;nbsp;Production&amp;nbsp;on&amp;nbsp;Sat&amp;nbsp;Jul&amp;nbsp;11&amp;nbsp;11:45:43&amp;nbsp;2009&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Copyright&amp;nbsp;(c)&amp;nbsp;1982,&amp;nbsp;2008,&amp;nbsp;Oracle.&amp;nbsp;&amp;nbsp;All&amp;nbsp;rights&amp;nbsp;reserved.&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Enter&amp;nbsp;password:&amp;nbsp;&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Connected&amp;nbsp;to:&lt;br /&gt;Oracle&amp;nbsp;Database&amp;nbsp;11g&amp;nbsp;Enterprise&amp;nbsp;Edition&amp;nbsp;Release&amp;nbsp;11.1.0.7.0&amp;nbsp;-&amp;nbsp;Production&lt;br /&gt;With&amp;nbsp;the&amp;nbsp;Partitioning,&amp;nbsp;OLAP,&amp;nbsp;Data&amp;nbsp;Mining&amp;nbsp;and&amp;nbsp;Real&amp;nbsp;Application&amp;nbsp;Testing&amp;nbsp;options&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;SQL&gt;&amp;nbsp;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;/nobr&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;Now that&#39;s more like it! Notice that I used &quot;\&quot; (backslash) to escape the double-quote characters on the command-line (I&#39;m using the bash shell for this).&lt;br /&gt;&lt;br /&gt;If you are already in SQL*Plus you do not need to use the backslash to escape the double-quote characters:&lt;br /&gt;&lt;p&gt;&lt;nobr&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;br /&gt;[oracle@liverpool&amp;nbsp;~]$&amp;nbsp;sqlplus&amp;nbsp;/nolog&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;SQL*Plus:&amp;nbsp;Release&amp;nbsp;11.1.0.7.0&amp;nbsp;-&amp;nbsp;Production&amp;nbsp;on&amp;nbsp;Sat&amp;nbsp;Jul&amp;nbsp;11&amp;nbsp;11:46:31&amp;nbsp;2009&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Copyright&amp;nbsp;(c)&amp;nbsp;1982,&amp;nbsp;2008,&amp;nbsp;Oracle.&amp;nbsp;&amp;nbsp;All&amp;nbsp;rights&amp;nbsp;reserved.&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;SQL&gt;&amp;nbsp;connect&amp;nbsp;hr@&quot;liverpool:1521/DEMO&quot;&lt;br /&gt;Enter&amp;nbsp;password:&amp;nbsp;&lt;br /&gt;Connected.&lt;br /&gt;SQL&gt;&amp;nbsp;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;/nobr&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;This same technique can also be used for privileged connections:&lt;br /&gt;&lt;p&gt;&lt;nobr&gt;&lt;font face=&quot;Courier New&quot;&gt;&lt;br /&gt;[oracle@liverpool&amp;nbsp;~]$&amp;nbsp;sqlplus&amp;nbsp;sys@\&quot;liverpool:1521/DEMO\&quot;&amp;nbsp;as&amp;nbsp;sysdba&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;SQL*Plus:&amp;nbsp;Release&amp;nbsp;11.1.0.7.0&amp;nbsp;-&amp;nbsp;Production&amp;nbsp;on&amp;nbsp;Sat&amp;nbsp;Jul&amp;nbsp;11&amp;nbsp;11:47:23&amp;nbsp;2009&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Copyright&amp;nbsp;(c)&amp;nbsp;1982,&amp;nbsp;2008,&amp;nbsp;Oracle.&amp;nbsp;&amp;nbsp;All&amp;nbsp;rights&amp;nbsp;reserved.&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Enter&amp;nbsp;password:&amp;nbsp;&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;Connected&amp;nbsp;to:&lt;br /&gt;Oracle&amp;nbsp;Database&amp;nbsp;11g&amp;nbsp;Enterprise&amp;nbsp;Edition&amp;nbsp;Release&amp;nbsp;11.1.0.7.0&amp;nbsp;-&amp;nbsp;Production&lt;br /&gt;With&amp;nbsp;the&amp;nbsp;Partitioning,&amp;nbsp;OLAP,&amp;nbsp;Data&amp;nbsp;Mining&amp;nbsp;and&amp;nbsp;Real&amp;nbsp;Application&amp;nbsp;Testing&amp;nbsp;options&lt;br /&gt;&lt;br/&gt;&lt;br /&gt;SQL&gt;&amp;nbsp;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;/nobr&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;If you use SQL*Plus as much as I do, perhaps this will be a handy tip.</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/5538698361884360474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/5538698361884360474'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/07/sqlplus-ezconnect-password-prompt-and.html' title='SQL*Plus, EZCONNECT, Password Prompt, and ORA-12504'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-4448777685595550400</id><published>2009-07-07T03:46:00.001+00:00</published><updated>2009-07-07T03:49:30.580+00:00</updated><title type='text'>Getting Started with OCCI (Windows Version)</title><content type='html'>&lt;p&gt;The Oracle C++ Call Interface, also known as OCCI, is an application programming interface (API) built upon the Oracle Call Interface (OCI - another lower level API from Oracle). One of the goals of OCCI is to offer C++ programmers easy access to Oracle Database in a fashion similar to what Java Database Connectivity (JDBC) affords Java developers. If you would like to learn more about what OCCI is (and isn&#39;t), pay a visit to the OCCI documentation on Oracle Technology Network (OTN) here:&lt;/p&gt;  &lt;p&gt;&lt;a title=&quot;http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28390/toc.htm&quot; href=&quot;http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28390/toc.htm&quot;&gt;http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28390/toc.htm&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;My goal with this &amp;quot;Getting Started&amp;quot; post is to give you one method of setting up an environment in which you can use OCCI to develop C++ applications under Windows that access Oracle Database. I am not in any way covering all possible scenarios or delving deep into OCCI itself. Please note that the database itself can be on any supported host.&lt;/p&gt;  &lt;h3&gt;The Environment&lt;/h3&gt;  &lt;p&gt;Your environment is likely to differ from mine; however, it is important to be familiar with the various components in the environment used here so that you can make adaptations as necessary for your specific environment.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Oracle Database Server/Host: oel01 (Oracle Enterprise Linux 32-bit server) &lt;/li&gt;    &lt;li&gt;Oracle Database: SID value of OEL11GR1, Service Name value of OEL11GR1.SAND, version 11.1.0.7 &lt;/li&gt;    &lt;li&gt;Development Machine: Hostname of CHEPSTOW, Windows XP Professional 32-bit &lt;/li&gt;    &lt;li&gt;Development IDE: Microsoft Visual C++ 2008 Express Edition (Windows SDK also installed) &lt;/li&gt;    &lt;li&gt;Oracle Client: Oracle Instant Client with OCCI &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Important Information&lt;/h3&gt;  &lt;p&gt;One of the most crucial attributes of working with OCCI is that you &lt;em&gt;must&lt;/em&gt; ensure that &lt;em&gt;all&lt;/em&gt; of the components of the development environment &lt;em&gt;and&lt;/em&gt; the runtime environment are supported combinations and correct versions. I can not emphasize this enough. If you deviate from this, you will almost certainly find trouble! In order to find the correct combinations of products and versions, see the following links on OTN:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/tech/oci/occi/index.html&quot; target=&quot;_blank&quot;&gt;Oracle C++ Call Interface&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/tech/oci/occi/occidownloads.html&quot; target=&quot;_blank&quot;&gt;OCCI Downloads page&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/tech/oci/instantclient/index.html&quot; target=&quot;_blank&quot;&gt;Oracle Database Instant Client&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/software/tech/oci/instantclient/index.html&quot; target=&quot;_blank&quot;&gt;Instant Client Downloads&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html&quot; target=&quot;_blank&quot;&gt;Instant Client Downloads for Windows 32-bit&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Download the Correct Packages&lt;/h3&gt;  &lt;p&gt;At the time of this writing, the following are the component versions supported for the environment listed above:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;OCCI 11.1.0.6 (Visual C++9 (VS 2008)[Windows 32-bit]) &lt;/li&gt;    &lt;li&gt;Instant Client Version 11.1.0.6 &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;From the download links above, you should download the following components to your development machine. I downloaded them to the C:\Temp directory.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;OCCI 11.1.0.6 (Visual C++9 (VS 2008)[Windows 32-bit]) - occivc9win32_111060.zip &lt;/li&gt;    &lt;li&gt;Instant Client Package - Basic: instantclient-basic-win32-11.1.0.6.0.zip &lt;/li&gt;    &lt;li&gt;Instant Client Package - SDK: instantclient-sdk-win32-11.1.0.6.0.zip &lt;/li&gt;    &lt;li&gt;Instant Client Package - SQL*Plus: instantclient-sqlplus-win32-11.1.0.6.0.zip&amp;#160; (optional, but I always install it) &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Install the Instant Client Packages&lt;/h3&gt;  &lt;p&gt;Installing the Instant Client packages is simply a matter of unzipping them – not much to wrong here! I unzipped them all to the C:\ directory on Chepstow. This resulted in a new top-level directory - C:\instantclient_11_1 with &amp;quot;sdk&amp;quot;, &amp;quot;vc8&amp;quot;, and &amp;quot;vc7&amp;quot; directories underneath. The &amp;quot;vc8&amp;quot; and &amp;quot;vc7&amp;quot; directories should be ignored in the context of the environment created here.&lt;/p&gt;  &lt;h3&gt;Install the OCCI Package&lt;/h3&gt;  &lt;p&gt;Much like the Instant Client packages, the OCCI package should be unzipped; however, rather than unzipping it to the C:\ directory, I unzipped it to the C:\Temp directory. Once unzipped, review the occivc9_111060_readme.txt file for information; however, I deviate from the directories listed in the file.&lt;/p&gt;  &lt;p&gt;I create a &amp;quot;vc9&amp;quot; directory under the &amp;quot;sdk&amp;quot; directory as follows:&lt;/p&gt;  &lt;p&gt;C:\instantclient_11_1\sdk\lib\msvc\vc9&lt;/p&gt;  &lt;p&gt;I create a &amp;quot;vc9&amp;quot; directory under the &amp;quot;instantclient_11_1&amp;quot; directory as follows:&lt;/p&gt;  &lt;p&gt;C:\instantclient_11_1\vc9&lt;/p&gt;  &lt;p&gt;I delete the oraocci11.dll and oraocci11.sym files from the C:\instantclient_11_1 directory. These files are not built/linked with the runtime libraries used by Visual Studio 2008 and, as mentioned above, it is critical that component versions match!&lt;/p&gt;  &lt;p&gt;From the extracted OCCI files in the C:\Temp directory, move the following two files to the C:\instantclient_11_1\sdk\lib\msvc\vc9 directory previously created:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;oraocci11.lib &lt;/li&gt;    &lt;li&gt;oraocci11d.lib &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;From the extracted OCCI files in the C:\Temp directory, move the following four files to the C:\instantclient_11_1\vc9 directory previously created:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;oraocci11.dll &lt;/li&gt;    &lt;li&gt;oraocci11.dll.manifest &lt;/li&gt;    &lt;li&gt;oraocci11d.dll &lt;/li&gt;    &lt;li&gt;oraocci11d.dll.manifest &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Finally, delete the oraocci11.lib file from the C:\instantclient_11_1\sdk\lib\msvc directory. Again, this file is not compatible with the environment created here.&lt;/p&gt;  &lt;p&gt;After performing these steps, the .lib files should only be in directories under C:\instantclient_11_1\sdk\lib\msvc and the .dll and .manifest files should only be in directories under the C:\instantclient_11_1 directory. While this may seem like extra unneeded work, it results in complete separation of the various versions of the OCCI components making it easier (and explicit) which version is to be used.&lt;/p&gt;  &lt;p&gt;To specify which version of the OCCI libraries are used, add the directory to the system path. You also add the the Instant Client directory to the path. Both of these directories should be added to the beginning of the system path:&lt;/p&gt;  &lt;p&gt;C:\instantclient_11_1\vc9;C:\instantclient_11_1;{rest of path follows…}&lt;/p&gt;  &lt;h3&gt;Configure Visual Studio&lt;/h3&gt;  &lt;p&gt;The Windows environment has been configured to use the new OCCI and Instant Client packages but before you can begin developing in Visual Studio, you need to set a few options. Without these options Visual Studio will be unable to find the correct files and build your applications. There are two options that need to be specified:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Include files – allows Visual Studio to find the header files for OCCI &lt;/li&gt;    &lt;li&gt;Library files – allows Visual Studio to find the library files for OCCI &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Using Visual C++ 2008 Express Edition, the menu paths to specify these options are as follows:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Tools –&amp;gt; Options… Expand &amp;quot;Projects and Solutions&amp;quot; node, select &amp;quot;VC++ Directories&amp;quot;, under &amp;quot;Show directories for:&amp;quot; select &amp;quot;Include files&amp;quot;, double-click under the last entry to open a new box to enter a path, enter &amp;quot;C:\instantclient_11_1\sdk\include&amp;quot; and press enter &lt;/li&gt;    &lt;li&gt;Under &amp;quot;Show directories for:&amp;quot; select &amp;quot;Library files&amp;quot;, double-click under the last entry to open a new box to enter a path, enter &amp;quot;C:\instantclient_11_1\sdk\lib\msvc\vc9&amp;quot; and press enter &lt;/li&gt;    &lt;li&gt;Click OK to save the settings &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Create a Simple Test Project&lt;/h3&gt;  &lt;p&gt;All the setup work is now complete and the environment is configured! If needed, you can use the following (very!) basic application as a simple test to verify things are working as expected. Again, this is a simple example only to verify things are setup correctly. It is not intended to be a complete template for &amp;quot;proper&amp;quot; code development, etc.&lt;/p&gt;  &lt;p&gt;Create the Visual C++ 2008 Express Edition project by selecting File –&amp;gt; New –&amp;gt; Project… from the main menu, select &amp;quot;Win32&amp;quot; as the project type, select &amp;quot;Win32 Console Application&amp;quot;, give the project a name (I used OCCITest), select a location (I used C:\Projects), I unchecked &amp;quot;Create directory for solution&amp;quot;, and then click OK.&lt;/p&gt;  &lt;p&gt;Click Next in the Application Wizard, uncheck Precompiled header, click Empty project, and click Finish.&lt;/p&gt;  &lt;p&gt;In Solution Explorer, right-click Header Files, select Add, select New Item…&lt;/p&gt;  &lt;p&gt;In Add New Item, select Header File (.h), enter Employees.h (or any name you prefer) in Name, and click Add.&lt;/p&gt;  &lt;p&gt;Here&#39;s the content of the file on my system:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;/*      &lt;br /&gt; * A simple OCCI test application       &lt;br /&gt; * This file contains the Employees class declaration       &lt;br /&gt; */ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;#include &amp;lt;occi.h&amp;gt;      &lt;br /&gt;#include &amp;lt;iostream&amp;gt;       &lt;br /&gt;#include &amp;lt;iomanip&amp;gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;using namespace oracle::occi;      &lt;br /&gt;using namespace std; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;class Employees {      &lt;br /&gt;public:       &lt;br /&gt;&amp;#160; Employees();       &lt;br /&gt;&amp;#160; virtual ~Employees(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; void List(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;private:      &lt;br /&gt;&amp;#160; Environment *env;       &lt;br /&gt;&amp;#160; Connection&amp;#160; *con; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; string user;      &lt;br /&gt;&amp;#160; string passwd;       &lt;br /&gt;&amp;#160; string db;       &lt;br /&gt;};&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;In Solution Explorer, right-click Source Files, select Add, select New Item…&lt;/p&gt;  &lt;p&gt;In Add New Item, select C++ File (.cpp), enter Employees.cpp (or any name you prefer) in Name, and click Add.&lt;/p&gt;  &lt;p&gt;Here&#39;s the content of the file on my system:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;/*      &lt;br /&gt; * A simple OCCI test application       &lt;br /&gt; * This file contains the Employees class implementation       &lt;br /&gt; */ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;#include &amp;quot;Employees.h&amp;quot; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;using namespace std;      &lt;br /&gt;using namespace oracle::occi; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;int main (void)      &lt;br /&gt;{       &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160;&amp;#160; * create an instance of the Employees class,       &lt;br /&gt;&amp;#160;&amp;#160; * invoke the List member, delete the instance,       &lt;br /&gt;&amp;#160;&amp;#160; * and prompt to continue...       &lt;br /&gt;&amp;#160;&amp;#160; */ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; Employees *pEmployees = new Employees(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; pEmployees-&amp;gt;List(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; delete pEmployees; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; cout &amp;lt;&amp;lt; &amp;quot;ENTER to continue...&amp;quot;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; cin.get(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; return 0;      &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;Employees::Employees()      &lt;br /&gt;{       &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160;&amp;#160; * connect to the test database as the HR       &lt;br /&gt;&amp;#160;&amp;#160; * sample user and use the EZCONNECT method       &lt;br /&gt;&amp;#160;&amp;#160; * of specifying the connect string. Be sure       &lt;br /&gt;&amp;#160;&amp;#160; * to adjust for your environment! The format       &lt;br /&gt;&amp;#160;&amp;#160; * of the string is host:port/service_name&lt;/font&gt;&lt;font face=&quot;Courier New&quot;&gt;      &lt;br /&gt;&amp;#160;&amp;#160; */ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; user = &amp;quot;hr&amp;quot;;      &lt;br /&gt;&amp;#160; passwd = &amp;quot;hr&amp;quot;;       &lt;br /&gt;&amp;#160; db = &amp;quot;oel01:1521/OEL11GR1.SAND&amp;quot;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; env = Environment::createEnvironment(Environment::DEFAULT); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; try      &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; con = env-&amp;gt;createConnection(user, passwd, db);       &lt;br /&gt;&amp;#160; }       &lt;br /&gt;&amp;#160; catch (SQLException&amp;amp; ex)       &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; ex.getMessage(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; exit(EXIT_FAILURE);      &lt;br /&gt;&amp;#160; }       &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;Employees::~Employees()      &lt;br /&gt;{       &lt;br /&gt;&amp;#160; env-&amp;gt;terminateConnection (con); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; Environment::terminateEnvironment (env);      &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;void Employees::List()      &lt;br /&gt;{       &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160;&amp;#160; * simple test method to select data from       &lt;br /&gt;&amp;#160;&amp;#160; * the employees table and display the results       &lt;br /&gt;&amp;#160;&amp;#160; */ &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; Statement *stmt = NULL;      &lt;br /&gt;&amp;#160; ResultSet *rs = NULL;       &lt;br /&gt;&amp;#160; string sql = &amp;quot;select employee_id, first_name, last_name &amp;quot; \       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;from employees order by last_name, first_name&amp;quot;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; try      &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; stmt = con-&amp;gt;createStatement(sql);       &lt;br /&gt;&amp;#160; }       &lt;br /&gt;&amp;#160; catch (SQLException&amp;amp; ex)       &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; ex.getMessage();       &lt;br /&gt;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; if (stmt)      &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; try       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; stmt-&amp;gt;setPrefetchRowCount(32); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; rs = stmt-&amp;gt;executeQuery();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; catch (SQLException&amp;amp; ex)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; ex.getMessage();       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; if (rs)      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; endl &amp;lt;&amp;lt; setw(8) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;ID&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(22) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;FIRST NAME&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(27) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;LAST NAME&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; endl;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; setw(8) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;======&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(22) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;====================&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(27) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; &amp;quot;=========================&amp;quot;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; endl; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; while (rs-&amp;gt;next()) {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; setw(8) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; rs-&amp;gt;getString(1)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(22) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; (rs-&amp;gt;isNull(2) ? &amp;quot;n/a&amp;quot; : rs-&amp;gt;getString(2))       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; setw(27) &amp;lt;&amp;lt; left &amp;lt;&amp;lt; rs-&amp;gt;getString(3)       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&amp;lt; endl;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cout &amp;lt;&amp;lt; endl; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; stmt-&amp;gt;closeResultSet(rs);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; con-&amp;gt;terminateStatement(stmt);      &lt;br /&gt;&amp;#160; }       &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Before you can build the sample, you need to add the OCCI library to the input list for the linker:&lt;/p&gt;  &lt;p&gt;Select Project –&amp;gt; OCCITest Properties... from the menu (substitute your project name if different)&lt;/p&gt;  &lt;p&gt;Expand Configuration Properties node, expand Linker node, select Input item, enter &amp;quot;oraocci11d.lib&amp;quot; for a debug build or &amp;quot;oraocci11.lib&amp;quot; for a release build.&lt;/p&gt;  &lt;p&gt;Select Build –&amp;gt; Build Solution from the menu to build the solution. If everything is setup correctly, there should be no errors during the build. If you receive errors, investigate and correct them.&lt;/p&gt;  &lt;p&gt;Executing the sample should result in output as follows:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;ID&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; FIRST NAME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; LAST NAME      &lt;br /&gt;======&amp;#160; ====================&amp;#160; =========================       &lt;br /&gt;174&amp;#160;&amp;#160;&amp;#160;&amp;#160; Ellen&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Abel       &lt;br /&gt;166&amp;#160;&amp;#160;&amp;#160;&amp;#160; Sundar&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Ande       &lt;br /&gt;130&amp;#160;&amp;#160;&amp;#160;&amp;#160; Mozhe&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Atkinson       &lt;br /&gt;105&amp;#160;&amp;#160;&amp;#160;&amp;#160; David&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Austin       &lt;br /&gt;204&amp;#160;&amp;#160;&amp;#160;&amp;#160; Hermann&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Baer       &lt;br /&gt;116&amp;#160;&amp;#160;&amp;#160;&amp;#160; Shelli&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Baida       &lt;br /&gt;167&amp;#160;&amp;#160;&amp;#160;&amp;#160; Amit&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Banda       &lt;br /&gt;172&amp;#160;&amp;#160;&amp;#160;&amp;#160; Elizabeth&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Bates&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;[ snip ]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;120&amp;#160;&amp;#160;&amp;#160;&amp;#160; Matthew&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Weiss      &lt;br /&gt;200&amp;#160;&amp;#160;&amp;#160;&amp;#160; Jennifer&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Whalen       &lt;br /&gt;149&amp;#160;&amp;#160;&amp;#160;&amp;#160; Eleni&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Zlotkey &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;ENTER to continue...&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;If you are new to using OCCI on Windows with Visual Studio, perhaps the above will be helpful in getting started!&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/4448777685595550400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/4448777685595550400'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/07/getting-started-with-occi-windows.html' title='Getting Started with OCCI (Windows Version)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-4116721180500794626</id><published>2009-06-18T22:10:00.005+00:00</published><updated>2009-06-19T15:10:27.066+00:00</updated><title type='text'>Microsoft To Deprecate System.Data.OracleClient</title><content type='html'>I found the following to be an interesting announcement:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://blogs.msdn.com/adonet/archive/2009/06/15/system-data-oracleclient-update.aspx&quot; target=&quot;_blank&quot;&gt;System.Data.OracleClient Update&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It looks like Microsoft have decided to deprecate System.Data.OracleClient beginning with the .NET 4.0 release.&lt;br /&gt;&lt;br /&gt;Of course, I&#39;m more than a little biased when it comes to anything related to Oracle.&lt;br /&gt;&lt;br /&gt;For more information and to download ODP.NET, please see the &lt;a href=&quot;http://www.oracle.com/technology/tech/windows/odpnet/index.html&quot; target=&quot;_blank&quot;&gt;Oracle Data Provider for .NET&lt;/a&gt; center on Oracle Technology Network (OTN).</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/4116721180500794626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/4116721180500794626'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/06/microsoft-to-deprecate.html' title='Microsoft To Deprecate System.Data.OracleClient'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-1187435699725708153</id><published>2009-05-31T02:25:00.002+00:00</published><updated>2009-06-29T15:34:56.547+00:00</updated><title type='text'>Oracle Pro*C on Windows with Express Edition Products</title><content type='html'>&lt;p&gt;NOTE: I have edited the intro text here from the original source as a result of some discussions I&#39;ve had. These discussions are ongoing so I can&#39;t post the results as of yet. (3-June-2009 approximately 5:00 PM).&lt;/p&gt;  &lt;p&gt;I thought I would take an introductory look at using the &lt;a href=&quot;http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28427/toc.htm&quot; target=&quot;_blank&quot;&gt;Oracle Pro*C precompiler&lt;/a&gt; using Express Edition products. Here are the components I will use for this purpose (links valid at time of posting):&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Oracle Database 10g Express Edition (available &lt;a href=&quot;http://www.oracle.com/technology/software/products/database/index.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;) &lt;/li&gt;    &lt;li&gt;Oracle Enterprise Linux (available &lt;a href=&quot;http://edelivery.oracle.com/linux&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;) &lt;/li&gt;    &lt;li&gt;Oracle Instant Client 11.1.0.7 Packages for Microsoft Windows 32-bit (available &lt;a href=&quot;http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/winsoft.html&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;) &lt;/li&gt;    &lt;li&gt;&amp;#160;&amp;#160;&amp;#160; Instant Client Package – Basic &lt;/li&gt;    &lt;li&gt;&amp;#160;&amp;#160;&amp;#160; Instant Client Package – SDK &lt;/li&gt;    &lt;li&gt;&amp;#160;&amp;#160;&amp;#160; Instant Client Package – Precompiler &lt;/li&gt;    &lt;li&gt;&amp;#160;&amp;#160;&amp;#160; Instant Client Package - SQL*Plus &lt;/li&gt;    &lt;li&gt;Microsoft Windows XP Professional 32-bit with Service Pack 3 &lt;/li&gt;    &lt;li&gt;Microsoft Visual C++ 2008 Express Edition (available &lt;a href=&quot;http://www.microsoft.com/express/product/&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;) &lt;/li&gt;    &lt;li&gt;Windows SDK for Windows Server 2008 and .NET Framework 3.5 (available &lt;a href=&quot;http://blogs.msdn.com/windowssdk/archive/2008/02/07/windows-sdk-rtms.aspx&quot; target=&quot;_blank&quot;&gt;here&lt;/a&gt;) &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;For the purposes of this discussion you will need to have already installed (or have access to) Oracle Database with the HR sample schema. You will also need to have installed Visual C++ 2008 Express Edition and the Windows SDK on the machine you will use as your development machine. For a walkthrough of installing Visual C++ 2008 Express Edition and the Windows SDK, please see this &lt;a href=&quot;http://blogs.msdn.com/windowssdk/archive/2008/02/22/using-visual-c-2008-express-with-the-windows-sdk-detailed-version.aspx&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt;. Note that even though the SDK seems to be only for Windows Server 2008 (based on the name) it is supported on XP, Vista, and Windows Server.&lt;/p&gt;  &lt;p&gt;In my environment I have installed Oracle Database 10g Express Edition on a host running Oracle Enterprise Linux. The host name is &amp;quot;oel02&amp;quot; (not especially clever, I realize). The Windows XP machine that I will use as the development machine is named &amp;quot;chepstow&amp;quot; (perhaps marginally more clever) and Visual C++ Express Edition and the Windows SDK are already installed. I have downloaded the four Instant Client packages listed above to the &amp;quot;c:\temp&amp;quot; directory on chepstow. The SQL*Plus package is not required; however, I find it convenient so I always install it. So, since I already have a database server and the Microsoft tools are installed, all that remains is to install the Instant Client packages.&lt;/p&gt;  &lt;h3&gt;Installing the Instant Client Packages&lt;/h3&gt;  &lt;p&gt;It is incredibly easy to install the Instant Client packages – simply unzip them! I chose to unzip them (on chepstow, my development machine) to the &amp;quot;c:\&amp;quot; directory and this created a new &amp;quot;c:\instantclient_11_1&amp;quot; directory and various sub-directories. I then added the following two directories to the system path:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;C:\instantclient_11_1 &lt;/li&gt;    &lt;li&gt;C:\instantclient_11_1\sdk&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;NOTE: I added the two directories to the beginning of the system path and had no other Oracle products installed. See comments for more information about this. (Added 29 June 2009 approximately 11:30 AM)&lt;/p&gt;  &lt;h3&gt;Setting up the Pro*C Configuration File&lt;/h3&gt;  &lt;p&gt;I know it is easy to skip reading a README file, but it is important that you do read the PRECOMP_README file in the Instant Client root directory. Pro*C will, by default, look for a configuration file named &amp;quot;pcscfg.cfg&amp;quot; when it is invoked. In the environment that I have created (default installs of all products) Pro*C will want to find this file in the &amp;quot;c:\instantclient_11_1\precomp\admin&amp;quot; directory. However, if you look at your install (if you have done the same as me) you will notice there is no such directory! Therefore you should create this directory (&amp;quot;c:\instantclient_11_1\precomp\admin&amp;quot;). You should then copy the &amp;quot;pcscfg.cfg&amp;quot; file from the &amp;quot;c:\instantclient_11_1\sdk\demo&amp;quot; directory to the &amp;quot;c:\instantclient_11_1\precomp\admin&amp;quot; directory.&lt;/p&gt;  &lt;p&gt;The &amp;quot;pcscfg.cfg&amp;quot; file will initially contain the following single line:&lt;/p&gt;  &lt;p&gt;define=(WIN32_LEAN_AND_MEAN)&lt;/p&gt;  &lt;p&gt;Below this line you add the following four lines:&lt;/p&gt;  &lt;p&gt;sys_include=C:\PROGRA~1\MICROS~1.0\VC\include\sys    &lt;br /&gt;include=C:\PROGRA~1\MICROS~3\Windows\v6.1\Include     &lt;br /&gt;include=C:\PROGRA~1\MICROS~1.0\VC\include     &lt;br /&gt;include=C:\instantclient_11_1\sdk\include&lt;/p&gt;  &lt;p&gt;Save the file and exit your editor.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Be sure to note that the directory names above are the &amp;quot;short&amp;quot; names to ensure they do not contain spaces&lt;/strong&gt;. If the directory names contain spaces this will cause problems with the Pro*C precompiler. To help &amp;quot;translate&amp;quot; the directories above, here are the long versions (be sure you do not enter these):&lt;/p&gt;  &lt;p&gt;sys_include=C:\Program Files\Microsoft Visual Studio 9.0\VC\include\sys    &lt;br /&gt;include=C:\Program Files\Microsoft SDKs\Windows\v6.1\Include     &lt;br /&gt;include=C:\Program Files\Microsoft Visual Studio 9.0\VC\include     &lt;br /&gt;include=C:\instantclient_11_1\sdk\include&lt;/p&gt;  &lt;p&gt;You can find the short names by using &amp;quot;dir /x&amp;quot; in a command-prompt window.&lt;/p&gt;  &lt;h3&gt;Adding Directories to Visual Studio C++ 2008 Express Edition&lt;/h3&gt;  &lt;p&gt;Next you should add the Oracle Instant Client include and library directories to Visual Studio. To do this, simply perform the following steps:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Select Tools –&amp;gt; Options to open the Options dialog &lt;/li&gt;    &lt;li&gt;Expand the &amp;quot;Projects and Solutions&amp;quot; node &lt;/li&gt;    &lt;li&gt;Click the &amp;quot;VC++ Directories&amp;quot; item &lt;/li&gt;    &lt;li&gt;Under &amp;quot;Show directories for:&amp;quot; select &amp;quot;Include files&amp;quot; &lt;/li&gt;    &lt;li&gt;Click underneath the last entry in the list (you should get a highlighted line with no text) &lt;/li&gt;    &lt;li&gt;Click the folder button to create a new line &lt;/li&gt;    &lt;li&gt;Enter &amp;quot;c:\instantclient_11_1\sdk\include&amp;quot; and press Enter &lt;/li&gt;    &lt;li&gt;Under &amp;quot;Show directories for:&amp;quot; select &amp;quot;Library files&amp;quot; &lt;/li&gt;    &lt;li&gt;Click underneath the last entry in the list (you should get a highlighted line with no text) &lt;/li&gt;    &lt;li&gt;Click the folder button to create a new line &lt;/li&gt;    &lt;li&gt;Enter &amp;quot;c:\instantclient_11_1\sdk\lib\msvc&amp;quot; and press Enter &lt;/li&gt;    &lt;li&gt;Click the OK button to save the changes &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Create a New Project&lt;/h3&gt;  &lt;p&gt;WARNING: You should create your project in a directory (and path) that has no spaces in it. If you create the project in a directory or path with spaces you will receive errors during the precompile phase. I used &amp;quot;c:\temp&amp;quot; for this example.&lt;/p&gt;  &lt;p&gt;Now create a new project in Visual Studio:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Select File –&amp;gt; New Project to open the New Project dialog &lt;/li&gt;    &lt;li&gt;Select &amp;quot;Win32&amp;quot; as the project type &lt;/li&gt;    &lt;li&gt;Select &amp;quot;Win32 Console Application&amp;quot; under &amp;quot;Templates&amp;quot; &lt;/li&gt;    &lt;li&gt;Give the project a name (I used &amp;quot;proctest&amp;quot; in keeping with my clever naming tradition) &lt;/li&gt;    &lt;li&gt;I always choose to de-select &amp;quot;Create directory for solution&amp;quot; and click OK &lt;/li&gt;    &lt;li&gt;Click the &amp;quot;Next&amp;quot; button in the application wizard &lt;/li&gt;    &lt;li&gt;Click the &amp;quot;Empty project&amp;quot; checkbox under &amp;quot;Additional options&amp;quot; &lt;/li&gt;    &lt;li&gt;Click the &amp;quot;Finish&amp;quot; button &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Create the Pro*C Source File&lt;/h3&gt;  &lt;p&gt;To create the Pro*C source file, perform the following steps:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Right-click &amp;quot;Source Files&amp;quot; and select Add –&amp;gt; New Item… from the context menu &lt;/li&gt;    &lt;li&gt;Select &amp;quot;Code&amp;quot; under &amp;quot;Visual C++&amp;quot; &lt;/li&gt;    &lt;li&gt;Select &amp;quot;C++ File (.cpp)&amp;quot; under &amp;quot;Visual Studio installed templates&amp;quot; (note that you will not actually create C++ code in this example) &lt;/li&gt;    &lt;li&gt;Give the file a name such as &amp;quot;proctest.pc&amp;quot; and click &amp;quot;Add&amp;quot; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Here&#39;s the Pro*C source I used for this example (this is clearly sample code and &lt;strong&gt;lots&lt;/strong&gt; is left out!):&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;/*      &lt;br /&gt;** suppress certain warnings       &lt;br /&gt;*/       &lt;br /&gt;#ifdef WIN32       &lt;br /&gt;#define _CRT_SECURE_NO_DEPRECATE 1       &lt;br /&gt;#endif &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;#include &amp;lt;stdio.h&amp;gt;      &lt;br /&gt;#include &amp;lt;string.h&amp;gt;       &lt;br /&gt;#include &amp;lt;stdlib.h&amp;gt;       &lt;br /&gt;#include &amp;lt;sqlca.h&amp;gt;       &lt;br /&gt;#include &amp;lt;sqlda.h&amp;gt;       &lt;br /&gt;#include &amp;lt;sqlcpr.h&amp;gt; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;EXEC SQL BEGIN DECLARE SECTION; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;/*      &lt;br /&gt;** defines for VARCHAR lengths.       &lt;br /&gt;*/       &lt;br /&gt;#define UNAME_LEN 30       &lt;br /&gt;#define PWD_LEN&amp;#160;&amp;#160; 30       &lt;br /&gt;#define DB_LEN&amp;#160;&amp;#160;&amp;#160; 48       &lt;br /&gt;#define FNAME_LEN 32       &lt;br /&gt;#define LNAME_LEN 32 &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;/*      &lt;br /&gt;** variables for the connection       &lt;br /&gt;*/       &lt;br /&gt;VARCHAR username[UNAME_LEN];       &lt;br /&gt;VARCHAR password[PWD_LEN];       &lt;br /&gt;VARCHAR dbname[DB_LEN]; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;/*      &lt;br /&gt;** variables to hold the results       &lt;br /&gt;*/       &lt;br /&gt;int ctr;       &lt;br /&gt;int empid;       &lt;br /&gt;VARCHAR fname[FNAME_LEN];       &lt;br /&gt;VARCHAR lname[LNAME_LEN]; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;EXEC SQL END DECLARE SECTION; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;/*      &lt;br /&gt;** declare error handling function       &lt;br /&gt;*/       &lt;br /&gt;void sql_error(char *msg)       &lt;br /&gt;{       &lt;br /&gt;&amp;#160; char err_msg[128];       &lt;br /&gt;&amp;#160; size_t buf_len, msg_len; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; EXEC SQL WHENEVER SQLERROR CONTINUE; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; printf(&amp;quot;\n%s\n&amp;quot;, msg);      &lt;br /&gt;&amp;#160; buf_len = sizeof (err_msg);       &lt;br /&gt;&amp;#160; sqlglm(err_msg, &amp;amp;buf_len, &amp;amp;msg_len);       &lt;br /&gt;&amp;#160; printf(&amp;quot;%.*s\n&amp;quot;, msg_len, err_msg); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; EXEC SQL ROLLBACK RELEASE; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; exit(EXIT_FAILURE);      &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;void main()      &lt;br /&gt;{       &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160; ** Copy the username into the VARCHAR.       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; strncpy((char *) username.arr, &amp;quot;hr&amp;quot;, UNAME_LEN);       &lt;br /&gt;&amp;#160; username.len = strlen(&amp;quot;hr&amp;quot;);       &lt;br /&gt;&amp;#160; username.arr[username.len] = &#39;\0&#39;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; /*      &lt;br /&gt;&amp;#160; ** Copy the password.       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; strncpy((char *) password.arr, &amp;quot;hr&amp;quot;, PWD_LEN);       &lt;br /&gt;&amp;#160; password.len = strlen(&amp;quot;hr&amp;quot;);       &lt;br /&gt;&amp;#160; password.arr[password.len] = &#39;\0&#39;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; /*      &lt;br /&gt;&amp;#160; ** copy the dbname (using EZCONNECT syntax)       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; strncpy((char *) dbname.arr, &amp;quot;oel02/XE&amp;quot;, DB_LEN);       &lt;br /&gt;&amp;#160; dbname.len = strlen(&amp;quot;oel02/XE&amp;quot;);       &lt;br /&gt;&amp;#160; dbname.arr[dbname.len] = &#39;\0&#39;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; /*      &lt;br /&gt;&amp;#160; ** register sql_error() as the error handler.       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; EXEC SQL WHENEVER SQLERROR DO sql_error(&amp;quot;ORACLE error--\n&amp;quot;); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; /*      &lt;br /&gt;&amp;#160; ** Connect to database.&amp;#160; Will call sql_error()       &lt;br /&gt;&amp;#160; ** if an error occurs when connecting.       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; EXEC SQL CONNECT :username IDENTIFIED BY :password USING :dbname; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; printf(&amp;quot;\nConnected to ORACLE as user: %s\n\n&amp;quot;, username.arr);      &lt;br /&gt;      &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160; ** simple select statement       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; EXEC SQL DECLARE emps CURSOR FOR       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; SELECT&amp;#160;&amp;#160; employee_id,       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; first_name,       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; last_name       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; FROM&amp;#160;&amp;#160;&amp;#160;&amp;#160; employees       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ORDER BY last_name,       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; first_name; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; /*      &lt;br /&gt;&amp;#160; ** open the cursor       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; EXEC SQL OPEN emps;       &lt;br /&gt;      &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160; ** when done fetching break out of the for loop       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; EXEC SQL WHENEVER NOT FOUND DO break;       &lt;br /&gt;      &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160; ** simple counter variable       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; ctr = 0;       &lt;br /&gt;      &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160; ** print a little header       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; printf(&amp;quot;Employee ID&amp;#160; First Name&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Last Name\n&amp;quot;);       &lt;br /&gt;&amp;#160; printf(&amp;quot;===========&amp;#160; ====================&amp;#160; =========================\n&amp;quot;);       &lt;br /&gt;      &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160; ** fetch all the rows       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; for (;;)       &lt;br /&gt;&amp;#160; {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; EXEC SQL FETCH emps into :empid, :fname, :lname;       &lt;br /&gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /*       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ** null-terminate the string values       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; */       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; fname.arr[fname.len] = &#39;\0&#39;;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; lname.arr[lname.len] = &#39;\0&#39;;       &lt;br /&gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; /*       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ** print the current values       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; */       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; printf(&amp;quot;%-13d%-22s%-25s\n&amp;quot;, empid, fname.arr, lname.arr);       &lt;br /&gt;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; ctr++;       &lt;br /&gt;&amp;#160; }       &lt;br /&gt;      &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160; ** close the cursor       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; EXEC SQL CLOSE emps;       &lt;br /&gt;      &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160; ** provide simple feedback on how many rows fetched       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; printf(&amp;quot;\nFetched %d employees.\n&amp;quot;, ctr); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; /*      &lt;br /&gt;&amp;#160; ** disconnect from database       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; EXEC SQL ROLLBACK WORK RELEASE;       &lt;br /&gt;      &lt;br /&gt;&amp;#160; /*       &lt;br /&gt;&amp;#160; ** have a nice day       &lt;br /&gt;&amp;#160; */       &lt;br /&gt;&amp;#160; exit(EXIT_SUCCESS);       &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;&amp;#160;&lt;/h3&gt;  &lt;h3&gt;Add a Reference to the Generated C Source File&lt;/h3&gt;  &lt;p&gt;The output of the Pro*C precompiler is either C or C++ source code (C in this case). However, because we are working with only a Pro*C source file we need to tell Visual Studio about the file that will be generated. To do this we add a reference to the not yet generated file:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Select Project –&amp;gt; Add New Item to open the Add New Item dialog &lt;/li&gt;    &lt;li&gt;Select &amp;quot;Code&amp;quot; under &amp;quot;Visual C++&amp;quot; &lt;/li&gt;    &lt;li&gt;Select &amp;quot;C++ File (.cpp)&amp;quot; under &amp;quot;Visual Studio installed templates&amp;quot; &lt;/li&gt;    &lt;li&gt;Type &amp;quot;proctest.c&amp;quot; in the &amp;quot;Name&amp;quot; textbox and click &amp;quot;Add&amp;quot; &lt;/li&gt;    &lt;li&gt;Next close the (empty) file after it is created &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Add the Pro*C Library File to the Project&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;Select Project –&amp;gt; &amp;lt;project name&amp;gt; Properties… to open the Property Pages dialog &lt;/li&gt;    &lt;li&gt;Expand the &amp;quot;Configuration Properties&amp;quot; node &lt;/li&gt;    &lt;li&gt;Expand the &amp;quot;Linker&amp;quot; node &lt;/li&gt;    &lt;li&gt;Click the &amp;quot;Input&amp;quot; item &lt;/li&gt;    &lt;li&gt;In the &amp;quot;Additional Dependencies&amp;quot; type &amp;quot;orasql11.lib&amp;quot; and click &amp;quot;OK&amp;quot; to save the changes &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Add the Custom Build Step&lt;/h3&gt;  &lt;p&gt;In order for Visual Studio to be able to invoke the Pro*C executable (proc.exe) to create the C source code file, a custom build step needs to be created:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Right-click &amp;quot;proctest.pc&amp;quot; in the Solution Explorer and select &amp;quot;Properties&amp;quot; from the context menu &lt;/li&gt;    &lt;li&gt;Select &amp;quot;Custom Build Step&amp;quot; &lt;/li&gt;    &lt;li&gt;For &amp;quot;Command Line&amp;quot; type &amp;quot;proc.exe $(ProjectDir)$(InputName).pc&amp;quot; &lt;/li&gt;    &lt;li&gt;For &amp;quot;Outputs&amp;quot; type &amp;quot;$(ProjectDir)$(InputName).c&amp;quot; &lt;/li&gt;    &lt;li&gt;Click &amp;quot;OK&amp;quot; to save the custom build step &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;This step will cause Visual Studio to invoke proc.exe on the input file (proctest.pc) and create an output file called &amp;quot;proctest.c&amp;quot; which will then be compiled as normal. This is really the key step in the whole process I suppose. This custom build step is the &amp;quot;integration&amp;quot; of Pro*C into Visual Studio.&lt;/p&gt;  &lt;h3&gt;Build the Sample and Verify&lt;/h3&gt;  &lt;p&gt;All the hard work is now done and it is time to build the sample!&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Select Build –&amp;gt; Build Solution &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;If all has gone well you should see output similar to the following in the output window:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;proctest - 0 error(s), 0 warning(s)      &lt;br /&gt;========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;If there are errors reported you will need to investigate and correct the cause.&lt;/p&gt;  &lt;p&gt;Upon completion of a successful build, you can execute the program and verify the results:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;C:\temp\proctest\Debug&amp;gt;proctest &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;Connected to ORACLE as user: hr &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;Employee ID&amp;#160; First Name&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Last Name      &lt;br /&gt;===========&amp;#160; ====================&amp;#160; =========================       &lt;br /&gt;174&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Ellen&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Abel       &lt;br /&gt;166&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Sundar&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Ande       &lt;br /&gt;130&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Mozhe&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Atkinson&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;[ snip ]&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;120&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Matthew&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Weiss      &lt;br /&gt;200&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Jennifer&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Whalen       &lt;br /&gt;149&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Eleni&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Zlotkey &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;Fetched 107 employees. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;C:\temp\proctest\Debug&amp;gt;&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;&amp;#160;&lt;/h3&gt;  &lt;h3&gt;Conclusion&lt;/h3&gt;  &lt;p&gt;Whew! That&#39;s a lot of work! As I mentioned at the beginning of this post, this is intended to be an introductory look at using Pro*C and Visual C++ 2008 Express Edition. There is, of course, much more that Pro*C can do and this simple example of selecting from the &amp;quot;employees&amp;quot; table in the &amp;quot;hr&amp;quot; schema is exactly that: a simple example. It is not intended to be a complete tutorial but perhaps it will be helpful in working with Pro*C and Visual Studio if you choose to do so. You should be able to adapt the steps here to using the &amp;quot;full&amp;quot; version of Visual Studio or Oracle Client.&lt;/p&gt;  &lt;p&gt;If you made it this far, thanks for stopping by. I hope this was helpful in some regard.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;NOTE: Some comments below were recently deleted by me at the request of the poster. I have, therefore, deleted my responses to those comments as they made no sense on their own. (1-June-2009 approximately 1:10 PM)&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/1187435699725708153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/1187435699725708153'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/05/oracle-proc-on-windows-with-express.html' title='Oracle Pro*C on Windows with Express Edition Products'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-4424469073421254049</id><published>2009-03-31T00:51:00.001+00:00</published><updated>2025-11-08T14:46:19.148+00:00</updated><title type='text'>jmp&amp;#39;ing around Win64 with ml64.exe and Assembly Language</title><content type='html'>&lt;p&gt;I&#39;ve been fascinated by (and interested in) assembly language for a number of years. I fondly remember my &quot;&lt;a href=&quot;http://www.amazon.com/Assembly-Language-Primer-Personal-Computer/dp/0136619010&quot; target=&quot;_blank&quot; title=&quot;Peter Norton Assembly book on Amazon.com&quot;&gt;Peter Norton Assembly&lt;/a&gt;&quot; book and wish I hadn&#39;t sent it to a better home several years ago. But, hey, it was a major moving of house and I had to have as few items as possible. The sacrifices we make…&lt;/p&gt;  &lt;p&gt;Anyway, I had some spare time this past weekend and decided to try and see if I could get a simple 64-bit assembly language program working under Win64. My goal was to write some text to a console window and exit without destroying my entire system. I managed to succeed in that endeavor and had a bit of fun along the way. My wife thinks I have a bizarre definition of fun. If you continue to read the rest of this post keep in mind I said I was &quot;interested&quot; in assembly. By no means is this intended to be a tutorial or guide in writing efficient and professional assembly! As the comments in the code indicate, there was no true attempt at optimization, etc!&lt;/p&gt;  &lt;p&gt;A couple of links that I ran across and found helpful (Links accurate as of today. Who knows what the future may bring?):&lt;/p&gt;  &lt;p&gt;- Matt Pietrek&#39;s X64 Primer column from the May 2006 MSDN Magazine found &lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/cc300794.aspx&quot; target=&quot;_blank&quot; title=&quot;Matt Pietrek&#39;s X64 Primer column from MSDN&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;- Raymond Chen&#39;s Blog (The Old New Thing) posting entitled &quot;The History of Calling Conventions, Part 5: AMD64&quot; found &lt;a href=&quot;https://devblogs.microsoft.com/oldnewthing/20040114-00/?p=41053&quot; target=&quot;_blank&quot; title=&quot;Raymond Chen&#39;s The Old New Thing&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;In order to make the code just a tiny bit more interesting I decided to call the &quot;cpuid&quot; function to get the Vendor ID from the processor and write that out as well as some static text. Information on the &quot;cpuid&quot; function is available in pdf format on both the &lt;a href=&quot;http://www.intel.com/Assets/PDF/appnote/241618.pdf&quot; target=&quot;_blank&quot; title=&quot;Intel CPUID Instruction PDF&quot;&gt;Intel&lt;/a&gt; and &lt;a href=&quot;http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/25481.pdf&quot; target=&quot;_blank&quot; title=&quot;AMD CPUID Instruction PDF&quot;&gt;AMD&lt;/a&gt; websites. One thing that I found interesting is that the 4 byte chunks (of which there are 3) that make up the output of the Vendor ID request from the &quot;cpuid&quot; function are stored in the registers in an &quot;out of order&quot; fashion. Look at the code below that gets the chunks from the registers and you&#39;ll see what I mean (I hope).&lt;/p&gt;  &lt;h3&gt;My First-Ever Windows 64-bit Assembly Language Program as a Learning Experience / Exploration&lt;/h3&gt;  &lt;p&gt;NOTE: Multiple edits made per comment(s) etc. over time and things may change (perhaps dramatically) in the future&lt;br /&gt;&lt;/p&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; a (very) simple x64 masm (ml64.exe) demo that calls the cpuid function&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; and writes the results to a console window.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; this is a simple experiment and almost certainly not very good assembly code&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; for one thing there is no attempt at true optimization (like removing duplicate&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; sections of code) or error handling.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; args are passed in registers as follows:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; RCX: 1st integer argument&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; RDX: 2nd integer argument&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; R8: 3rd integer argument&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; R9: 4th integer argument&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; the stack is used for args beyond 4 (after space reserved for first 4)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; this reserved space on the stack for first 4 arguments is&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; the &quot;register home space&quot; or &quot;register parameter stack area&quot;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; unlike win32 the caller is responsible for cleaning the stack rather than&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; the callee&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; win api functions that are called below.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; this is a small optimization in that if&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; call by name such as GetStdHandle there&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; will be a stub generated that then jumps&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; to the proper location. this avoids that&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; extra jump from the stub location.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;externdef __imp_GetStdHandle : qword&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;externdef __imp_ExitProcess&amp;nbsp; : qword&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;externdef __imp_WriteFile&amp;nbsp; &amp;nbsp; : qword&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;externdef __imp_lstrlen&amp;nbsp; &amp;nbsp; &amp;nbsp; : qword&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; the variables used in the main code below such as the text to write&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; typically carriage return (13) and line feed (10) CRLF would not be&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; embedded in the string values but this is a simple test / demo&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;.data&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;hFile&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; qword 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;msglen&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dword 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;BytesWritten dword 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;vndrid&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;byte&amp;nbsp; 13, 10, &quot;The processor Vendor ID is &#39;xxxxxxxxxxxx&#39;.&quot;, 13, 10, 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; these are read-only&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;.const&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;supp&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;byte&amp;nbsp; 13, 10, &#39;CPUID instruction supported!&#39;, 13, 10, 0&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;nosupp&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;byte&amp;nbsp; 13, 10, &#39;CPUID instruction NOT supported!&#39;, 13, 10, 0&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;; and we&#39;re off...&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;.code&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;main proc frame&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; registers that should be preserved (non-volatile)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; rbp, rbx, rdi, rsi, rsp, r12, r13, r14, r15&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; registers that do not need to be preserved (volatile / scratch)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ;&amp;nbsp;rax, rcx, rdx, r8, r9, r10, r11&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; prologue (there are other options)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; frame pointer in rbp is used because the code to check&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; if cpuid is available changes rsp (via pushes and pops).&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; stack modification outside of prologue requires frame pointer.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; the frame pointer is not directly used in this code.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; refer to &quot;x64 exception handling&quot; in &quot;x64 ABI conventions&quot;.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; push rbp&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; pushing rbp aligns the stack&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; .pushreg rbp&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; unwind info&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; push rbx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; rbx is a non-volatile register used below, stack not aligned&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; .pushreg rbx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; unwind info&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: &amp;quot;courier new&amp;quot;;&quot;&gt;&amp;nbsp; sub rsp, 28h&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; adjust stack for register home space and parameter(s)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; WriteFile takes 5 parameters and thus uses stack for 5th&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; also align on a 16 byte boundary&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; .allocstack 28h&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; unwind info stack allocation&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov rbp, rsp&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; save current rsp into rbp as frame pointer&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; .setframe rbp, 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; frame pointer (offset 0 - points to base not into frame&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; which may also be done). see above notes about usage.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; .endprolog&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; unwind info mark end of prologue&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; get the handle for the console window to use when writing text&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; this is used by WriteFile win api function below&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov ecx, -11&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; put -11 (STD_OUTPUT_HANDLE) into ecx (dword)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; call __imp_GetStdHandle&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov hFile, rax&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; move returned handle to hFile&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; check that the cpuid instruction is supported&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; this is very likely supported, but here for completeness&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; taken from the AMD64 Architecture Programmer&#39;s Manual&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; Volume 3: General-Purpose and System Instructions&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; pushfq&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; save FLAGS&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; pop rax&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; store FLAGS in RAX&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov rbx, rax&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; save in RBX for test&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; xor rax, 200000h&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; toggle bit #21 (i.e., 22nd bit)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; push rax&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; put result on stack&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; popfq&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; save changed RAX to FLAGS&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; pushfq&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; push FLAGS onto stack&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; pop rax&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; store FLAGS in RAX&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; cmp rax, rbx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; determine if bit #21 changed&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; je no_cpuid&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; cpuid not supported (bit did not change)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;div&gt;&amp;nbsp; ; The Windows 64-bit paradigm includes allocating the largest amount&lt;/div&gt;&lt;div&gt;&amp;nbsp; ; of stack space needed and then reusing that space. As such the&lt;/div&gt;&lt;div&gt;&amp;nbsp; ; stack pointer (rsp) does not change typically due to the reduced&lt;/div&gt;&lt;div&gt;&amp;nbsp; ; usage of pushes (and matched pops). There are no operations from&lt;/div&gt;&lt;div&gt;&amp;nbsp; ; this point that change rsp so it is used for providing offsets.&lt;/div&gt;&lt;div&gt;&amp;nbsp; ; If rsp did change (as it would in the above section of code) then&lt;/div&gt;&lt;div&gt;&amp;nbsp; ; using rbp (or other register as a frame pointer) would be better.&lt;/div&gt;&lt;div&gt;&amp;nbsp; ; And in such a case the register used as a frame pointer may point&lt;/div&gt;&lt;div&gt;&amp;nbsp; ; into the frame rather than at the base (as noted above).&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; cpuid is supported if we did not jump...&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; so print the message that it is supported and then&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; jump to location where it is actually performed&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; lea rcx, supp&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; load address of supp text into rcx&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; call __imp_lstrlen&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; call win api function to get length of text&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov msglen, eax&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; move length of string from eax to msglen&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov qword ptr [rsp + 32], 0&amp;nbsp; &amp;nbsp; ; LPOVERLAPPED lpOverlapped&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; lea r9, BytesWritten&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; LPDWORD lpNumberOfBytesWritten&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov r8d, msglen&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; DWORD nNumberOfBytesToWrite&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; lea rdx, supp&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; LPCVOID lpBuffer&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov rcx, hFile&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; HANDLE hFile&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; call __imp_WriteFile&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; call win api to write text to console&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; jmp do_cpuid&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; jump over the no_cpuid code path&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;no_cpuid:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; lea rcx, nosupp&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; load address of nosupp text into rcx&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; call __imp_lstrlen&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; call win api function to get length of text&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov msglen, eax&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; move length of string from eax to msglen&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov qword ptr [rsp + 32], 0&amp;nbsp; &amp;nbsp; ; LPOVERLAPPED lpOverlapped&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; lea r9, BytesWritten&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; LPDWORD lpNumberOfBytesWritten&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov r8d, msglen&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; DWORD nNumberOfBytesToWrite&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; lea rdx, nosupp&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; LPCVOID lpBuffer&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov rcx, hFile&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; HANDLE hFile&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; call __imp_WriteFile&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; call win api to write text to console&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; jmp exit&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; the no support message was written, so exit&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;do_cpuid:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; lea rcx, vndrid&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; load address of vndrid text into rcx&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; call __imp_lstrlen&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; call win api function to get length of text&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov msglen, eax&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; move length of string from eax to msglen&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; xor eax, eax&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; 0 indicates we want the vendor id string&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; cpuid&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; invoke the cpuid instruction to get the string&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; the results are now in ebx, edx, and ecx&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; ; replace the &#39;x&#39; placeholders with the vendor id&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; lea r9, vndrid&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov [r9+30], ebx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; the first 4 bytes of the vendor id&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov [r9+34], edx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; the next 4 bytes of the vendor id&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov [r9+38], ecx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; the final 4 bytes of the vendor id&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov qword ptr [rsp + 32], 0&amp;nbsp; &amp;nbsp; ; LPOVERLAPPED lpOverlapped&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; lea r9, BytesWritten&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; LPDWORD lpNumberOfBytesWritten&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov r8d, msglen&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; DWORD nNumberOfBytesToWrite&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; lea rdx, vndrid&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ; LPCVOID lpBuffer&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; mov rcx, hFile&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; HANDLE hFile&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; call __imp_WriteFile&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; call win api to write text to console&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;exit:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; xor ecx, ecx&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; return value of 0 passed as UINT parameter to ExitProcess&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; call __imp_ExitProcess&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; exit in Windows-friendly manner rather than typical epilogue&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; such as would be present outside of this entry point procedure&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;; nothing after here would execute so no epilogue etc.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;main endp&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;end&lt;/span&gt;&lt;/div&gt;&lt;p&gt;The command I used to compile the above is (apologies if wrapping make it difficult to read):&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;ml64 test64.asm /link /subsystem:console /defaultlib:&quot;C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64\kernel32.lib&quot; /entry:main&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;And for the moment of truth…&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;C:\My Projects\Test\ASM\test&amp;gt;test64 &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;CPUID instruction supported! &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;courier new&quot;&gt;The processor Vendor ID is &#39;GenuineIntel&#39;.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Hurray! Unless you sell AMD chips then you might think &#39;AuthenticAMD&#39; would look better…&lt;/p&gt;  &lt;p&gt;If you see something profoundly wrong in the above, please let me know. It&#39;s not like I am going to be churning out assembly code all of a sudden, but I would still be interested in knowing…&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/4424469073421254049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/4424469073421254049'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/03/jmp-around-win64-with-ml64exe-and.html' title='jmp&amp;#39;ing around Win64 with ml64.exe and Assembly Language'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-8468632891705286240</id><published>2009-03-25T01:16:00.002+00:00</published><updated>2009-03-25T01:25:31.088+00:00</updated><title type='text'>ODP.NET Tip: Bind Variables, the BindByName Property, and PL/SQL Function Return Values</title><content type='html'>&lt;p&gt;A question was posed as a follow-up to a previous post here:&lt;/p&gt;  &lt;p&gt;&lt;a title=&quot;http://oradim.blogspot.com/2007/08/odpnet-tip-bind-variables-and.html&quot; href=&quot;http://oradim.blogspot.com/2007/08/odpnet-tip-bind-variables-and.html&quot;&gt;http://oradim.blogspot.com/2007/08/odpnet-tip-bind-variables-and.html&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The poster wanted to know if you have set BindByName to &amp;quot;true&amp;quot; for an OracleCommand object and the command text for that object calls a PL/SQL function (which of course has a return value but no name), what name should you give to the parameter object that will receive the return value? It&#39;s a good question since BindByName set to &amp;quot;true&amp;quot; implies that you&#39;ve given names to your bind variables!&lt;/p&gt;  &lt;p&gt;The short answer is: It doesn&#39;t matter as it will be ignored anyway.&lt;/p&gt;  &lt;p&gt;As in The Highlander movies, with return values, there can be only one. You can set ParameterDirection to &amp;quot;ReturnValue&amp;quot; for multiple parameters, but it is an error to do so. Try it and see what errors are raised.&lt;/p&gt;  &lt;p&gt;Here&#39;s a quick little demo showing that it does not matter what name you give to the parameter that you declare as the return value.&lt;/p&gt;  &lt;p&gt;First create a simple PL/SQL function (so that there &lt;strong&gt;is&lt;/strong&gt; a return value!) like this:&lt;/p&gt;  &lt;p&gt;create or replace function subtract_numbers(p1 in number, p2 in number) return number as   &lt;br /&gt;begin    &lt;br /&gt;&amp;#160; return p1 - p2;    &lt;br /&gt;end;    &lt;br /&gt;/&lt;/p&gt;  &lt;p&gt;I&#39;ve elected to do a simple bit of subtraction and this is for a reason. Since in subtraction the order of the parameters matters, it is easy to show that the parameters are being handled in the correct order. As you&#39;ll see in the sample code below, I use the values &amp;quot;48&amp;quot; and &amp;quot;2&amp;quot; so it would be obvious if the ordering were reversed.&lt;/p&gt;  &lt;p&gt;Now, here&#39;s some simple (and normal caveats about no error handling, etc. apply) bit of C# to illustrate the point:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;using System;     &lt;br /&gt;using System.Data;      &lt;br /&gt;using Oracle.DataAccess.Client;      &lt;br /&gt;using Oracle.DataAccess.Types; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;class Program     &lt;br /&gt;{      &lt;br /&gt;&amp;#160; static void Main(string[] args)      &lt;br /&gt;&amp;#160; {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // adjust connect string to suit your environment      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; string constr = &amp;quot;user id=hr;&amp;quot; +      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;password=hr;&amp;quot; +      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;data source=orademo;&amp;quot; +      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;pooling=false;&amp;quot; +      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;enlist=false&amp;quot;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; // create and open connection     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; OracleConnection con = new OracleConnection(constr);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; con.Open(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; // create command object     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; OracleCommand cmd = con.CreateCommand();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cmd.CommandText = &amp;quot;subtract_numbers&amp;quot;;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cmd.CommandType = CommandType.StoredProcedure; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; // set bindbyname to true so parameters can be added     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // in any order and to illustrate what happens with a      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // return value      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cmd.BindByName = true; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; // the first input parameter to the pl/sql function     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; OracleParameter p1 = new OracleParameter();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; p1.Direction = ParameterDirection.Input;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; p1.OracleDbType = OracleDbType.Int64;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; p1.ParameterName = &amp;quot;p1&amp;quot;;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; p1.Value = 48; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; // the second input parameter to the pl/sql function     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; OracleParameter p2 = new OracleParameter();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; p2.Direction = ParameterDirection.Input;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; p2.OracleDbType = OracleDbType.Int64;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; p2.ParameterName = &amp;quot;p2&amp;quot;;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; p2.Value = 2; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; // the return parameter from the pl/sql function     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; OracleParameter p3 = new OracleParameter();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; p3.Direction = ParameterDirection.ReturnValue;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; p3.OracleDbType = OracleDbType.Int64;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; p3.ParameterName = &amp;quot;ignored&amp;quot;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; // add the parameters in a &amp;quot;wrong&amp;quot; order since     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // bindbyname is true -- this is key      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cmd.Parameters.Add(p1);&amp;#160; // input #1      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cmd.Parameters.Add(p3);&amp;#160; // return value      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cmd.Parameters.Add(p2);&amp;#160; // input #2 &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; // execute the stored pl/sql code     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cmd.ExecuteNonQuery(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; // write the result to the console window     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Console.WriteLine(&amp;quot;The difference of {0} and {1} is {2}&amp;quot;,      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; p1.Value, p2.Value, p3.Value); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; // prevent console window from closing when run from VS     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Console.WriteLine();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Console.Write(&amp;quot;ENTER to continue...&amp;quot;);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Console.ReadLine();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; // clean up      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; p3.Dispose();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; p2.Dispose();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; p1.Dispose();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; cmd.Dispose();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; con.Dispose();      &lt;br /&gt;&amp;#160; }      &lt;br /&gt;} &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Notice how the parameters are added to the parameter collection &amp;quot;out of order&amp;quot;. This is OK since BindByName is set to &amp;quot;true&amp;quot;. You can comment out the line that sets BindByName and see an exception raised if you want. Anyway, when I execute this code, I get the expected results as follows:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;The difference of 48 and 2 is 46 &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;ENTER to continue...&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;So, even though the return value parameter was added to the collection in the second position everything works as desired. Yes, but I gave it a name of &amp;quot;ignored&amp;quot; so how do we know that name is not really being used? Well there are two easy ways to find out. One, just don&#39;t give the parameter a name at all and everything should continue to execute just fine. It&#39;s easy to ignore a name that&#39;s not there! Or, two, if you are an inquisitive type, enable SQL tracing (search the web for 10046 trace -- you&#39;ll find a million hits) and see what ODP.NET actually sent to the database. Here&#39;s a snippet of a trace file from the above code (with the parameter name of &amp;quot;ignored&amp;quot; in place):&lt;/p&gt;  &lt;p&gt;PARSING IN CURSOR #2 len=54 dep=0 uid=82 oct=47 lid=82 tim=10601980885 hv=1771638930 ad=&#39;7ff39775518&#39; sqlid=&#39;gx0kvypntk44k&#39;   &lt;br /&gt;Begin :ret := subtract_numbers(p1=&amp;gt;:v0, p2=&amp;gt;:v2); End;    &lt;br /&gt;END OF STMT    &lt;br /&gt;PARSE #2:c=0,e=0,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,plh=0,tim=10601980885    &lt;br /&gt;BINDS #2:    &lt;br /&gt; Bind#0    &lt;br /&gt;&amp;#160; oacdty=02 mxl=22(21) mxlc=00 mal=00 scl=00 pre=00    &lt;br /&gt;&amp;#160; oacflg=03 fl2=1000000 frm=00 csi=00 siz=72 off=0    &lt;br /&gt;&amp;#160; kxsbbbfp=1bb2dd60&amp;#160; bln=22&amp;#160; avl=00&amp;#160; flg=05    &lt;br /&gt; Bind#1    &lt;br /&gt;&amp;#160; oacdty=02 mxl=22(21) mxlc=00 mal=00 scl=00 pre=00    &lt;br /&gt;&amp;#160; oacflg=03 fl2=1000000 frm=00 csi=00 siz=0 off=24    &lt;br /&gt;&amp;#160; kxsbbbfp=1bb2dd78&amp;#160; bln=22&amp;#160; avl=02&amp;#160; flg=01    &lt;br /&gt;&amp;#160; value=48    &lt;br /&gt; Bind#2    &lt;br /&gt;&amp;#160; oacdty=02 mxl=22(21) mxlc=00 mal=00 scl=00 pre=00    &lt;br /&gt;&amp;#160; oacflg=03 fl2=1000000 frm=00 csi=00 siz=0 off=48    &lt;br /&gt;&amp;#160; kxsbbbfp=1bb2dd90&amp;#160; bln=22&amp;#160; avl=02&amp;#160; flg=01    &lt;br /&gt;&amp;#160; value=2&lt;/p&gt;  &lt;p&gt;See how ODP.NET generated a little anonymous block and substituted &amp;quot;ret&amp;quot; for the return value parameter? You should see the same thing even if there is no name given to the return parameter. You can also clearly see how the input parameter names are associated with the input values.&lt;/p&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/8468632891705286240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/8468632891705286240'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/03/odpnet-tip-bind-variables-bindbyname.html' title='ODP.NET Tip: Bind Variables, the BindByName Property, and PL/SQL Function Return Values'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-2231389353360815968</id><published>2009-03-14T18:14:00.001+00:00</published><updated>2009-03-14T18:15:53.958+00:00</updated><title type='text'>HotSos Symposium 2009 Materials</title><content type='html'>&lt;p&gt;The paper and all sample code from my HotSos Symposium 2009 presentation entitled &quot;Instrumented Code Is Better Code&quot; is available as a single .zip file. To download the .zip file, click &lt;a title=&quot;Instrumented Code Is Better Code Download&quot; href=&quot;http://apex.oracle.com/pls/otn/CHESHAMDBS.get_hotsos_2009_materials&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/2231389353360815968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/2231389353360815968'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/03/hotsos-symposium-2009-materials.html' title='HotSos Symposium 2009 Materials'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-2082209460397131642</id><published>2009-01-20T22:16:00.001+00:00</published><updated>2009-01-20T22:16:54.379+00:00</updated><title type='text'>Oracle ACE Director No More</title><content type='html'>&lt;p&gt;Today marks my first day back at Oracle Corp. and I find myself in the same boat as Kevin Closson. I&#39;m not saying I&#39;m sitting in the same section mind you, just that I am in the same boat as regards to &lt;a href=&quot;http://kevinclosson.wordpress.com/2009/01/08/oracle-ace-or-oracle-dunceerr-i-mean-deuce/&quot; target=&quot;_blank&quot;&gt;no longer being eligible for the Oracle ACE program&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;I think I have removed the ACE and Director logos as well as text from the appropriate spots, but if I missed a place or two, well, I&#39;ll try to get them removed too!&lt;/p&gt;  &lt;p&gt;As Kevin says, at least there is that vest thing...&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/2082209460397131642'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/2082209460397131642'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/01/oracle-ace-director-no-more.html' title='Oracle ACE Director No More'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-3595084262980621570</id><published>2009-01-11T01:09:00.001+00:00</published><updated>2009-01-11T01:09:17.081+00:00</updated><title type='text'>So, back to Oracle then?</title><content type='html'>&lt;p&gt;Next week will mark the last week at my current location as I have recently decided to return to Oracle Corp.&lt;/p&gt;  &lt;p&gt;I will be going back to the world of C and UNIX derivatives having accepted a position on the non-Windows PLBDE team.&lt;/p&gt;  &lt;p&gt;It&#39;s hard to say what that will mean for the blog here, which has been pretty quiet from my side as of late to be sure, but perhaps I will branch out from my typical topics of ODP.NET and/or Oracle on Windows. We&#39;ll see.&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/3595084262980621570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/3595084262980621570'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2009/01/so-back-to-oracle-then.html' title='So, back to Oracle then?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-5335462373015089876</id><published>2008-11-08T01:12:00.001+00:00</published><updated>2008-11-08T01:12:20.888+00:00</updated><title type='text'>HotSos Symposium 2009</title><content type='html'>&lt;p&gt;The &lt;a href=&quot;http://www.hotsos.com/sym09.html&quot;&gt;HotSos Symposium 2009&lt;/a&gt; is coming up soon. For 2009, the symposium runs from 8 March through to 12 March. This is always one of my favorite conferences of the year, and I will be presenting on &amp;quot;Instrumented Code is Better Code&amp;quot;.&lt;/p&gt;  &lt;p&gt;The conference, as always, features a &lt;a href=&quot;http://www.hotsos.com/sym_speakers.html&quot;&gt;fantastic line-up&lt;/a&gt; this year. I&#39;m particularly interested in the keynote being delivered by &lt;a href=&quot;http://www.hotsos.com/sym_keynote.html&quot;&gt;Chris Date&lt;/a&gt;. In addition, &lt;a href=&quot;http://jonathanlewis.wordpress.com/all-postings&quot;&gt;Jonathan Lewis&lt;/a&gt; will be delivering the training day material. If you have the opportunity to attend this conference, I highly recommend it.&lt;/p&gt;  &lt;p&gt;Now, I&#39;d better get to work!&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/5335462373015089876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/5335462373015089876'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2008/11/hotsos-symposium-2009.html' title='HotSos Symposium 2009'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-1138103105485638179</id><published>2008-10-17T00:27:00.001+00:00</published><updated>2008-10-17T00:31:06.981+00:00</updated><title type='text'>Does ODP.NET Send Data to the Server for Out PL/SQL Parameters?</title><content type='html'>&lt;p&gt;I was recently discussing (and by that I mean trading emails) with a friend about an interesting behavior observed when using PL/SQL &amp;quot;out&amp;quot; VARCHAR2 variables with ODP.NET - in this case it looks like ODP.NET is sending data &lt;em&gt;from&lt;/em&gt; the client and &lt;em&gt;to&lt;/em&gt; the server for a parameter that is defined as &amp;quot;out&amp;quot; in a PL/SQL procedure. This seems like strange behavior and I don&#39;t have a good answer as to why data would be sent from the client to the server for a parameter declared as an &amp;quot;out&amp;quot; parameter.&lt;/p&gt;  &lt;p&gt;In any case here&#39;s a quick and dirty sample that illustrates this (on my test system anyway):&lt;/p&gt;  &lt;h3&gt;PL/SQL Procedure&lt;/h3&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;create or replace procedure ptest (p_vc out varchar2) as     &lt;br /&gt;begin      &lt;br /&gt;&amp;#160; p_vc := rpad (&#39;a&#39;, 31999, &#39;a&#39;);      &lt;br /&gt;end;      &lt;br /&gt;/&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;C# Sample Console&lt;/h3&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;using System;     &lt;br /&gt;using System.Data;      &lt;br /&gt;using System.Data.OracleClient;      &lt;br /&gt;using Oracle.DataAccess.Client;      &lt;br /&gt;using Oracle.DataAccess.Types; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;namespace Miscellaneous {     &lt;br /&gt;&amp;#160; class Program {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; static void Main(string[] args) {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; string constr = &amp;quot;User Id=markwill;&amp;quot; +      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;Password=oracle;&amp;quot; +      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;Data Source=orademo;&amp;quot; +      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;Pooling=false;&amp;quot; +      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;quot;Enlist=false&amp;quot;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; TestODP(constr); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; TestMS(constr); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console.WriteLine();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console.Write(&amp;quot;ENTER to continue...&amp;quot;);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console.ReadLine();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; static void TestODP(string constr) {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Oracle.DataAccess.Client.OracleConnection con = new Oracle.DataAccess.Client.OracleConnection(constr);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; con.Open(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Oracle.DataAccess.Client.OracleCommand cmd = con.CreateCommand(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.CommandText = &amp;quot;alter session set events &#39;10046 trace name context forever, level 12&#39;&amp;quot;;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.ExecuteNonQuery(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.CommandText = &amp;quot;ptest&amp;quot;;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.CommandType = CommandType.StoredProcedure;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.BindByName = true; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Oracle.DataAccess.Client.OracleParameter p_vc = new Oracle.DataAccess.Client.OracleParameter();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; p_vc.ParameterName = &amp;quot;p_vc&amp;quot;;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; p_vc.OracleDbType = OracleDbType.Varchar2;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; p_vc.Size = 32000;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; p_vc.Direction = ParameterDirection.Output; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.Parameters.Add(p_vc); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.ExecuteNonQuery(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console.WriteLine(&amp;quot;p_vc = {0}&amp;quot;, p_vc.Value); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; p_vc.Dispose();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.Dispose();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; con.Dispose();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; static void TestMS(string constr) {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.Data.OracleClient.OracleConnection con = new System.Data.OracleClient.OracleConnection(constr);      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; con.Open(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.Data.OracleClient.OracleCommand cmd = con.CreateCommand(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.CommandText = &amp;quot;alter session set events &#39;10046 trace name context forever, level 12&#39;&amp;quot;;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.ExecuteNonQuery(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.CommandText = &amp;quot;ptest&amp;quot;;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.CommandType = CommandType.StoredProcedure; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.Data.OracleClient.OracleParameter p_vc = new System.Data.OracleClient.OracleParameter();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; p_vc.ParameterName = &amp;quot;p_vc&amp;quot;;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; p_vc.OracleType = OracleType.LongVarChar;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; p_vc.Size = 32000;      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; p_vc.Direction = ParameterDirection.Output; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.Parameters.Add(p_vc); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.ExecuteNonQuery(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Console.WriteLine(&amp;quot;p_vc = {0}&amp;quot;, p_vc.Value); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.Dispose();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; con.Dispose();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }      &lt;br /&gt;&amp;#160; }      &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;This is pretty straight-forward and simply opens a connection, enables Extended SQL Tracing via setting event 10046, creates a parameter for the output value, and calls the stored procedure.&lt;/p&gt;  &lt;p&gt;Looking at the respective trace files I find this for the ODP.NET test:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;PARSING IN CURSOR #4 len=28 dep=0 uid=88 oct=47 lid=88 tim=9306513611 hv=1721325005 ad=&#39;7ff2eca8c38&#39; sqlid=&#39;dk08s2dm9kpfd&#39;     &lt;br /&gt;Begin ptest(p_vc=&amp;gt;:v0); End;      &lt;br /&gt;END OF STMT      &lt;br /&gt;PARSE #4:c=0,e=798,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,tim=9306513607      &lt;br /&gt;&lt;strong&gt;WAIT #4: nam=&#39;SQL*Net more data from client&#39; ela= 48 driver id=1413697536 #bytes=44 p3=0 obj#=-1 tim=9306513786       &lt;br /&gt;WAIT #4: nam=&#39;SQL*Net more data from client&#39; ela= 7 driver id=1413697536 #bytes=24 p3=0 obj#=-1 tim=9306513827        &lt;br /&gt;WAIT #4: nam=&#39;SQL*Net more data from client&#39; ela= 171 driver id=1413697536 #bytes=4 p3=0 obj#=-1 tim=9306514027        &lt;br /&gt;WAIT #4: nam=&#39;SQL*Net more data from client&#39; ela= 28 driver id=1413697536 #bytes=49 p3=0 obj#=-1 tim=9306514085        &lt;br /&gt;&lt;/strong&gt;BINDS #4:      &lt;br /&gt; Bind#0      &lt;br /&gt;&amp;#160; oacdty=01 mxl=32767(32000) mxlc=32000 mal=00 scl=00 pre=00      &lt;br /&gt;&amp;#160; oacflg=03 fl2=1000010 frm=01 csi=178 siz=32767 off=0      &lt;br /&gt;&amp;#160; kxsbbbfp=1c3d8000&amp;#160; bln=32767&amp;#160; avl=32000&amp;#160; flg=05      &lt;br /&gt;&amp;#160; &lt;strong&gt;value=&amp;quot;&amp;#196;6&amp;#191;&amp;#191;&amp;quot;...&lt;/strong&gt;      &lt;br /&gt;WAIT #4: nam=&#39;SQL*Net message to client&#39; ela= 3 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=9306514373      &lt;br /&gt;WAIT #4: nam=&#39;SQL*Net more data to client&#39; ela= 49 driver id=1413697536 #bytes=8216 p3=0 obj#=-1 tim=9306514456      &lt;br /&gt;WAIT #4: nam=&#39;SQL*Net more data to client&#39; ela= 23 driver id=1413697536 #bytes=8192 p3=0 obj#=-1 tim=9306514507      &lt;br /&gt;WAIT #4: nam=&#39;SQL*Net more data to client&#39; ela= 271 driver id=1413697536 #bytes=8192 p3=0 obj#=-1 tim=9306514805      &lt;br /&gt;EXEC #4:c=0,e=1139,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=1,tim=9306514839      &lt;br /&gt;XCTEND rlbk=0, rd_only=1      &lt;br /&gt;WAIT #4: nam=&#39;SQL*Net message from client&#39; ela= 69517 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=9306584449      &lt;br /&gt;XCTEND rlbk=0, rd_only=1&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;As you can see there are several &amp;quot;SQL*Net more data from client&amp;quot; messages. Of course, these are followed by the sending of data to the client.&lt;/p&gt;  &lt;p&gt;Now here is the relevant portion of the trace file for the MS provider test:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;PARSING IN CURSOR #3 len=30 dep=0 uid=88 oct=47 lid=88 tim=9306615423 hv=1003497284 ad=&#39;7ff27721950&#39; sqlid=&#39;42zzxzhxx09u4&#39;     &lt;br /&gt;begin ptest(p_vc=&amp;gt;:p_vc); end;      &lt;br /&gt;END OF STMT      &lt;br /&gt;PARSE #3:c=0,e=1507,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,tim=9306615420      &lt;br /&gt;BINDS #3:      &lt;br /&gt; Bind#0      &lt;br /&gt;&amp;#160; oacdty=01 mxl=32767(32000) mxlc=32000 mal=00 scl=00 pre=00      &lt;br /&gt;&amp;#160; oacflg=03 fl2=1000010 frm=01 csi=178 siz=32767 off=0      &lt;br /&gt;&amp;#160; kxsbbbfp=1c3d8000&amp;#160; bln=32767&amp;#160; avl=00&amp;#160; flg=05      &lt;br /&gt;WAIT #3: nam=&#39;SQL*Net message to client&#39; ela= 3 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=9306615726      &lt;br /&gt;WAIT #3: nam=&#39;SQL*Net more data to client&#39; ela= 69 driver id=1413697536 #bytes=8216 p3=0 obj#=-1 tim=9306615822      &lt;br /&gt;WAIT #3: nam=&#39;SQL*Net more data to client&#39; ela= 18 driver id=1413697536 #bytes=8192 p3=0 obj#=-1 tim=9306615861      &lt;br /&gt;WAIT #3: nam=&#39;SQL*Net more data to client&#39; ela= 200 driver id=1413697536 #bytes=8192 p3=0 obj#=-1 tim=9306616081      &lt;br /&gt;EXEC #3:c=0,e=612,p=0,cr=0,cu=0,mis=0,r=1,dep=0,og=1,tim=9306616112      &lt;br /&gt;XCTEND rlbk=0, rd_only=1      &lt;br /&gt;WAIT #3: nam=&#39;SQL*Net message from client&#39; ela= 60351 driver id=1413697536 #bytes=1 p3=0 obj#=-1 tim=9306676628      &lt;br /&gt;XCTEND rlbk=0, rd_only=1&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;In this case there are no messages from the client and in the bind section there is no &amp;quot;value=&amp;quot; element.&lt;/p&gt;  &lt;p&gt;An interesting wrinkle is that if I set the parameter direction to &amp;quot;ParameterDirection.InputOutput&amp;quot; using ODP.NET I do not observe the sending of data from the client.&lt;/p&gt;  &lt;p&gt;Why, I wonder, does ODP.NET send data to the server for an output parameter? Ideas? Similar behavior observed?&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/1138103105485638179'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/1138103105485638179'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2008/10/does-odpnet-send-data-to-server-for-out.html' title='Does ODP.NET Send Data to the Server for Out PL/SQL Parameters?'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-946657655432619846</id><published>2008-09-25T19:40:00.004+00:00</published><updated>2008-09-25T19:45:17.488+00:00</updated><title type='text'>Oracle Open World 2008 Podcast</title><content type='html'>I&#39;ve never really been a prolific blogger and the &quot;interruption&quot; of OOW 2008 has definitely impacted this. However, my podcast with Tom Haunert of Oracle Magazine is now available at the following location:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://www.oracle.com/technology/syndication/magcasts/index.html&quot;&gt;Oracle Magazine Feature Casts&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The title of the podcast is:&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://streaming.oracle.com/ebn/podcasts/omag/6976727_Mark_Williams_092308.mp3&quot;&gt;Origins of a .NET Developer&lt;/a&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/946657655432619846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/946657655432619846'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2008/09/oracle-open-world-2008-podcast.html' title='Oracle Open World 2008 Podcast'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-2510606966683257326</id><published>2008-08-28T01:54:00.001+00:00</published><updated>2008-08-28T01:54:45.987+00:00</updated><title type='text'>My Current Development Environment</title><content type='html'>&lt;p&gt;Whilst I am primarily a DBA during the day, one of the things that I really enjoy about my current engagement is that it has given me the opportunity to dip my toes back in the development pool a bit. I was describing my current development environment to a friend recently and this person was shocked by the details. I realize that in this day and age of code spitters (term coined by Jeff Richter?) and &amp;quot;click through the wizard for instant coding success&amp;quot; sorts of activities that this environment is something of an anachronism.&lt;/p&gt;  &lt;p&gt;Without further ado, the o/s:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;$ uname -a     &lt;br /&gt;HP-UX zzz B.11.31 U ia64 4131905082 unlimited-user license&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;My &amp;quot;IDE&amp;quot;:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;$ which vi     &lt;br /&gt;/usr/bin/vi&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;And the compiler:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;$ gcc -v     &lt;br /&gt;Using built-in specs.      &lt;br /&gt;Target: ia64-hp-hpux11.31      &lt;br /&gt;Configured with: ../gcc/configure      &lt;br /&gt;Thread model: posix      &lt;br /&gt;gcc version 4.2.1&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Yes, I actually have to do things like create a Makefile in such an environment!&lt;/p&gt;  &lt;p&gt;Joking aside though, one of the things that I firmly believe is that instrumented code is better code. One of the characteristics of this kind of development environment, I feel, is that it really encourages strongly instrumenting the code. Yes, in some circumstances I could use the gdb debugger, but building proper instrumentation into the code and offering a simple switch to enable it (yes, it is in the release build) works very nicely.&lt;/p&gt;  &lt;p&gt;Another thing that some people might find &amp;quot;weird&amp;quot; about this application is that it is a database application (Oracle of course) that contains absolutely no SQL statements. Really. It is a &amp;quot;thick database&amp;quot; application (Toon Koppelaars term?). That is, there are many statements like &amp;quot;begin package.procedure...; end;&amp;quot; in the code. All the real work is done using PL/SQL packages (and bodies) in the database.&lt;/p&gt;  &lt;p&gt;As a .NET developer it is often easy to lean heavily on Visual Studio for debugging, but I think Microsoft also agrees with the &amp;quot;instrumented code is better code&amp;quot; philosophy - check out the System.Diagnostics.Trace class in the Visual Studio Combined Help Collection for more information.&lt;/p&gt;  &lt;p&gt;Lastly, if I&#39;ve misappropriated any of the terms above, apologies!&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/2510606966683257326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/2510606966683257326'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2008/08/my-current-development-environment.html' title='My Current Development Environment'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-438307703782799553</id><published>2008-08-23T01:35:00.001+00:00</published><updated>2008-08-23T01:35:15.263+00:00</updated><title type='text'>Oracle OpenWorld 2008 - Just Say Hi!</title><content type='html'>&lt;p&gt;Just a quick note... if you happen to be coming to Oracle OpenWorld 2008 in San Francisco, I will be helping out in the .NET Hands-On Labs Monday (22 Sep) afternoon. I&#39;ll also be at the &amp;quot;&lt;a href=&quot;http://wiki.oracle.com/page/Oracle+ACE+Office+Hours+in+the+OTN+Lounge?t=anon&quot; target=&quot;_blank&quot;&gt;OTN ACE Office Hours&lt;/a&gt;&amp;quot; on Monday (22 Sep) as well as Thursday (25 Sep). See the link for schedules as well as the great folks who will be available. I&#39;ve also been known to be around the demo grounds booth as well. Please say &amp;quot;hi&amp;quot; if you get the chance! &lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/438307703782799553'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/438307703782799553'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2008/08/oracle-openworld-2008-just-say-hi.html' title='Oracle OpenWorld 2008 - Just Say Hi!'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-5170977328607724173</id><published>2008-07-24T23:41:00.001+00:00</published><updated>2008-07-24T23:41:35.476+00:00</updated><title type='text'>Creating a Windows Service that uses ODP.NET, Oracle Database, a Custom Event Log, and Local Service</title><content type='html'>&lt;p&gt;The steps necessary to create a Windows Service that accesses Oracle Database via ODP.NET and uses the &amp;quot;NT AUTHORITY\LOCAL SERVICE&amp;quot; low-privileged operating system account are not substantially different from the steps necessary to create a service that does not access Oracle Database. As such, the steps below are substantially similar to the steps in the &amp;quot;Walkthrough: Creating a Windows Service Application in the Component Designer&amp;quot; topic available in the Visual Studio Programmer&#39;s Guide for the .NET Framework. You may wish to review this walkthrough in addition to the steps I provide below.&lt;/p&gt;  &lt;p&gt;My goal is to provide the steps necessary to create a (very) simplistic Windows Service that uses the &amp;quot;NT AUTHORITY\LOCAL SERVICE&amp;quot; account to &amp;quot;talk&amp;quot; to Oracle Database. This is by no means an all-encompassing treatment of the topic of using a Windows Service in conjunction with ODP.NET, etc. However, it should provide the minimum amount of information to get started down this path.&lt;/p&gt;  &lt;p&gt;So, without further ado, let&#39;s get started...&lt;/p&gt;  &lt;h3&gt;The Setup&lt;/h3&gt;  &lt;p&gt;Because this solution needs an installer, I am not using an Express Edition of Visual Studio. I&#39;m using Visual Studio 2005 with ODP.NET 11.1.6.20 on a Windows XP Professional machine. This machine will also serve as the deployment target for the installer and is hosting an Oracle 11g Release 1 database.&lt;/p&gt;  &lt;h3&gt;Create the Visual Studio Project&lt;/h3&gt;  &lt;p&gt;1.&amp;#160; Select File -&amp;gt; New -&amp;gt; Project... from the main menu.&lt;/p&gt;  &lt;p&gt;2.&amp;#160; In the New Project dialog expand the Visual C# node under Project types, click the Windows option, select Windows Service in the Templates list, enter OraWinService as the Name, and select an appropriate location (or simply accept the suggested location). The New Project dialog should resemble the following:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh3.ggpht.com/oradim.maw/SIkTFRFks-I/AAAAAAAAAGg/E8SWz4RHLC4/s1600-h/OraWinService013.png&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;167&quot; alt=&quot;OraWinService01&quot; src=&quot;http://lh6.ggpht.com/oradim.maw/SIkTFpuG23I/AAAAAAAAAGk/qUjz4YJUgqs/OraWinService01_thumb1.png?imgmax=800&quot; width=&quot;244&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;3.&amp;#160; Click OK to create the project.&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Add a Reference to the ODP.NET Assembly&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;1.&amp;#160; Select Project -&amp;gt; Add Reference... from the main menu.&lt;/p&gt;  &lt;p&gt;2.&amp;#160; In the Add Reference dialog, scroll down and select Oracle.DataAccess under the Component Name. The dialog should look similar to the following:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh4.ggpht.com/oradim.maw/SIkTF8TXovI/AAAAAAAAAGo/oKKhVY1IzRw/s1600-h/OraWinService026.png&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;197&quot; alt=&quot;OraWinService02&quot; src=&quot;http://lh3.ggpht.com/oradim.maw/SIkTGENJK9I/AAAAAAAAAGs/xrKE6lqCqQs/OraWinService02_thumb2.png?imgmax=800&quot; width=&quot;244&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;3. Click OK to add the reference.&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Set the Service Properties&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;1.&amp;#160; The Service1.cs file should be displayed in the design view. If it is not, right-click the Service1.cs file in the Solution Explorer and select View Designer.&lt;/p&gt;  &lt;p&gt;2.&amp;#160; Ensure the Service1.cs file is selected in the designer by clicking anywhere on the surface &lt;em&gt;except&lt;/em&gt; for on the hyperlinks.&lt;/p&gt;  &lt;p&gt;3.&amp;#160; In the Properties window for Service1.cs, enter OraWinSvcDemo for the (Name) property. Also enter OraWinSvcDemo for the ServiceName property. Set the CanPauseAndContinue property to True. The AutoLog property should also be set to True, which is the default. When complete, the Properties window should resemble:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh5.ggpht.com/oradim.maw/SIkTGcEWmBI/AAAAAAAAAGw/oi1JFyUjqhk/s1600-h/OraWinService033.png&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;244&quot; alt=&quot;OraWinService03&quot; src=&quot;http://lh5.ggpht.com/oradim.maw/SIkTGnM1pJI/AAAAAAAAAG0/RqfDgg8sXH8/OraWinService03_thumb1.png?imgmax=800&quot; width=&quot;229&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Edit the Main Method&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;1.&amp;#160; Double-click the Program.cs file in the Solution Explorer to open it in the editor.&lt;/p&gt;  &lt;p&gt;2.&amp;#160; Replace the auto-created Main method with the following code:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;static void Main() {      &lt;br /&gt;&amp;#160; System.ServiceProcess.ServiceBase[] ServicesToRun;       &lt;br /&gt;&amp;#160; ServicesToRun = new System.ServiceProcess.ServiceBase[] { new OraWinSvcDemo() };       &lt;br /&gt;&amp;#160; System.ServiceProcess.ServiceBase.Run(ServicesToRun);       &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;3.&amp;#160; Select File -&amp;gt; Save All from the main menu and then select File -&amp;gt; Close from the main menu to close the Program.cs file.&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Add an EventLog Component&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;1.&amp;#160; With the Service1.cs file displayed in the design view, expand the Components node in the Toolbox and drag and drop an EventLog component onto the design surface. This will create an instance of the EventLog component named eventLog1.&lt;/p&gt;  &lt;p&gt;2.&amp;#160; If eventLog1 is not selected, left-click it to select. In the Properties window enter OraWinSvcLog for the Log property and enter OraWinSvcSource for the Source property. The Properties window should now look as follows:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh6.ggpht.com/oradim.maw/SIkTG2HZEwI/AAAAAAAAAG4/O7RXfmzWB74/s1600-h/OraWinService04%5B3%5D.png&quot;&gt;&lt;img style=&quot;border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px&quot; height=&quot;244&quot; alt=&quot;OraWinService04&quot; src=&quot;http://lh4.ggpht.com/oradim.maw/SIkTHKoenBI/AAAAAAAAAG8/FT4rme0vQpM/OraWinService04_thumb%5B1%5D.png?imgmax=800&quot; width=&quot;229&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Define the Service Methods&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;1.&amp;#160; Right-click the Service1.cs file in the Solution Explorer and select View Code from the context menu to open the file in the editor.&lt;/p&gt;  &lt;p&gt;2.&amp;#160; Add the following three lines to the end of the &amp;quot;list of using statements&amp;quot;. A timer will be used to periodically trigger an event to write information to the Event Log. The other two lines are boilerplate inclusions for the ODP.NET namespaces.&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;using System.Timers;      &lt;br /&gt;using Oracle.DataAccess.Client;       &lt;br /&gt;using Oracle.DataAccess.Types;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;3.&amp;#160; At the top of the class definition (but outside of any method definitions) add the following (be sure to adjust the Data Source in the connection string as appropriate for your environment). The user will be created later:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;string constr = &amp;quot;User Id=/; Data Source=orademo; Enlist=false&amp;quot;;      &lt;br /&gt;OracleConnection con = null;       &lt;br /&gt;Timer timer1 = null;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;At this time the entire Service1.cs file should contain the following:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;using System;      &lt;br /&gt;using System.Collections.Generic;       &lt;br /&gt;using System.ComponentModel;       &lt;br /&gt;using System.Data;       &lt;br /&gt;using System.Diagnostics;       &lt;br /&gt;using System.ServiceProcess;       &lt;br /&gt;using System.Text;       &lt;br /&gt;using System.Timers;&lt;/font&gt;&lt;font face=&quot;Courier New&quot;&gt;      &lt;br /&gt;using Oracle.DataAccess.Client;       &lt;br /&gt;using Oracle.DataAccess.Types; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;namespace OraWinService {      &lt;br /&gt;&amp;#160; public partial class OraWinSvcDemo : ServiceBase {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; string constr = &amp;quot;User Id=/; Data Source=orademo; Enlist=false&amp;quot;;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; OracleConnection con = null;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Timer timer1 = null; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; public OraWinSvcDemo() {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; InitializeComponent();       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; protected override void OnStart(string[] args) {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // TODO: Add code here to start your service.       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160; protected override void OnStop() {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; // TODO: Add code here to perform any tear-down necessary to stop your service.       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;&amp;#160; }       &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;4.&amp;#160; Change the constructor to the following to create the timer and set the handler function for the timer event:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;public OraWinSvcDemo() {      &lt;br /&gt;&amp;#160; InitializeComponent(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; timer1 = new Timer(); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; timer1.Elapsed += new ElapsedEventHandler(OnTimer);      &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;5.&amp;#160; Add the OnTimer method below the constructor to handle the timer event:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;private void OnTimer(object source, ElapsedEventArgs e) {      &lt;br /&gt;&amp;#160; if (con != null) {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; if (con.State == ConnectionState.Open) {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; OracleCommand cmd = con.CreateCommand();       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.CommandText = &amp;quot;select user, sysdate from dual&amp;quot;;       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; OracleDataReader dr = cmd.ExecuteReader();       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; while (dr.Read()) {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; eventLog1.WriteEntry(String.Format(&amp;quot;User: {0}, Date: {1}&amp;quot;, dr[0].ToString(), dr[1].ToString()));       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; dr.Dispose();      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; cmd.Dispose();       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; con.Close();       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }       &lt;br /&gt;&amp;#160; }       &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;6.&amp;#160; Replace the generated OnStart method with the following which establishes a connection to the database and sets the timer properties (interval of 3 seconds and enables the timer):&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;protected override void OnStart(string[] args) {      &lt;br /&gt;&amp;#160; eventLog1.WriteEntry(&amp;quot;In OnStart&amp;quot;); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; con = new OracleConnection(constr); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; try {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; con.Open();       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; eventLog1.WriteEntry(&amp;quot;Successfully connected to Oracle!&amp;quot;);       &lt;br /&gt;&amp;#160; }       &lt;br /&gt;&amp;#160; catch (OracleException ex) {       &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; eventLog1.WriteEntry(&amp;quot;OracleException: &amp;quot; + ex.Message);       &lt;br /&gt;&amp;#160; } &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; timer1.Interval = 3000;      &lt;br /&gt;&amp;#160; timer1.Enabled = true;       &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;7.&amp;#160; Replace the generated OnStop method with the following code:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;protected override void OnStop() {      &lt;br /&gt;&amp;#160; eventLog1.WriteEntry(&amp;quot;In OnStop&amp;quot;); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; timer1.Enabled = false; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; if (con != null) {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; con.Dispose();       &lt;br /&gt;&amp;#160; }       &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;8.&amp;#160; Add a handler for the OnPause event for the service below the OnStop method:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;protected override void OnPause() {      &lt;br /&gt;&amp;#160; eventLog1.WriteEntry(&amp;quot;In OnPause.&amp;quot;); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; timer1.Enabled = false;      &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;9.&amp;#160; Add a handler for the OnContinue event for the service below the OnPause method:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;protected override void OnContinue() {      &lt;br /&gt;&amp;#160; eventLog1.WriteEntry(&amp;quot;In OnContinue.&amp;quot;); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; timer1.Enabled = true;      &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;10.&amp;#160; Add a handler for the shutdown event below the handler for the OnContinue event:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;protected override void OnShutdown() {      &lt;br /&gt;&amp;#160; eventLog1.WriteEntry(&amp;quot;In OnShutdown&amp;quot;); &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; timer1.Enabled = false; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;&amp;#160; if (con != null) {      &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; con.Dispose();       &lt;br /&gt;&amp;#160; }       &lt;br /&gt;}&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;11.&amp;#160; Select File -&amp;gt; Save All from the main menu to save all work and File -&amp;gt; Close to close the Service1.cs file in the editor.&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Create Installers for the Components&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;1.&amp;#160; Service1.cs should in the design view mode within the editor. If it is not, right-click it in the Solution Explorer and select View Designer from the context menu.&lt;/p&gt;  &lt;p&gt;2.&amp;#160; Create an installer by right-clicking on the design surface and selecting Add Installer from the context menu:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh4.ggpht.com/oradim.maw/SIkTHCU-7qI/AAAAAAAAAHA/9mSl32dOPCE/s1600-h/OraWinService062.png&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;194&quot; alt=&quot;OraWinService06&quot; src=&quot;http://lh4.ggpht.com/oradim.maw/SIkTHb3R2lI/AAAAAAAAAHE/OLNZETOfuPA/OraWinService06_thumb.png?imgmax=800&quot; width=&quot;244&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;3.&amp;#160; After clicking Add Installer, ProjectInstaller.cs will be created and opened in the editor. Click the Service1.cs [Design] tab to switch back to Service1.cs in the editor. Add an installer for the eventLog1 component by right-clicking it and selecting Add Installer from the context menu:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh4.ggpht.com/oradim.maw/SIkTHokIyzI/AAAAAAAAAHI/RuxE2pL3cJU/s1600-h/OraWinService052.png&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;244&quot; alt=&quot;OraWinService05&quot; src=&quot;http://lh5.ggpht.com/oradim.maw/SIkTH8L4CpI/AAAAAAAAAHM/39IE21_Kx8c/OraWinService05_thumb.png?imgmax=800&quot; width=&quot;234&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;4.&amp;#160; After adding the eventLog1 installer, left-click the serviceProcessInstaller1 component to select it. Next select LocalService from the drop-down list:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh4.ggpht.com/oradim.maw/SIkTH79zC9I/AAAAAAAAAHQ/Aod1VqNKmBY/s1600-h/OraWinService072.png&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;244&quot; alt=&quot;OraWinService07&quot; src=&quot;http://lh4.ggpht.com/oradim.maw/SIkTIU3ViYI/AAAAAAAAAHU/tqAhqXsTwL0/OraWinService07_thumb.png?imgmax=800&quot; width=&quot;229&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;5.&amp;#160; Select File -&amp;gt; Save All from the main menu to save all files.&lt;/p&gt;  &lt;p&gt;6.&amp;#160; Select Build -&amp;gt; Build OraWinService from the main menu to build the project, then select File -&amp;gt; Close twice to close the ProjectInstaller.cs and Service1.cs files.&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Create a Setup Project for the Service&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;1.&amp;#160; Select File -&amp;gt; Add -&amp;gt; New Project... from the main menu, in the Project types pane expand the Other Project Types node, select Setup and Deployment, select Setup Project in the Templates list, enter OraWinServiceSetup for the Name, and select an appropriate location (or accept the default supplied value). The Add New Project dialog should look as follows:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh3.ggpht.com/oradim.maw/SIkTIr2XJ9I/AAAAAAAAAHY/Fct1P3-GpaA/s1600-h/OraWinService082.png&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;158&quot; alt=&quot;OraWinService08&quot; src=&quot;http://lh6.ggpht.com/oradim.maw/SIkTJFaY9BI/AAAAAAAAAHc/yTzIO5a1tY4/OraWinService08_thumb.png?imgmax=800&quot; width=&quot;244&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;2.&amp;#160; Click OK to add the setup project to the solution.&lt;/p&gt;  &lt;p&gt;3.&amp;#160; In Solution Explorer, right-click OraWinServiceSetup then select Add -&amp;gt; Project Output... from the context menu. The Add Project Output Group dialog will be displayed:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh3.ggpht.com/oradim.maw/SIkTJUVov2I/AAAAAAAAAHg/xyf6x8P5yRc/s1600-h/OraWinService092.png&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;244&quot; alt=&quot;OraWinService09&quot; src=&quot;http://lh5.ggpht.com/oradim.maw/SIkTJrIlFVI/AAAAAAAAAHk/88YObLTM-PA/OraWinService09_thumb.png?imgmax=800&quot; width=&quot;209&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;4.&amp;#160; Ensure Primary Output is selected and click OK.&lt;/p&gt;  &lt;p&gt;5.&amp;#160; In Solution Explorer, right-click OraWinServiceSetup then select View -&amp;gt; Custom Actions from the context menu to open the custom actions in the editor.&lt;/p&gt;  &lt;p&gt;6.&amp;#160; In the Custom Action editor, right-click Custom Actions and select Add Custom Action... from the context menu:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh6.ggpht.com/oradim.maw/SIkTJmNqwAI/AAAAAAAAAHo/BOG9Vqknma0/s1600-h/OraWinService102.png&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;112&quot; alt=&quot;OraWinService10&quot; src=&quot;http://lh3.ggpht.com/oradim.maw/SIkTJ8mqDEI/AAAAAAAAAHs/Po1S3WVhXZk/OraWinService10_thumb.png?imgmax=800&quot; width=&quot;244&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;7.&amp;#160; In the Select Item in Project dialog, double-click the Application Folder item, then select Primary output from OraWinService (Active), and click OK to add the output to each of the Install, Commit, Rollback, and Uninstall nodes:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh3.ggpht.com/oradim.maw/SIkTKFq1AWI/AAAAAAAAAHw/bScTjKEntb0/s1600-h/OraWinService112.png&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;175&quot; alt=&quot;OraWinService11&quot; src=&quot;http://lh6.ggpht.com/oradim.maw/SIkTKDz08hI/AAAAAAAAAH0/aUl8hgGt-RE/OraWinService11_thumb.png?imgmax=800&quot; width=&quot;244&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;8.&amp;#160; Select File -&amp;gt; Save All from the main menu and then File -&amp;gt; Close for each opened file in the editor.&lt;/p&gt;  &lt;p&gt;9.&amp;#160; Build the setup program by right-clicking OraWinServiceSetup in Solution Explorer and selecting Build from the context menu:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh4.ggpht.com/oradim.maw/SIkTKTphMYI/AAAAAAAAAH4/IfatvxUDHuU/s1600-h/OraWinService122.png&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;244&quot; alt=&quot;OraWinService12&quot; src=&quot;http://lh4.ggpht.com/oradim.maw/SIkTKjHc64I/AAAAAAAAAH8/WWeMHvWzYew/OraWinService12_thumb.png?imgmax=800&quot; width=&quot;97&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Install the Windows Service&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;1.&amp;#160; Using Windows Explorer navigate to the directory where the setup project was built. For example, on my system this is in C:\My Projects\Test\C#\OraWinServiceSetup\Debug directory.&lt;/p&gt;  &lt;p&gt;2.&amp;#160; Install the service by right-clicking the OraWinServiceSetup.msi file and selecting Install from the context menu. Step through the installation wizard to complete the installation.&lt;/p&gt;  &lt;h3&gt;Create the Database User&lt;/h3&gt;  &lt;p&gt;1.&amp;#160; Connect to the database that the service will use as a DBA user and determine the value of the os_authent_prefix parameter:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;SQL&amp;gt; show parameter os_authent_prefix &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;NAME&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; TYPE&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; VALUE      &lt;br /&gt;----------------- ----------- -----       &lt;br /&gt;os_authent_prefix string&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;2. As you can see here I do not have a value for this parameter; therefore, when I create the user I do not use a prefix:&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;SQL&amp;gt; create user &amp;quot;NT AUTHORITY\LOCAL SERVICE&amp;quot; identified externally; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;User created. &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;SQL&amp;gt; grant create session to &amp;quot;NT AUTHORITY\LOCAL SERVICE&amp;quot;; &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font face=&quot;Courier New&quot;&gt;Grant succeeded.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;3.&amp;#160; For more information on creating an Operating System authenticated user, see my earlier post on &lt;a title=&quot;Configuring Windows Authentication&quot; href=&quot;http://oradim.blogspot.com/2007/11/configuring-windows-authentication.html&quot; target=&quot;_blank&quot;&gt;Configuring Windows Authentication&lt;/a&gt;.&lt;/p&gt;  &lt;h3&gt;&lt;strong&gt;Running the Service and Viewing Results&lt;/strong&gt;&lt;/h3&gt;  &lt;p&gt;1.&amp;#160; Open the Services management console by clicking Start -&amp;gt; Administrative Tools -&amp;gt; Services. You can also right-click the My Computer icon on the desktop and select Manage from the context menu.&lt;/p&gt;  &lt;p&gt;2.&amp;#160; Locate the OraWinSvcDemo service in the list of services and click the start button:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh6.ggpht.com/oradim.maw/SIkTK6v5m0I/AAAAAAAAAIA/gh-m7zPUYW4/s1600-h/OraWinService13%5B2%5D.png&quot;&gt;&lt;img style=&quot;border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px&quot; height=&quot;171&quot; alt=&quot;OraWinService13&quot; src=&quot;http://lh6.ggpht.com/oradim.maw/SIkTLCqkkcI/AAAAAAAAAIE/j3pwSuGQiA8/OraWinService13_thumb.png?imgmax=800&quot; width=&quot;244&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;3.&amp;#160; Open the Event Viewer by clicking Start -&amp;gt; Administrative Tools -&amp;gt; Event viewer. Or right-click the My Computer icon on the desktop and select Manage from the context menu (if you have not already done so).&lt;/p&gt;  &lt;p&gt;4.&amp;#160; In the Event Viewer, select OraWinSvcLog by left-clicking it. As the service writes entries to the log every 3 seconds while it is executing, you should see several entries after a 10 seconds or so:&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh5.ggpht.com/oradim.maw/SIkTLdoqDcI/AAAAAAAAAII/7C2C1xiYakQ/s1600-h/OraWinService14%5B2%5D.png&quot;&gt;&lt;img style=&quot;border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px&quot; height=&quot;244&quot; alt=&quot;OraWinService14&quot; src=&quot;http://lh5.ggpht.com/oradim.maw/SIkTLpSNPpI/AAAAAAAAAIM/ZXC9qZ4TCmU/OraWinService14_thumb.png?imgmax=800&quot; width=&quot;220&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;5.&amp;#160; Experiment with the different service states (paused, resume, restart, etc) and verify the entries in the Event Viewer.&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/5170977328607724173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/5170977328607724173'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2008/07/creating-windows-service-that-uses.html' title='Creating a Windows Service that uses ODP.NET, Oracle Database, a Custom Event Log, and Local Service'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/oradim.maw/SIkTFpuG23I/AAAAAAAAAGk/qUjz4YJUgqs/s72-c/OraWinService01_thumb1.png?imgmax=800" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-3708626502653918348</id><published>2008-06-28T21:21:00.001+00:00</published><updated>2008-06-28T21:21:01.978+00:00</updated><title type='text'>Oracle OpenWorld 2008 San Francisco</title><content type='html'>&lt;p&gt;&lt;/p&gt;  &lt;p&gt;It&#39;s hard to believe, but &lt;a href=&quot;http://www.oracle.com/openworld/2008/index.html&quot; target=&quot;_blank&quot;&gt;Oracle OpenWorld 2008&lt;/a&gt; in San Francisco is coming round fast! I will be attending this year and here&#39;s my Oracle Mix profile link (free account required):&lt;/p&gt;  &lt;p&gt;&lt;a title=&quot;Mark Williams Oracle Mix Profile&quot; href=&quot;https://mix.oracle.com/user_profiles/25732-mark-williams&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px&quot; height=&quot;74&quot; alt=&quot;oow_mix_2008&quot; src=&quot;http://lh5.ggpht.com/oradim.maw/SGarPQxRogI/AAAAAAAAAGc/oIe1IeuXS3k/oow_mix_2008%5B3%5D.png?imgmax=800&quot; width=&quot;244&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I&#39;ve been really busy with the day job though I plan to have some more technical content in the near future! I&#39;ve a couple of ideas swimming around that may be interesting as they&#39;re based on real questions.&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/3708626502653918348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/3708626502653918348'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2008/06/oracle-openworld-2008-san-francisco.html' title='Oracle OpenWorld 2008 San Francisco'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/oradim.maw/SGarPQxRogI/AAAAAAAAAGc/oIe1IeuXS3k/s72-c/oow_mix_2008%5B3%5D.png?imgmax=800" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-17554078.post-3958603542091331290</id><published>2008-05-27T23:21:00.001+00:00</published><updated>2008-05-27T23:21:40.816+00:00</updated><title type='text'>Recommended by Joe</title><content type='html'>&lt;p&gt;A friend of mine at Oracle (that is to say Greg is still at Oracle whilst I am not) pointed out to me that Microsoft&#39;s Joe Stagner has Pro .NET Oracle Programming as a recommended book on the &lt;a href=&quot;http://forums.asp.net/57.aspx&quot; target=&quot;_blank&quot;&gt;Oracle - ASP.NET forum&lt;/a&gt;. Currently the recommended books list looks like this (subject to change naturally):&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://lh4.ggpht.com/oradim.maw/SDyXgP__LkI/AAAAAAAAAEA/BAggVyxae3Q/s1600-h/joe_stagner_recommends_me%5B2%5D.png&quot;&gt;&lt;img style=&quot;border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px&quot; height=&quot;244&quot; alt=&quot;joe_stagner_recommends_me&quot; src=&quot;http://lh6.ggpht.com/oradim.maw/SDyXgv__LlI/AAAAAAAAAEI/hn2HLLqqkSU/joe_stagner_recommends_me_thumb.png?imgmax=800&quot; width=&quot;165&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;That got me to thinking a bit. It has been just over 4 years since I started writing that book. (I started the first chapter in March 2004). Certainly a lot has changed since then with several releases of the Oracle Data Provider for .NET, Oracle Database, Visual Studio, the Oracle Developer Tools for Visual Studio .NET, etc. I was just at one of the major booksellers here locally over the weekend and the &amp;quot;computer section&amp;quot; has dwindled immensely. I wonder if it would be worthwhile to update the book? There are several things I would want to change to be sure, but would it be worth it? Do people get their technical information from OTN and MSDN mostly now?&lt;/p&gt;  </content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/3958603542091331290'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/17554078/posts/default/3958603542091331290'/><link rel='alternate' type='text/html' href='http://oradim.blogspot.com/2008/05/recommended-by-joe.html' title='Recommended by Joe'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/oradim.maw/SDyXgv__LlI/AAAAAAAAAEI/hn2HLLqqkSU/s72-c/joe_stagner_recommends_me_thumb.png?imgmax=800" height="72" width="72"/></entry></feed>