Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Python Programming Language

MySQL InterfaceError


On 6/5/07, Joe <j@incomps.com> wrote:

Try passing the cursor and not the connection -

 import MySQLdb

 import module_name

 connection = MySQLdb.connect(host='localhost', user='user',
 passwd='password', db='database')

cursor = connection.cursor()
 module = module_name.ClassName(cursor)

You'll probably have to modify the module's code a bit as well, but it
should work.

> Try passing the cursor and not the connection -

Unfortunately this provided the same InterfaceError.  It was one of the
first options we had tried in correcting the situation.  Is there any way to
check on the status of a database connection (like an isOpen() method)?  It
appeared as though the connection (and cursor) would sporadically close upon
passing between modules.

Thanks!

Jough

> Huh the only thing I can find on InterfaceError is "Errors related to
> the database interface and not the database itself." You might be able
> to get some info from connection.info() . . .

Yeah, I wish there was more documentation about this type of error.  The
only thing info() tells me is that the connection is open through id ######.

> Are you using utf8? MySQLdb seems to have some problems with that.
> Also, I assume you've tried catching the error and printing the error
> message, right?

Yes, we are using utf8.  What kind of problems can be seen with it?  This is
all I have run across so far.  What type of encoding would you suggest?  I
am still new at some of this stuff, so if you could possibly explain
(off-topic, so a link is fine) the differences between database encodings I
would be grateful.

And, yes, printing the error message returns absolutely nothing.  The tuple
following InterfaceError is both the error code and message.  Unfortunately,
it will only give me (0, '') which isn't much help.

Thanks again!

Jough

On 6/7/07, Joe <j@incomps.com> wrote:

I really don't know what kinds of errors have cropped up with utf8, or
what encoding you should use. The one utf8 error I saw online was
related to the character_set_name() call - you could try commenting
that out, and all the references to the variable set, and see if your
queries work then.

I don't know if that's your problem or not.

I guess you should go to the MySQLdb site and open a bug report there
or something. Wish I knew enough about it to help you out more, but
really, I just use it, and I've yet to have a problem with it.

On Jun 7, 10:09 am, "Joe" <j@incomps.com> wrote:

> And, yes, printing the error message returns absolutely nothing.  The tuple
> following InterfaceError is both the error code and message.  Unfortunately,
> it will only give me (0, '') which isn't much help.

I'm on Google groups and can't see the first part of your original
message, so don't know what query you are using. But I get that
interface error when I attempt to interpolate values from something
other than a tuple.

E.g.

SELECT item from table where item like %s

If you try to use a string, say, instead of a string in a tuple,
you'll get an interface error.

That's the only time I've gotten it.

rd

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc