Page 1 of 1

Problem accessing Linux DB using Stored Procedures / Windows Works Fine!?

Posted: Sun 02 Jul 2006 21:56
by kidkool345
Hi:

I'm developing a C#.NET web application that will use MySQLDirect.net to access a MySQL database on a Linux system using stored procedures.

I have the identical MySQL database running on Windows without any problems - I can use both mycommand.ExecuteNonQuery and mycommand.ExecuteReader on the Windows System using MySQLDirect.NET

On the Linux box the ExecuteNonQuery works just fine, however I am unable to get any data from the ExecuteReader. (In the debugger I have verified that the connection strings are working!)

This could be caused by me using the wrong commands - or there may be a setting required on the Linux MySQL box before the ExecuteReader will work. (Help!)

I have attached the code that I am using - the ExecuteReader works fine on Windows and it returns data, on Linux it is trapped by the "catch".

If anyone has any suggestions they would be greatly appreciated!

Thanks,

Fred
-----------------------

Code: Select all

public MySqlDataReader memoryctlgetallnew()
        {
            MySqlConnection myConnection = new MySqlConnection();
            myConnection.ConnectionString = "server=90.0.0.26;uid=webserv;pwd=webpass;database=mycsport_dbo;";

            MySqlCommand myCommand = new MySqlCommand("memoryctlgetall", myConnection);

            myCommand.CommandType = CommandType.StoredProcedure;

            try
            {
                myConnection.Open();
                return  myCommand.ExecuteReader(CommandBehavior.CloseConnection);
            }
            catch
            {
                return null;
            };

        }

Posted: Mon 03 Jul 2006 06:59
by Alexey
What is the full version of your MySql database on Linux.
And what is the text of the exception you get? When do you get it?

Problem Solved

Posted: Mon 03 Jul 2006 17:06
by kidkool345
Alexey:

While answering your questions I "tripped" upon the results. Some of my stored procedures had the table names in upper case and some were in lower case. (The tables themselves are all in lower case)

So: The stored procedures all worked fine on Windows since it doesn't care about case. When I called stored procedures that referenced the tables in uppercase I had problems!

Thanks for your help!

Fred

Posted: Tue 04 Jul 2006 06:39
by Alexey
I see. It was next to impossible for us to figure this out.

Posted: Tue 04 Jul 2006 13:39
by kidkool345
Alexey:

This was a tricky one for me too especially since some SP's worked and some did not!

Yesterday I was going to post both the class lib and source code and I'm sure that you would have found it immediately!

For now I'm all set - since the system will use a Linux host I will always connect to a Linux MySQL server during development so some of these case sensitive typos don't sneek into the code!

Thanks for your help - it put me on the right direction to solving the problem!

Fred

Posted: Wed 12 Jul 2006 07:22
by Alexey
You are welcome.