Setting up a jPetstore Spring MVC application with SQLFire

In this section I will be giving a brief introduction to SQLFire. And I will quickly demonstrate petstore ecommerce application built using Spring MVC, QueryDsl and SQLFire as the backend database.

SQLFire is a distributed database from VMware which can be used to store large amount of relational data using commodity computers and it is one of their peices of puzzle for BigData initiative. It supports JDBC drivers and Peer drivers. In this session, I will create a 2 cluster servers. For more information visit the documentation.

To start the demo,

  • Download SQLFire
  • Download the source code and unzip it
  • Run the command “java –jar vFabric_SQLFire_102_Installer.jar”
  • Start 2 node clusters by doing the following,
    • Under the directory where SQLFire folder was installed create another two directories: server1 and server2.
    • Using sqlf command start two SQLFire server instances that should reside inside the folders that were just created:
      • bin\sqlf server start -dir=server1 -client-port=1527 -mcast-port=12333
      • bin\sqlf server start -dir=server2 -client-port=1528 -mcast-port=12333
  • Run the sqlfire client by executing
    • bin\sqlf
    • connect client ‘localhost:1527’;
    • run ‘<sourcecode download location>\jpetstore\db\ sqlfire\jpetstore-sqlfire-dataload.sql’
    • run ‘<sourcecode download location>\jpetstore\db\ sqlfire\jpetstore-sqlfire-schema.sql’
  • Install maven on your machine and setup the path

Open pom.xml and replace

<dependency>
  <groupId>com.vmware.sqlfire</groupId>
  <artifactId>sqlfire-client</artifactId>
  <version>1.0.0-Beta</version>
</dependency>

With

<dependency>
  <groupId>com.vmware.sqlfire</groupId>
  <artifactId>sqlfireclient</artifactId>
  <version>1.0.2</version>
</dependency>

And in the repositories block add,

<repository>
  <id>gemstone</id>
  <name>Release bundles for SQLFire and GemFire</name>
  <url>http://dist.gemstone.com.s3.amazonaws.com/maven/release</url>
</repository>

Add a new block under project element,

<pluginRepositories>
  <pluginRepository>
    <id>gemstone</id>
    <name>Release bundles for SQLFire and GemFire</name>
    <url>http://dist.gemstone.com.s3.amazonaws.com/maven/release</url>
  </pluginRepository>
</pluginRepositories>

Run ‘mvn tomcat:run’

Now open the browser and type ‘http://localhost:8080/jpetstore’

Volla you have the application up and running. Open eclipse IDE or STS IDE, import maven project into the IDE to see how the application has been developed. You can also see how SQLFire as been used and the JDBC connection.

Advertisements

One thought on “Setting up a jPetstore Spring MVC application with SQLFire

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s