【问题标题】:How to create a MySQL database for DataNucleus如何为 DataNucleus 创建 MySQL 数据库
【发布时间】:2014-01-04 16:47:57
【问题描述】:

我需要为 DataNucleus 属性文件设置 MySQL 数据库:

javax.jdo.PersistenceManagerFactoryClass=org.datanucleus.api.jdo.JDOPersistenceManagerFactory
datanucleus.metadata.validate=false

# Enable these lines if persisting to ODF
#javax.jdo.option.ConnectionURL=odf:file:tutorial.ods
#javax.jdo.option.Mapping=odf

# Enable these lines if persisting to RDBMS (HSQLDB)
javax.jdo.option.ConnectionDriverName=com.mysql.jdbc.Driver
javax.jdo.option.ConnectionURL=jdbc:mysql://myserver.com:3306/myDb
javax.jdo.option.ConnectionUserName=userName
javax.jdo.option.ConnectionPassword=password
# javax.jdo.option.Mapping=hsql
datanucleus.autoCreateSchema=true
datanucleus.validateTables=false
datanucleus.validateConstraints=false

谁能告诉我如何为这个特定目的设置它的步骤?

【问题讨论】:

    标签: java mysql datanucleus


    【解决方案1】:

    由于您启用了autoCreateSchema,因此您无需创建架构。您需要做的就是创建数据库本身。必要时安装mysql,log in to mysql as root,然后发出create database command。如果您没有 root 访问权限,请咨询您的服务器的文档或管理员。您可以在网上找到许多有关此任务的教程,请在提出其他问题之前阅读它们。

    【讨论】:

    • 我已经用 Mysql 设置了服务器,并以 root 身份登录。现在我收到以下异常:此位置的预期堆栈图帧。他们说解决方法是在 Compaling 时包含 -noverify。如果我使用“ant createschema”,我应该在哪里添加该命令
    • 太棒了!所以只需进入 mysql 并发出 create database 命令。从您的配置文件看来,您的数据库应该被称为myDb
    • 这是日志:[ec2-user@ip-172-31-8-38 datastore]$ ant createschema [schematool] 异常详细信息:[schematool] 位置:[schematool] ips/data/实体/BaseStation.jdoReplaceFlags()V @4:ifnull [schematool] 原因:[schematool] 预期在此位置的堆栈图帧。 [schematool] 字节码:[schematool] 0000000: 2ab4 00a6 c600 112a 2ab4 00a6 2ab9 0107 [schematool] 0000010: 0200 b501 09b1 [schematool]
    • 我怀疑这个错误与你的mysql数据库无关。
    猜你喜欢
    • 2023-04-11
    • 1970-01-01
    • 1970-01-01
    • 2021-10-30
    • 2023-03-28
    • 2014-10-03
    • 1970-01-01
    • 1970-01-01
    • 2015-10-11
    相关资源
    最近更新 更多