For simplicity, i wrote a test.php:
$DBConnect = DB::getConnection("Buy");
$SQL = "INSERT INTO PlanInfo (PlanName ) VALUES ('test')";
$Result = $DBConnect->execute($SQL);
if($Result)
{
echo "donen";
$ID = $DBConnect->Insert_ID();
echo "Insert_ID is $ID ";
}
else
{
echo "fail";
}
if connecting to mysql directly , it works.
but if connector , it failed. error msg is:
INFO | jvm 1 | 2009/08/15 15:08:38 | WARN [MySQLProtocolHandler] - Can't get
last insert id.
INFO | jvm 1 | 2009/08/15 15:08:38 | java.sql.SQLException: Generated keys
not requested. You need to specify Statement.RETURN_GENERATED_KEYS to
Statement.executeUpdate() or Connection.prepareStatement().
.....
com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
INFO | jvm 1 | 2009/08/14 16:55:30 | at
com.mysql.jdbc.StatementImpl.getGeneratedKeys(StatementImpl.java:1843)
INFO | jvm 1 | 2009/08/14 16:55:30 | at
org.continuent.myosotis.protocol.mysql.MySQLProtocolHandler.getLastInsertId(MySQ
LProtocolHandler.java:942)
........
and here are my JDBC options:
jdbc.driver.options =
?zeroDateTimeBehavior=convertToNull&emptyStringsConvertToZero=true&
jdbcCompliantTruncation=false&alwaysGetGeneratedKeys=true
It seems that "alwaysGetGeneratedKeys=true" doesn't work?
Any suggestion will be appreciate. Thanks.
_______________________________________________
Sequoia mailing list
[email protected]
http://forge.continuent.org/mailman/listinfo/sequoia