Saturday, 26 January 2013

STEP 1) Create project “mysqldsTest” and create “mysqldsTest.war” file

STEP 2) Create “mysqldsTest” App Openshift:

$ rhc app create -a mysqldsTest -t jbossas-7

STEP 3) Before starting adding content removing the current pom.xml and other artifacts
created at application creation is required:

$ git rm -r src pom.xml

$ git commit -m "removing artifacts from application creation phase"

STEP 4) Copy the “mysqldsTest.war” & “mysql-connector-java-5.1.20.jar” into “mysqldsTest/deployments/

STEP 5) Add to your openshift git commit and push:

Now that you have a war file ready for deployment (mysqldsTest/deployments/mysqldsTest.war)

lets add it to the git repository and then commit and finally we will push the war to the openshift express instance.

Open a terminal window and switch the working directory to the application’s deployments
directory then execute the following commands:

$ cd deployments/

$ git add mysqldsTest.war

$ git commit -m "depolying myapp application" mysqldsTest.war

$ git push

Note that git repository is created at the root project level so all files can be added to git and not only the deployment.

STEP 6) 2 Ways To access MySQL Database:

    a) Using PhpAdmin:
        - Click on Add Cartridge +and Add phpMyAdmin 3.4
    - Save the Credentials.

b) Using SSH (Open Terminal and Execute following commands):

   
You will be now at “[mysqldsTest-jsr10.rhcloud.com ~]\>” path (i.e. “mysqldsTest” Applications root directory)
    [mysqldsTest-jsr10.rhcloud.com ~]\> mysql
       
        You will be now at “mysql>” path

mysql> show databases;

STEP 7) Your push completed and you application should be available at the following
openshift URL:

http://mysqldstest-jsr10.rhcloud.com/mysqldsTest/index.jsp

Categories: , , , , ,

1 comment:

  1. Thanks for this post. I was looking for the same solution but currently this is not working for me. I am getting connection error like “Access denied for user ‘usename@127.X.X.X’@’localhost’ (using password: YES)”.

    Could you please tell me if i am doing anything wrong?

    ReplyDelete

Find me on Facebook! Follow me on Twitter!