hello all,
for few days i have been trying to connect with my oracle 9i database with visual studio 2005 using c#.
i tried all the processes that i found in internet.
but i fail to connect with my oracle database.
i have service named GLOBAL
USERNAME: first
password: first
in oracle.
can someone help me???

I think there are some usernames and passwords for Oracle Database configured for first use like username: scott password: tiger and so on, to connect easily like SQL Server to Oracle from VS you need ODP (Oracle Data Provider) libraries on www.oracle.com

ok I give you some code to perform you task

//To connect to an oracle data base you can use the oledb provider

using System.Data;
using System.OleDb;

OleDbConnection oConnection = new OleDbConnection(("Provider=MSDAORA.1;UserID=scott;password=tiger; database=dbname");

try
{
oConnection.Open();
OleDbCommand oCommand = new OleDbCommand("Select * From Table", oConnection);
DataTable oTable = new DataTable();
OledbDataAdapter oAdapter = new OleDbDataAdapter(oCommand);
oAdapter.Fill(oTable);

}
catch(OleDbException caught)
{MessageBox.Show(caught.message);}
finally
{
oConnection.Close();
}

You can connect directly to the data base using the OleDbDataReader object instead

Of Corse, you have to check if you have permissions to access, read, write, update ... an oracle data base before

I think there are some usernames and passwords for Oracle Database configured for first use like username: scott password: tiger and so on, to connect easily like SQL Server to Oracle from VS you need ODP (Oracle Data Provider) libraries on www.oracle.com

No, that account is disabled by default for security reasons.
In fact ALL accounts except the system account(s) are disabled by default.

http://www.oracle.com/technology/tech/dotnet/index.html will provide you with the tools you need as well as tutorials for using .NET technology with Oracle.

You will of course need an OTN account to access most of it.

This article has been dead for over six months. Start a new discussion instead.