Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Java Persistence/MySQL

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Using MySQL with Java Persistence API is quite straightforward as the JDBC driver is available directly from MySQL web site . MySQL Connector/J is the official JDBC driver for MySQL and has a good documentation available directly on the web site. In this page we will see some aspects of managing MySQL using the Persistence API. Installing Installation is straightforward and consists in making the .jar file downloaded from MySQL web site visible to the JVM. It can be already installed if you are using Apache or JBOSS. Configuration tips You can learn a lot from the documentation on MySQL web site . Creating the database automatically If you intend to create table and a database automatically, you will need to have the correct user rights but also inform the Persistence API about the name of the Database you want to create. For example with TopLink, if you used: in the property.xml, you will be likely need to create a new database. To create the database "NewDB" automatically, you need to give the following URL to the jdbc connection: If not, the persistence API will complain that the database does not exist.