Thursday, December 11, 2008

Oracle TimesTen - Exploration and .NET story. Part 2.

As this evening was exclusively about reading on the subject, only got to add few lines of code to see what is in the sys.monitor table.

The code:

using System;
using System.Data.Odbc;
using System.Text;
 
namespace OdbcConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
 
                using (OdbcConnection connection = new OdbcConnection("dsn=tttest"))
                {
                    OdbcCommand command = new OdbcCommand("SELECT * FROM SYS.MONITOR", connection);
 
                    connection.Open();
 
                    using (OdbcDataReader reader = command.ExecuteReader())
                    {
                        StringBuilder sb = new StringBuilder();
 
                        while (reader.Read())
                        {
                            for (int i = 0; i < reader.FieldCount; i++)
                            {
                                sb.Append(reader.GetName(i)).Append(":").Append(reader[i]).Append(Environment.NewLine);
                            }
 
                            Console.WriteLine(sb.ToString());
                            
 
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            Console.WriteLine("Press any key to exit");
            Console.Read();
        }
    }
}

That was just to prove that it is as easy as expected. The actual output is:

TIME_OF_1ST_CONNECT:Thu Dec 11 00:07:44 2008
DS_CONNECTS:7
DS_DISCONNECTS:0
DS_CHECKPOINTS:0
DS_CHECKPOINTS_FUZZY:0
DS_COMPACTS:0
PERM_ALLOCATED_SIZE:4096
PERM_IN_USE_SIZE:1552
PERM_IN_USE_HIGH_WATER:1552
TEMP_ALLOCATED_SIZE:7168
TEMP_IN_USE_SIZE:4122
TEMP_IN_USE_HIGH_WATER:4185
SYS18:0
XACT_BEGINS:2
XACT_COMMITS:1
XACT_D_COMMITS:0
XACT_ROLLBACKS:0
LOG_FORCES:0
DEADLOCKS:0
LOCK_TIMEOUTS:0
LOCK_GRANTS_IMMED:15
LOCK_GRANTS_WAIT:0
SYS19:0
CMD_PREPARES:1
CMD_REPREPARES:0
CMD_TEMP_INDEXES:0
LAST_LOG_FILE:0
REPHOLD_LOG_FILE:-1
REPHOLD_LOG_OFF:-1
REP_XACT_COUNT:0
REP_CONFLICT_COUNT:0
REP_PEER_CONNECTIONS:0
REP_PEER_RETRIES:0
FIRST_LOG_FILE:0
LOG_BYTES_TO_LOG_BUFFER:56
LOG_FS_READS:0
LOG_FS_WRITES:0
LOG_BUFFER_WAITS:0
CHECKPOINT_BYTES_WRITTEN:0
SYS1:1
SYS2:1
SYS3:0
SYS4:0
SYS5:0
SYS6:0
SYS7:0
SYS8:0
REQUIRED_RECOVERY:0
SYS11:0
SYS12:1
TYPE_MODE:0
SYS13:0
SYS14:0
SYS15:0
SYS16:0
SYS17:0
SYS9:

Post a Comment