Найти - Пользователи
Полная версия: Jython, mysql, insert
Начало » Python для Java » Jython, mysql, insert
1
helm2004
Доброго времени суток!

Есть такой код (написан на коленке):
from com.ziclix.python.sql import zxJDBC
def mySQLConn():
    try:
        d, u, p, v = "jdbc:mysql://localhost:8889/gavno", 'root', 'root', "org.gjt.mm.mysql.Driver"
        db = zxJDBC.connect(d, u, p, v)
        curr = db.cursor()
        curr.execute("INSERT INTO `gavno`.`first` (`id`, `Name`) VALUES (2, 'ghfghfghfghf')")
    finally:
        db.close()
mySQLConn()

И в таблицу, почему то ничего не вставляет. Почему?
Singularity
helm2004
а шо трай выполнился?
helm2004
Как ни странно, да.
helm2004
Сам написал сам отвечу:

 db.commit()

Надо делать. Спасибо за ответы!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB