I'm working on java web application. i'm using jboss wildfly 10.x server, and hibernate for persistence. Problem is when i start server it says there is a unknow database "DATABASE"
which i did not create and not give a name about DATABASE
anywhere but if i create DATABASE
it works and fill my correct database.
here is my *-ds.xml:
<datasources>
<datasource jndi-name="java:jboss/datasources/atlantisDS"
pool-name="atlantisPool">
<connection-url>jdbc:mysql://localhost/atlantis?characterEncoding=UTF8
</connection-url>
<driver>mysql</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>5</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>were</user-name>
<password>142536</password>
</security>
</datasource>
</datasources>
here is persistence.xml:
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="atlantisPU" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/atlantisDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
</persistence>
I have looked for DATABASE
every *.xml
files but i could not get a clue. so what is problem and how can i fix it?
Because you have added this line
<jta-data-source>java:jboss/datasources/atlantisDS</jta-data-source>
it tells container that look for datasource in jboss config file or *-ds.xml
so open your jboss's standalone file and look for code something like this or in your *-ds.xml
<datasource jndi-name="java:jboss/datasources/sampleDS" pool-name="sampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://192.168.155.110:3306/databasename</connection-url>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>root</password>
</security>
</datasource>
you have defined database name as atlantis
Database must exist in Mysql whether or not to create tables automatically is optional
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.