I want to connect up to a database server in my .NET app and execute a database command that produces a series of database statistics. The problem is that it doesn’t return the stats in a structured format, it returns it in plain text (like a df -k command in UNIX) I can capture the output and parse it, but I was wondering if there’s a better approach to something like this.
I certainly can’t think of an alternative, but I wanted to ask around. It seems a little fragile to be parsing the command results because if the database author ever changes the format, I break.
Edit: The database is an IBM UniData database. The command is ‘file.stat’ and it returns the average record size, max record size, etc.
Yes, parse for the description. However, you should check the database version first.
That way if the file.stat data changes, you could call alternate routines.
Note: The file.stat output data has been static for sometime and is unlikely to change.