Start with a database definition
<databaseDefinitions>
<db name="odb">
<connectString>User Id=SWN;Password=satya;Data Source=XE</connectString>
<dataProviderType type="com.ai.db.generic.OracleDataProviderType,Aspire.Net"/>
</db>
<dbalias name="odbalias" dbname="odb"/>
<defaultdbAlias>odbalias</defaultdbAlias>
</databaseDefinitions>
Notes
1. I have defined a database called "odb" pointing to my oracle database called XE
2. The XE name is defined in the tnsnames.ora file which indirectly points to the host name and the port number
3. The data provider class tells the driver to use, in this case oracle.
4. The dbalias allows a level of indirection
5. The defaultdbalias points to the default database to be used
Define a query called GetWells
<request name="GetWells"
type="com.ai.db.generic.GenStoredProcExecutor,Aspire.Net"
commandstring="select * from tab"
params=""
>
</request>
Notes
1. The c# class GenStoredProcExecutor is a general purpose class that can execute stored procs and sql statements to retrieve rows from a database.
Source code to execute
static void testOracle()
{
Hashtable parms = new Hashtable();
ICollection rtn = (ICollection)AppServices.getObject("/request/getwells",parms);
foreach (object o in rtn)
{
Hashtable ht = (Hashtable)o;
foreach (DictionaryEntry e in ht)
{
Console.WriteLine("{0}:{1}",e.Key,e.Value);
}
}
}
satya - Saturday, April 07, 2007 1:36:35 AM
Note: this is the experimental method used by Aspire.net
Note: this is the experimental method used by Aspire.net