[Mono-dev] ASP.NET MySql connection

Dariusz Linowski darlin1 at linbit.pl
Mon Dec 18 05:48:40 EST 2006


Hello,

I've tried use the mono ASP.NET and meet some problem with connection
to mysql database. I created ASP.NET application used VWD tool and try
to run in environment :
mono-core-1.2.2.1, XSP2 (xsp-1.2.1-0), and MySql Connector NET 1.0.8.
I received error:

Description: Error processing request.
Error Message: HTTP 500.
Stack Trace:
System.Data.SqlClient.SqlException: Server does not exist or
connection refused. ---> Mono.Data.Tds.Protocol.TdsInternalException:
Server does not exist or connection refused. --->
System.Net.Sockets.SocketException: Connection refused

  at System.Net.Sockets.Socket.Connect (System.Net.EndPoint
remote_end) [0x00000]

  at Mono.Data.Tds.Protocol.TdsComm..ctor (System.String dataSource,
Int32 port, Int32 packetSize, Int32 timeout, TdsVersion tdsVersion)
[0x00000] --- End of inner exception stack trace ---

  at Mono.Data.Tds.Protocol.TdsComm..ctor (System.String dataSource,
Int32 port, Int32 packetSize, Int32 timeout, TdsVersion tdsVersion)
[0x00000]

  at Mono.Data.Tds.Protocol.Tds..ctor (System.String dataSource, Int32
port, Int32 packetSize, Int32 timeout, TdsVersion tdsVersion)
[0x00000]

  at Mono.Data.Tds.Protocol.Tds70..ctor (System.String server, Int32
port, Int32 packetSize, Int32 timeout) [0x00000]

  at (wrapper remoting-invoke-with-check)
Mono.Data.Tds.Protocol.Tds70:.ctor (string,int,int,int)

  at System.Data.SqlClient.SqlConnection.Open () [0x00000] --- End of
inner exception stack trace ---

  at System.Data.SqlClient.SqlConnection.Open () [0x00000]

  at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet
dataSet, Int32 startRecord, Int32 maxRecords, System.String srcTable,
IDbCommand command, CommandBehavior behavior) [0x00000]

  at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet
dataSet, System.String srcTable) [0x00000]

  at (wrapper remoting-invoke-with-check)
System.Data.Common.DbDataAdapter:Fill (System.Data.DataSet,string)

  at System.Web.UI.WebControls.SqlDataSourceView.ExecuteSelect
(System.Web.UI.DataSourceSelectArguments arguments) [0x00000]



I copied given MySql.Data.dll to the aplication directory and
registered to  to gac using:
gacutil -i Mysql.Data.dll  and see this assemless in /mono /gac


Additionall information.
I tried to use other C# CLI aplication to check the connection, and
noticed that application was working only based on old Conector NET
driver Version=1.0.7.30073.

I checked  connection to mysql via sqlsharp application and received error
too:


SQL# \loadextprovider
MySql.Data,Version=1.0.8.0,Culture=neutral,PublicKeyToken=C5687FC88969C44D
MySql.Data.MySqlCliet.MySqlConnection

SQL# \ConnectionString Server=XXXX.XXXX.XXXX;Database=eriskcdrdb;User
ID=YYYY;Password=VVVVV;Pooling=false

SQL# \Open
Opening connection...
Loading external provider...
Error: unable to load the assembly of the provider:
MySql.Data,Version=1.0.8.0,Culture=neutral,PublicKeyToken=C5687FC88969C44D
: Argument cannot be null.
Parameter name: type


sqlsharp connection was working only when is based on:

Assembly: MySql.Data, Version=1.0.7.30073, Culture=neutral,
PublicKeyToken=8e323390df8d9ed4
  Connection Class: MySql.Data.MySqlClient.MySqlConnection


What is wrong?  I'm new in mono and maybe there is my misunderstanding
or misconfiguration?   Could someone give me some advice ?

Below you can find ASP.NET application files: Default.aspx  and web.config



-------- ----------------------------------------
Default.aspx
------------------------------------------
     ---------------

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

        <asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" BackColor="LightGoldenrodYellow"

            BorderColor="Tan" BorderWidth="1px" CellPadding="2"
DataSourceID="SqlDataAster"

            ForeColor="Black" GridLines="None">

            <FooterStyle BackColor="Tan" />

            <Columns>

                <asp:BoundField DataField="calldate"
HeaderText="calldate" SortExpression="calldate" />

                <asp:BoundField DataField="clid" HeaderText="clid"
SortExpression="clid" />

                <asp:BoundField DataField="src" HeaderText="src"
SortExpression="src" />

                <asp:BoundField DataField="dst" HeaderText="dst"
SortExpression="dst" />

                <asp:BoundField DataField="dcontext"
HeaderText="dcontext" SortExpression="dcontext" />

                <asp:BoundField DataField="channel"
HeaderText="channel" SortExpression="channel" />

                <asp:BoundField DataField="dstchannel"
HeaderText="dstchannel" SortExpression="dstchannel" />

                <asp:BoundField DataField="lastapp"
HeaderText="lastapp" SortExpression="lastapp" />

                <asp:BoundField DataField="lastdata"
HeaderText="lastdata" SortExpression="lastdata" />

                <asp:BoundField DataField="duration"
HeaderText="duration" SortExpression="duration" />

                <asp:BoundField DataField="billsec"
HeaderText="billsec" SortExpression="billsec" />

                <asp:BoundField DataField="disposition"
HeaderText="disposition" SortExpression="disposition" />

                <asp:BoundField DataField="amaflags"
HeaderText="amaflags" SortExpression="amaflags" />

                <asp:BoundField DataField="accountcode"
HeaderText="accountcode" SortExpression="accountcode" />

                <asp:BoundField DataField="uniqueid"
HeaderText="uniqueid" SortExpression="uniqueid" />

                <asp:BoundField DataField="userfield"
HeaderText="userfield" SortExpression="userfield" />

            </Columns>

            <SelectedRowStyle BackColor="DarkSlateBlue"
ForeColor="GhostWhite" />

            <PagerStyle BackColor="PaleGoldenrod"
ForeColor="DarkSlateBlue" HorizontalAlign="Center" />

            <HeaderStyle BackColor="Tan" Font-Bold="True" />

            <AlternatingRowStyle BackColor="PaleGoldenrod" />

        </asp:GridView>




      <asp:SqlDataSource ID="SqlDataAster" runat="server"
ConnectionString="Server=localhost; Database=eriskcdrdb; User ID=XXX;
Password=YYY; Pooling=false"

            ProviderName="MySql.Data.MySqlClient"
SelectCommand="SELECT * FROM cdr"></asp:SqlDataSource>



    </div>

    </form>

</body>

</html>


---------------------------------
---------------------------------
web.config
----------------------------------              -------------


<?xml version="1.0"?>

<!--

    Note: As an alternative to hand editing this file you can use the

    web admin tool to configure settings for your application. Use

    the Website->Asp.Net Configuration option in Visual Studio.

    A full list of settings and comments can be found in

    machine.config.comments usually located in

    \Windows\Microsoft.Net\Framework\v2.x\Config

-->

<configuration>

        <appSettings/>

        <connectionStrings/>

        <system.web>

                <!--

            Set compilation debug="true" to insert debugging

            symbols into the compiled page. Because this

            affects performance, set this value to true only

            during development.

        -->

                <compilation debug="false">

                        <assemblies>

                                <add assembly="MySql.Data,
Version=1.0.8.0, Culture=neutral,
PublicKeyToken=C5687FC88969C44D"/></assemblies></compilation>

                <!--

            The <authentication> section enables configuration

            of the security authentication mode used by

            ASP.NET to identify an incoming user.

        -->

                <authentication mode="Windows"/>

                <!--

            The <customErrors> section enables configuration

            of what to do if/when an unhandled error occurs

            during the execution of a request. Specifically,

            it enables developers to configure html error pages

            to be displayed in place of a error stack trace.




        <customErrors mode="RemoteOnly" defaultRedirect="
GenericErrorPage.htm">

            <error statusCode="403" redirect="NoAccess.htm" />

            <error statusCode="404" redirect="FileNotFound.htm" />

        </customErrors>

        -->

        </system.web>

</configuration>


-- 
Pozdrawiam,
Dariusz Linowski
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20061218/2f280490/attachment.html 


More information about the Mono-devel-list mailing list