Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: How to connect to an Oracle DB in .NET

Re: How to connect to an Oracle DB in .NET

From: Niall Litchfield <n-litchfield_at_audit-commission.gov.uk>
Date: Fri, 20 Feb 2004 11:18:42 -0000
Message-ID: <4035ed13$0$7066$ed9e5944@reading.news.pipex.net>


Hi

that will get you an OLEDB connection, which may be fine. You could also consider using one of the 2 free Native .Net providers available from oracle and microsoft. These ought to be more efficient and in the case of the Oracle provider give you nice things like array operations and support for lobs etc.

http://www.connectionstrings.com/ is a handy resource for queries like yours.

-- 
Niall Litchfield
Oracle DBA
Audit Commission UK
"AVS" <nor_at_nor.es> wrote in message news:4035D1AC.874B2943_at_nor.es...

> Hi,
>
> I´ve got it (arf, arf, ....)
>
> This is the Connection String to connect to an Oracle DB in a remote
> server, in :NET:
>
> ConnectionString = "Provider=msdaora;Data
> Source=MyOracleBD;Server=xxx.xxx.xxx.xxx;Port=yyyy;User
> ID=user_id;Password=password;"
>
> So, a complete code to connect and get data from a DB would be:
>
> public DataSet GetData()
> {
> DataSet ds = new DataSet("Data");
>
> try
> {
> string command_string, connection_string;
>
> connection_string = "Provider=msdaora;Data
> Source=MyOracleBD;Server=xxx.xxx.xxx.xxx;Port=x;User
> ID=user_id;Password=password;"
>
> command_string = "SELECT column01,column02 FROM table WHERE
> condition";
>
> OleDbConnection conn = new OleDbConnection(connection_string);
> conn.Open();
>
> //Apply Select
> OleDbDataAdapter adapter = new OleDbDataAdapter( command_string,
> conn);
> adapter.Fill(ds);
>
> //Close connection
> conn.Close();
> }
> catch(OleDbException oe)
> {
> string strerror;
>
> strerror = oe.Message;
> ds = null;
> }
>
> return ds;
> }
>
> //***********************************************
>
> OK, I've not discovered America, but I was no able to find any thing in
> Inet (for a remote server case), and testing, testing... it worked!
>
> --
> Regards
>
> Alfonso
>
Received on Fri Feb 20 2004 - 05:18:42 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US