Sqlexplorer for plug-in development in eclipse

Source: Internet
Author: User
This article describes how to use the Eclipse plug-in sqlexplorer to connect to various databases in eclipse.

Eclipse is a very popular development platform. The open and scalable architecture allows many programmers to find their own personalized work environments.

  Install

JDK: 1.5.0 download installation from http://java.sun.com

Eclipse: 3.1.1 download and unzip from http://www.eclipse.org

Sqlexplorer from http://eclipsesql.sourceforge.net/

 Plugin Management

  Tip: Do not store the newly downloaded plug-in the original eclipse directory.

The premise is that you have installed the eclipse tool, for example, in the E:/opensource/Eclipse/directory, the following directory is represented by % eclipse_home %;

The default plug-in is in the % eclipse_home %/Plugins directory;

Create a directory named pluginsnew under % eclipse_home %;

E:/opensource/Eclipse/pluginsnew/

You downloaded a new plug-in, such as XYZ.

Create the XYZ directory under the % eclipse_home %/pluginsnew/directory, which contains the eclipse Directory, which contains two subdirectories: Features and Plugins. The structure is shown in:

1. Put the downloaded new plug-in files in the following directory:

% Eclipse_home %/pluginsnew/XYZ/Eclipse/Features
% Eclipse_home %/pluginsnew/XYZ/Eclipse/plugins

2. Create related. link files

Create an XYZ. Link file in the % eclipse_home %/links directory.

Such as Path = E:/opensource/Eclipse/pluginsnew/XYZ.

In this way, if you download multiple plug-ins, you can create multiple link files, and put the link file of the plug-in to the directory of % eclipse_home %/links if you want to load the plug-in, it is easy to use and manage. Do not place it in the default installation directory;

3. If your % eclipse_home % is different from this, modify the path in the XYZ. Link file.

Delete and close eclipse

Delete the % eclipse_home %/links/XYZ. Link file.

Delete % eclipse_home %/pluginsnew/XYZ entire directory and file

4. Restart eclipse.

  Use

After you restart eclipse, you can view sqlexplorer in the menu window => show view => Other =>.

Expand sqlexplorer with seven items:

1. The aliases alias used to identify the database connection string.

2. Connection info connection information, used to display relevant information when connecting to the database, such, database product name, version, JDBC driver name, version, user name, connection string, automatic submission, and so on.

3. connnections shows the active connections.

4. Database Structure View displays the database structure

5. Use drivers to configure the driver

6. SQL history execution history

7. SQL results execution result set

The following describes how to use these seven items:

As shown in:

Menu window => preferences => sqlexplorer.

In the project on the right, you can set the number of rows returned in the preview table result set, the number of rows returned in the SQL set, whether to automatically submit the SQL statement, or whether to automatically complete the table and column names when submitting and writing the SQL statement after closing the SQL edit window.

Menu window => preferences => sqlexplorer => SQL Editor

In the project on the right, you can set the font and text attributes in the SQL editor.

Menu window => show view => Other => sqlexplorer displays all the seven items in it. You can also customize it by yourself.

Start to configure the driver and open drivers

After successful plug-ins are loaded by default, only jdbc odbc bridge is checked and available, and other plug-ins are marked with red X unavailable. You can find out why (^_^)

I haven't figured it out. Let's take a look.

Right-click jdbc odbc bridge and choose change the selected driver from the shortcut menu.

You can see the following information in the pop-up modification driver. The driver Class Name displays: Sun. JDBC. ODBC. jdbcodbcdriver; because the driver is automatically included in JDK starting from jdk1.2, it is displayed as available.

Next we will start to configure the MySQL and Oracle drivers:

Right-click the mmmysql driver and choose change the selected driver from the shortcut menu.

In the pop-up driver modification, the driver Class Name displays org. gjt. Mm. MySQL. Driver.

Click Extra Class Path => Add => select the path of your MySQL instance and add it.

Add the driver as follows:

Click the list drivers button. In the lower-right box of the driver class name, you can see the three Driver Class names. select one of them and click OK.

The mmmysql driver status is also checked.

Configure the Oracle thin driver in the same way

Default Driver name. Add the driver:

The names of the two drivers are displayed.

After the driver is configured, you can create a connection and switch to the aliases alias view.

Click the create icon as follows:

Select mmmysql driver

Enter the alias name, JDBC connection string URL, user name, and password

After confirmation, the created connection is displayed in the aliases alias view.

Right-click the created database connection alias and select open... Open it.

A confirmation box is displayed. You can change the user name and password, or set whether to submit the connection automatically.

After confirmation, the system automatically switches to the database structure view. For MySQL databases, you can see the database.

Open it and you will see the database name, the number and name of the table and table.

Select the userpwd table, which is created by yourself. The following information is displayed: column, index, primary key, foreign key, result set preview, and number of rows.

The column information of the table is shown below.

The index information is shown below.

The following shows the primary key information.

The following shows the foreign key information.

The following content shows the result set preview.

The following shows the number of records.

Switch to the connection info connection information view, and you can see the relevant information when you connect to the database, such as the database product name MySQL, version 4.1.0a-NT; JDBC driver name mysql-AB JDBC driver, version mysql-connector-Java-3.0.16-ga, user name test @ localhost, connection string JDBC: mysql: // localhost: 3306/test, automatic submission mode is yes and so on.

Displays the default transaction status.

Switch to the connnections view to display the connection status of the current database activity. There is an active connection.

In the upper-right corner, you can open the open new connection icon to open a new connection. For example, you can connect to the same database but different users.

In the upper-right corner, click the new SQL editor icon to create a new SQL editor to write your SQL statements.

In the open SQL editor, you can start to write SQL statements as follows:

Press Ctrl + F9 or click the exceute SQL icon to execute the entered statement.

The following execution result is displayed in the SQL results view.

Switch to the SQL history execution history view to view the list of statements you have executed.

Write a different statement to demonstrate the result set and SQL history.

After the execution, the record is displayed after the last execution result, increasing sequentially, that is, 1, 2, 3. The last one is where the last execution result information is displayed, do not make a mistake.

In this way, an execution statement record is added to SQL history.

Add an oracle connection test.

The Oracle database is displayed in the database structure view, including database, monitor, security, and instance.

In the SQL Editor, select the Oracle link and enter the query statement to test it.

You can find the content in the result set in the 4th tag columns.

Change the SQL statement.

The following content is displayed in the 4th tabs.

The SQL history records show the four Information items that have been executed.

This plug-in should not be easy to use, and other application skills and methods should continue.

Related Article

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.