问题
I just have learned about IBM Worklight, and I was wondering of how to set up and configure MySQL database. I've set Worklight Adapter, but, I have no clue of how to make database with MySQL.
回答1:
You should go through the IBM Worklight Getting Started training materials to properly familiarize yourself with IBM Worklight.
The steps to make a Worklight project work in conjunction with MySQL are as follows.
The Database:
- Download and install MySQL (v5.1 or v5.5)
- Download the MySQL Connector/J driver and keep it at the side for now
- Download and install some software to interface with it. I recommend the Community edition of SQLYog.
- Using SQLyog, create a new Database "Worklight"
- Using SQLyog, create a new user "Worklight" (password "Worklight")
Worklight:
- Download Eclipse Java EE 4.2.2 ("Juno" SR2)
- Install Worklight Studio (the IBM Worklight Developer Edition Eclipse plug-in. You can search for it via Eclipse >> Help >> Marketplace >> "worklight")
- Create a new project
- In your project, place the Connector/J driver in yourProject\server\lib
- In your project, open the worklight.properties file located at yourProject\server\conf and search for "mysql". Uncomment the following properties. Also edit them with the database, username and password values from above:
wl.db.type=MYSQL
wl.db.url=jdbc:mysql://localhost:3306/Worklight
wl.db.username=Worklight
wl.db.password=Worklight
If you now right-click the projcet and choose "Start Worklight Server", the server should launch successfully; if not, you did something wrong. :)
If the above works for you, you can now follow the MySQL adapter training module - follow the steps, and make sure to also configure the adapter XML with the database properties as requested in page 8.
来源:https://stackoverflow.com/questions/17009452/how-to-set-up-mysql-in-ibm-worklight