Java Datanucleus - create database on startup - java

I searched the docs and web for it and could not find the answer.
I'm trying to create a mysql db from datanucleus on startup, I don't mean the CreateSchema option but the create database command.
Is there an option to do it rather then from the mysql server ?
I'm using datanucleus 4.1,
Thanks .

Related

How to create table postgresql Heroku?

I have database postgresql in Heroku and i have local app. My entity is "Product".
When i wanna open my application in spring boot i get ERROR: relation "product" does not exist.
I dont have any idea how create new table "product" in postgresql.
In mysql everythink is good
You can with do it manually by running heroku pg:psql and then running the appropriate SQL statements. Or you can use a migration framework in your app.
For more information on running database migrations see the Heroku docs.

Google Cloud Dataflow application that uses JPA 2 and Hibernate won't run with BlockingDataflowPipelineRunner. Fails to find persistence.xml

I have a Google Cloud Dataflow application that as part of a transform records some information to a MySQL database through JPA 2 and Hibernate. When running this application with the DirectPipelineRunner it locates the persistence.xml and runs fine.
However, when I try to make use of the BlockingDataflowPipelineRunner the persistence context won't initialize because it can't find the persistence.xml. Maybe it can't be loaded from the CLASSPATH? The message being that the only persistence unit named in the persistence.xml isn't found.
Has anyone successfully used JPA 2 and Hibernate with a Dataflow application? If so, what hoops did you have to jump through to get it working when using the BlockingDataflowPipelineRunner?
Hibernate by default looks for the persistence.xml file in potentially many locations. You may want to confirm that the jars that get uploaded contain META-INF/persistence.xml.
If you add the flag
--workerLogLevelOverrides=org.hibernate#TRACE
, that should give you much more detailed output related to Hibernate (you may need to configure JBoss logging to go to SLF4J or JUL to get the Hibernate logging to appear, docs.jboss.org/hibernate/orm/4.3/topical/html/logging/…).

How to create a MySQL database for DataNucleus

I need to setup a MySQL database for a DataNucleus properties file:
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
Can anyone please tell me the steps on how to set it up for this particular purpose?
Since you have autoCreateSchema enabled, you do not need to create the schema. All you need to do is create the database itself. Install mysql if necessary, log in to mysql as root and then issue the create database command. If you do not have root access, consult the documentation or the administrator for your server. You can find many tutorials online for this task, please read them before asking further questions.

Hibernate Reverse Engineering Wizard - Available Tables Empty - issue

I'm trying to integrate Hibernate into my Netbeans project to connect to Microsoft SQL Server. I've run the Hibernate Configuration file wizard (and set up a new database connection). I've set the dialect to SqlServerDialect. I initially set up the connection with the db_owner schema. I've run test queries on the connection and they all return the correct information.
However, when I try to run either the Hibernate Mapping wizard or the Hibernate Reverse Engineering wizard, there are no available tables to select.
I'm using the JDBC from Microsoft (version 4). There are other similar questions already posted, but no answers that have been provided work.
It turns out I selected the wrong default schema. I selected db_owner and it should have been dbo. When I checked the connection under the services tab and expanded the default schema, it showed no tables. Apparently the SQL executor uses other schemas besides the default to find results.

how to embedd mysql in grails standalone application

I am creating a grails standalone application with with embedded tomcat server
the application works fine with embedded tomcat server.
But i need to integrate embedded mysql with the application.
Any tutorial or any hint to start with is very much appreciated.
The points i need to figure out
how can i configure my standalone application to use embedded mysql
whether mysql can be configured as embedded database or not
According to this question it seems that you're looking for MySQL Connector.
For fresh versions of grails (3,4) the plugin for embedded mysql exist
https://github.com/purpleraven/embedded-mysql-grails-plugin

Categories

Resources