MyEclipse10 + Jdk1.7 + OSGI + MySql allows you to add, delete, modify, and query databases.

Source: Internet
Author: User
Development Environment: Windows2008R264-bit + MyEclipse10 + jdk1.7.0 _ 67 + MySql5.5 software installation: Problem Solving

Development Environment: Windows2008R2 64-bit + MyEclipse10 + jdk1.7.0 _ 67 + MySql5.5 software installation: Solution to the Failover Problem

Development Environment: Windows2008R2 64-bit + MyEclipse10 + jdk1.7.0 _ 67 + MySql5.5

Software Installation: Installation

Solution: This article mainly solves the problem that the database cannot be connected when an Eclipse plug-in compliant with OSGI specifications is created, and provides some guidance to new users who are new to OSGI technology.

Download source code: Click the open link

Note: The software installation process is ignored. This document assumes that you have installed the development software and can use the client software to connect to the mysql database.

Procedure:

1. Use the Navicat for MySQL software to connect to the locally installed database localhost and create the database test and table user for testing.


2. Open MyEclipse and create a plug-in Project


3. Add the mysql-connector-java-5.1.6-bin.jar package required for Mysql database connection to the lib directory of the Project root directory


4. Double-click the MANIFEST. MF file in the project, open it, switch to the Runtime tab, and then click the "Add" button to Add the mysql-connector-java-5.1.6-bin.jar file just copied to the lib directory of the project.


5. Add the database operation code DatabaseBundle. java file under the src directory, and then call the database operation code in the startup function in the Activator. java file.




6. Configure the MyEclipse plug-in runtime, and select the plug-in project to be started and related plug-ins.

7. Run the plug-in project and view the running result on the console.




8. Open the database and view the database operation results of the plug-in.

Note: I used stop 273 in the console (current plug-in serial number. After Entering ss in the console, you can find the serial number of the current plug-in project based on the plug-in name in the result) command and start 273 command, so two records are inserted in the database.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.