- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在为一个不太流行的 mmorpg 游戏编写一个 server-emu 软件,我正在使用 mysql connector for c++ 连接我的数据库。在我重新安装 Windows(和我的整个开发环境)后,我遇到了一个奇怪的 mysql 连接器异常。
我用来连接数据库的代码如下所示:
try
{
this->driver = get_driver_instance();
std::cout << "SQL Driver Name: " << this->driver->getName() << std::endl;
std::cout << "Connecting as " << user << "@" << host << " using password " << password << std::endl;
this->connection = this->driver->connect(host, user, password);
std::cout << "Setting schema to " << schema << std::endl;
this->connection->setSchema(schema);
} catch(sql::SQLException &e)
{
std::cout << "# ERR: SQLException in " << __FILE__;
std::cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << std::endl;
std::cout << "# ERR: " << e.what();
std::cout << " (MySQL error code: " << e.getErrorCode();
std::cout << ", SQLState: " << e.getSQLState() << " )" << std::endl;
return 1;
}
(所有变量如用户、密码等都是 std::strings)
这之前是有效的,但现在它在控制台中打印:
SQL Driver Name: MySQL Connector C++ (libmysql)
Connecting as root@tcp://localhost:3306 using password testpassword
Setting schema to testschema
ERR: SQLException in c:\whatever\db.cpp on line 22
ERR: MySQL_Connection::setReadOnly() (MySQL error code: 0, SQLState: )
没有这一行:
this->connection->setSchema(schema);
一切正常。
我不知道如何解决这个问题,也不知道为什么会这样。请帮忙。
最佳答案
我有一个类似的问题,虽然在 Debian Wheezy 上,版本 1.1.0-4+b1:
使用示例:
sql::Connection *con;
con->setSchema(mysql_schema);
抛出:
MySQL_Connection::setReadOnly()
通过将 Connector/C++ 1.1.0-4+b1 替换为 1.1.5,它不再引发此错误。
关于c++ - 用于 C++ 的 MySQL 连接器 | setSchema 上的 MySQL_Connection::setReadOnly() 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28462633/
我有 Multi-Tenancy 应用程序,要进行数据库迁移,我必须遍历每个租户模式并迁移它,但是当我在我的代码中使用 flyway.setSchema() 时,它会发出弃用警告. 它的替代品是什么?
本文整理了Java中org.eclipse.persistence.oxm.XMLMarshaller.setSchema()方法的一些代码示例,展示了XMLMarshaller.setSchema(
我很难找出简单 classes 的正确模式(以验证结构和数据类型) .例如,我可以使用 schemagen(随 JDK 提供)为 Employee 类获得答案,但仍然无法让它为 HumanResour
本文整理了Java中org.apache.tuscany.sca.xsd.XSDefinition.setSchema()方法的一些代码示例,展示了XSDefinition.setSchema()的具
嗨,我看到了一些与此相关的问题,但没有找到任何解决方案。 我有一个 POJO 类定义为: MpsPojo.java public class MpsPojo { private Stri
我有一个连接数据库的简单练习。有两种方法,一种加载一批 Person 对象,另一种加载 Order 对象。结构上非常相似的方法,但带有命令的方法吐出: com.mysql.jdbc.exception
我正在为一个不太流行的 mmorpg 游戏编写一个 server-emu 软件,我正在使用 mysql connector for c++ 连接我的数据库。在我重新安装 Windows(和我的整个开发
我是一名优秀的程序员,十分优秀!