[Mono-list] MySQL Data Provider for MySQL (Mono 0.17)

Steven Balthazor stevenbalthazor@hotmail.com
Sat, 4 Jan 2003 14:57:03 -0700


I tried adding the line:
<dllmap dll="libmySQL" target="libmysqlclient.so" />

I tried deleting the line:
<dllmap dll="libmySQL.dll" target="libmysqlclient.so" />

None of these options seemed to work on linux; is there an "somap" option
for the config file?  It would seem that I need to map libmySQL.so to
libmysqlclient.so....

Thanks,
Steven Balthazor

-----Original Message-----
From: Daniel Morgan [mailto:danmorg@sc.rr.com] 
Sent: Saturday, January 04, 2003 12:33 PM
To: Steven Balthazor; mono-list@ximian.com
Subject: RE: [Mono-list] MySQL Data Provider for MySQL (Mono 0.17)


If i recall correctly, the MySQL client library on Linux does not have
thread support built-in by default.   This is why the thread functions are
not loading because they don't exist.

On Windows, the client library is libmySQL.dll
On Linux, the client library is libmysqlclient.so

For each p/invoke function into the MySQL client library, it has a DllImport
using "libmySQL".

For example, here is the DllImport for the Connect() method which p/invokes
mysql_connect().

[SuppressUnmanagedCodeSecurity]
[DllImport("libmySQL",
	 CharSet=System.Runtime.InteropServices.CharSet.Ansi,
	 EntryPoint="mysql_connect", ExactSpelling=true)]
public static extern IntPtr Connect(IntPtr db,
	[In] string host, [In] string user, [In] string passwd,
	[In] string dbname,
	uint port, [In] string socketName, uint flags
);

In the MONO_INSTALL_PATH/etc/mono/config file, you have for the MySQL client
library:
<dllmap dll="libmySQL.dll" target="libmysqlclient.so" />

You could try adding the line:
<dllmap dll="libmySQL" target="libmysqlclient.so" />

Or even removing the orginal line.

The etc/mono/config file is platform dependent.  This means for each
platform this file maybe different.

-----Original Message-----
From: Steven Balthazor [mailto:stevenbalthazor@hotmail.com]
Sent: Saturday, January 04, 2003 2:05 PM
To: 'Daniel Morgan'; mono-list@ximian.com
Subject: RE: [Mono-list] MySQL Data Provider for MySQL (Mono 0.17)


For whatever reason, it appeared to be looking for a libmySQL.so; however my
installation did not have such a beast...

Here is what I have (a Redhat 7.3 installation--I used the Mysql rpms not
the redhat rpms...)

[root@devserver root]# rpm -qa | grep -i mysql MySQL-python-0.9.1-1
MySQL-devel-3.23.54a-1 MySQL-shared-3.23.54a-1 Mnogosearch-mysql-3.1.20-1
MySQL-3.23.54a-1 MySQL-client-3.23.54a-1 php-mysql-4.1.2-7.3.6
MySQL-Max-3.23.54a-1

For testing purposes here is what I did:
 cd /usr/lib
 rm libmySQL.so (its only a link)
 cd /usr2/csharp  (where I copied the .cs file)
 mcs TestMySqlExecuteReader.cs -r System.Data.dll -r Mono.Data.MySql.dll
mono TestMySqlExecuteReader.exe Started. Create MySQL Connection...

** (TestMySqlExecuteReader.exe:23470): WARNING **: Failed to load library
libmySQL (libmySQL): libmySQL.so: cannot open shared object file: No such
file or directory

Open the connection...
Unhandled Exception: System.NullReferenceException: Object reference not set
to an instance of an object in <0x00025> 06 Mono.Data.MySql.MySql:Init
(intptr) in <0x00187> 00 Mono.Data.MySql.MySqlConnection:Open () in
<0x000f5> 00 TestSystemDataSqlClient.TestSqlDataReader:Main (string[])

Now if I:
 cd /usr/lib
 ln -s libmysqlclient.so libmySQL.so
 mono TestMySqlExecuteReader.exe
Output:
 Started.
Create MySQL Connection...

** (TestMySqlExecuteReader.exe:23552): WARNING **: Failed to load function
my_thread_end from libmySQL

** (TestMySqlExecuteReader.exe:23552): WARNING **: Failed to load function
my_thread_end from libmySQL

** (TestMySqlExecuteReader.exe:23552): WARNING **: Failed to load function
my_thread_init from libmySQL

** (TestMySqlExecuteReader.exe:23552): WARNING **: Failed to load function
my_thread_init from libmySQL Open the connection... select * from testable
Create command... ExecuteReader... Reading data...
Row: 1
{all the expected and correct data follow}
Clean up...

Unhandled Exception: System.NullReferenceException: Object reference not set
to an instance of an object in <0x00025> 06 Mono.Data.MySql.MySql:ThreadEnd
() in <0x000b5> 00 Mono.Data.MySql.MySqlConnection:CloseDataSource () in
<0x00053> 00 Mono.Data.MySql.MySqlConnection:Close () in <0x00411> 00
TestSystemDataSqlClient.TestSqlDataReader:Main (string[])

HTH,
Steven Balthazor
-----Original Message-----
From: Daniel Morgan [mailto:danmorg@sc.rr.com]
Sent: Saturday, January 04, 2003 2:28 AM
To: Steven Balthazor; 'Rolf Tollerud'; mono-list@ximian.com
Subject: RE: [Mono-list] MySQL Data Provider for MySQL (Mono 0.17)


Hmmm...   I'm not sure.

What version of the MySQL client library are you using?  Where did you get
it?

The MySQL provider in mono was built for the Production version of MySQL
3.23.xx.

I wonder if there is a tracing or debugging mechanism in mono we could use
to see what it is doing.

-----Original Message-----
From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com]On
Behalf Of Steven Balthazor
Sent: Friday, January 03, 2003 3:36 PM
To: 'Rolf Tollerud'; mono-list@ximian.com
Subject: RE: [Mono-list] MySQL Data Provider for MySQL (Mono 0.17)


I had a similar problem (if I remember correctly).  To get it to compile
correctly on Linux I had to add a link from /usr/lib/libmysqlclient.so to
/usr/lib/libmySQL.so e.g.: ln -s libmysqlclient.so libmySQL.so

Cheers,
Steven Balthazor

-----Original Message-----
From: mono-list-admin@ximian.com [mailto:mono-list-admin@ximian.com] On
Behalf Of Rolf Tollerud
Sent: Friday, January 03, 2003 1:02 PM
To: mono-list@ximian.com
Subject: [Mono-list] MySQL Data Provider for MySQL (Mono 0.17)


When I try to run MySqlTest (which compiles just fine) on windows XP I get
following error messages:

(mono MySqlTest.exe)

** (MySqlTest.exe:3924): WARNING **: Failed to load function mysql_connect
from libmySQL

** (MySqlTest.exe:3924): WARNING **: Failed to load function mysql_connect
from libmySQL

Unhandled Exception: System.NullReferenceException: Object reference not set
to an instance of an object in <0x00025> 06 Mono.Data.MySql.MySql:Connect
(intptr,string,string,string,string,uint,string,uint)
in <0x003e6> 00 Mono.Data.MySql.MySqlConnection:Open ()
in <0x00057> 00 Test.Mono.Data.MySql.MySqlTest:Main (string[])

Why will it not load mysql_connect? Apparently its loads all the other
functions from libmySQL.dll..




_______________________________________________
Mono-list maillist  -  Mono-list@ximian.com
http://lists.ximian.com/mailman/listinfo/mono-list