Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

In order to setup MySQL as the database for the Announcements Portlet, you'll first need to add a new dependency to the pom.xml file. Something like this:

 <dependencies>
    ...
        <dependency>
            <groupId>com.mysql</groupId>
            <artifactId>connector-java</artifactId>
            <version>5.1.6-bin</version>
            <type>jar</type>
        </dependency>
    ...
 </dependencies>

Create a new database for the portlet (in the example below the database is called portlets_announcements. Open the file datasource.properties in src/main/resources. Change it to reflect your database configuration, for example:

driver.class=com.mysql.jdbc.Driver
driver.url=jdbc:mysql://localhost/portlets_announcements
driver.username=your_username
driver.password=your_password
hibernate.dialect=org.hibernate.dialect.MySQLDialect
...

Now back in the same directory as the pom.xml file, run mvn install and you'll be alerted that the mysql-connector-java jar file is missing. Download the jar file from MySQL (http://dev.mysql.com/downloads/connector/j/5.1.html) and follow the instructions in the Maven error message to install it. Once installed, run mvn install again and the portlet will compile with your MySQL server as the datasource.

  • No labels