using System; using System.Data.Common; namespace OdpTest { class Program { static void Main(string[] args) { string connectionString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)" + "(HOST=MYHOST)(PORT=1527))(CONNECT_DATA=(SID=MYSERVICE)));" + "User Id=MYUSER;Password=MYPASS;"; string provider = "Oracle.DataAccess.Client.OracleConnection, Oracle.DataAccess"; using (DbConnection conn = (DbConnection)Activator. CreateInstance(Type.GetType(provider), connectionString)) { conn.Open(); string sql = "select distinct owner from sys.all_objects order by owner"; using (DbCommand comm = conn.CreateCommand()) { comm.CommandText = sql; using (DbDataReader rdr = comm.ExecuteReader()) { while (rdr.Read()) { string owner = rdr.GetString(0); Console.WriteLine("{0}", owner); } } } } } } }
Thanks for reading! And if you want to get in touch, I'd love to hear from you: chris.hulbert at gmail.
(Comp Sci, Hons - UTS)
Software Developer (Freelancer / Contractor) in Australia.
I have worked at places such as Google, Cochlear, Assembly Payments, News Corp, Fox Sports, NineMSN, FetchTV, Coles, Woolworths, Trust Bank, and Westpac, among others. If you're looking for help developing an iOS app, drop me a line!
Get in touch:
[email protected]
github.com/chrishulbert
linkedin