First of all: Thanks a lot for bringing this library into existence!
My problem: I had to move code from a linux / debian to a windows machine (XP, mysql 4.1, python 2.4, MySQLdb -1.2.0). Remote access to the debian machine works, but using the local mysql does not. In general, inserting records does not seem to work.
Actually I also had the problem when using the same MySQLdb 1.2 installation from a windows machine and connecting to 1) a local windows MySQL installation and 2) a remote Debian MySQL (4.1.11) installation. For 2) auto commit was left turned on. From what you write I assume that is not the intended behaviour.
As I said my problems are solved; I just thought the above may be of interest to you.
Thanks again,
Bjoern
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for the quick reply - it works fine now.
Out of curiosity, is the windows / debian difference caused by different default settings for autocommit?
Thanks again for your support,
Bjoern
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No. You are probably moving from MySQLdb prior to 1.2.0, which did not turn autocommit on or off (used server default). 1.2.0 turns it off, which is what the DB-API requires. That or you have switch table types to a transaction-safe table like InnoDB.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First of all: Thanks a lot for bringing this library into existence!
My problem: I had to move code from a linux / debian to a windows machine (XP, mysql 4.1, python 2.4, MySQLdb -1.2.0). Remote access to the debian machine works, but using the local mysql does not. In general, inserting records does not seem to work.
Sample code:
cursor.execute("create database newdb")
cursor.execute("use newdb")
cursor.execute("create table t1(name varchar(20))")
cursor.execute("insert into t1values('test')")
This results in a new database + table being created, but the insert is not executed. No error message is generated.
Being rather new to handling databases, I am sure I managed to overlook something trivial, but I just don't know what.
Any input is greatly appreciated!
Thanks,
Bjoern
Actually I also had the problem when using the same MySQLdb 1.2 installation from a windows machine and connecting to 1) a local windows MySQL installation and 2) a remote Debian MySQL (4.1.11) installation. For 2) auto commit was left turned on. From what you write I assume that is not the intended behaviour.
As I said my problems are solved; I just thought the above may be of interest to you.
Thanks again,
Bjoern
Try db.commit() after your insert
Thanks for the quick reply - it works fine now.
Out of curiosity, is the windows / debian difference caused by different default settings for autocommit?
Thanks again for your support,
Bjoern
No. You are probably moving from MySQLdb prior to 1.2.0, which did not turn autocommit on or off (used server default). 1.2.0 turns it off, which is what the DB-API requires. That or you have switch table types to a transaction-safe table like InnoDB.