Mimer SQL Data Provider
Concepts
Mimer SQL Data Provider > Overview > Concepts

The Mimer SQL Data Provider is used to gain access to Mimer SQL database servers. The mechanism for doing this, is by specifying a ConnectionString for the MimerConnection object. The connection string contains information about which database to access and information where this database is located. To access a database on another node you specify a protocol=tcp or protocol=NamedPipes and the name of the node: node=NetworkNodeName. To access a database on the local node you specify protocol=local. When the connection string is complete you call the Open method.

To send SQL commands to the database server the MimerCommand class is used. If the SQL statement is a SELECT statement the MimerDataReader is used to retrieve the data from the server. A MimerDataReader is created by calling the ExecuteReader method on the MimerCommand object.

When processing is complete a connection is closed by the calling MimerConnection.Close method. Here is a simple example starting with the SQL to create a simple table:

create table persons(id int, address nvarchar(30));

And the following code:

string connectionString = "Database=exampledb;protocol=tcp;node=dbnode;user id=devuser;password=devpass";
using (MimerConnection conn = new MimerConnection(connectionString)) {
     conn.Open();
     MimerCommand comm1 = new MimerCommand( "select id,address from persons", conn);
     //
    
// Create a data reader to retrieve the rows from the database
     //
    
MimerDataReader reader = comm1.ExecuteReader();
     while (reader.Read()) {
          //
          //  Display content of row on console
          //
          Console.WriteLine("Id: {0} Address: {1}", reader.GetInt32(1), reader.GetString(2));          
    
}
     reader.Close();
}

The connection string specifies which database server to use and which node in the network it is located on. The using-clause always closes the connection when the scope is left.

See Also