[Mono-list] Confusion with ADO connections

Victor B. Putz vputz@nyx.net
Tue, 14 Jan 2003 14:29:52 -0700


I was excited to install the Mono 0.18 rh8 packages, but have some
confusion which I haven't been able to solve.

First, very minor: the rh8 packages install the machine.config file into
/etc/mono/machine.config, but when running the xsp microserver, it looks
for machine.config in /usr/etc/mono/machine.config; not certain why.

Second: When using the xsp microserver, I simply cannot get dbpage2.aspx
to work correctly, but this appears to be a problem with the basic
database connection functionality, not XSP.  The problem with the
database is that somewhere along the way, an exception is being
generated when a connection is opened: "Argument cannot be null".

I wrote a wee little c# program to test this:


      ***
      using System;
      using System.Data;
      //using System.Data.SqlClient;
      using Mono.Data.PostgreSqlClient;

      class SqlTest
        {
          public static void Main ( String[] args )
            {
              PgSqlConnection cnc;
              cnc = new PgSqlConnection();
              string connectionString = "host=localhost;dbname=monotest;user=monotest;password=monotest";
              cnc.ConnectionString = connectionString;

              try
                {
                  cnc.Open();
                }
              catch ( Exception e2 )
                {
                  System.Console.WriteLine( e2.Message );
                }
              System.Console.WriteLine( "Test!" );
            }
        };
      ***

This, of course, simply opens the connection, does nothing with it, and
prints "Test!" --which seems to indicate a connection was successfully
made, at least.  However, when you change the above to

      ***
      using System;
      using System.Data;
      using System.Data.SqlClient;
      //using Mono.Data.PostgreSqlClient;

      class SqlTest
        {
          public static void Main ( String[] args )
            {
              //PgSqlConnection cnc;
              //cnc = new PgSqlConnection();

              SqlConnection cnc;

              string connectionString = "host=localhost;dbname=monotest;user=monotest;password=monotest";

              cnc = new SqlConnection(connectionString);

      //	cnc.ConnectionString = connectionString;

              try
                {
                  cnc.Open();
                }
              catch ( Exception e2 )
                {
                  System.Console.WriteLine( e2.Message );
                }
              System.Console.WriteLine( "Test!" );
            }
        };
      ***

... you get the same exception: "Argument cannot be null"--which is the
same problem I had with dbpage2.aspx.

I have tried modifying dbpage2.aspx to use Mono.Data.PostgreSqlClient
directly (instead of System.Data.SqlClient), with zero luck; since
server.exe (the xsp microserver) doesn't show compilation messages,
diagnosing has been tricky, but it seems to completely disregard any <%@
Import ...@> directives that involve Mono.Data.PostgreSqlClient.

The dbpage1.aspx file, which dynamically loads the
Mono.Data.PostgreSqlClient assembly by brute force, has more luck (it
seems to connect, at least, and is having permission problems, but
that's progress).

It's very confusing.  I'm intrigued by the possibility of .net on Mono,
but since I can't get the database interactivity working, I'm at
something of a loss.  Any suggestions?  Should I stick with manual
loading of the assembly as per dbpage1.aspx?

-->VPutz