title: C# connection to Oracle database
body: <p>I have been doing applications on Java, connected with MySQL, but now I am doing C# with Oracle. 
  Here is the code I've got so far:</p>
  
  <pre><code>using System.Data.OracleClient;
  
  namespace Chat
  {
      class DBconnector
      {
          static private string GetConnectionString()
          {
              return "Data Source=myserver.server.com;Persist Security Info=True;" +
                  "User ID=myUserID;Password=myPassword;Unicode=True";
          }
          static public void ConnectAndQuery()
          {
  
              string connectionString = GetConnectionString();
              using(OracleConnection conn = new OracleConnection())
              {
                  conn.ConnectionString = connectionString;
                  conn.Open();
                  Console.WriteLine("State: " + conn.State);
                  Console.WriteLine("Connction String: " + conn.ConnectionString);
  
                  OracleCommand command = conn.CreateCommand();
                  string sql = "SELECT * FROM users";
                  command.CommandText = sql;
  
                  OracleDataReader reader = command.ExecuteReader();
                  while(reader.Read())
                  {
                      string myField = (string)reader["MYFIELD"];
                      Console.WriteLine(myField);
                  }
              }
  
          }
  
      }
  }
  </code></pre>
  
  <p>What is hacking me is that I don't know what to type in exchange of "myserver.server.com", "myUserID" and the "myPassword" in the connectionString. 
  I suppose it's "localhost/" and smth like that, but with Oracle I don't really have the same visual interface as with MySQL in the browser and thus I am kinda' lost.</p>
  
  <p>I followed this tutorial: <a href="http://www.codeproject.com/Articles/18692/Instant-Oracle-Using-C" rel="nofollow">Instant Oracle using C#</a>
  and I am doing the case with including the connection String directly in my code, but not using the tsanames.ora external file. 
  Long story short -> I am not sure how to modify the connection string for my own database and if there are any other mistakes or suggestions - feel free to state them.</p>