Sql
This article describes how to use the Eclipse plug-in sqlexplorer to connect a variety of databases in eclipse to operate.
Eclipse is a very popular development platform, and the open architecture allows many programmers to find their own personalized work environment.
installation
jdk:1.5.0 fromhttp://java.sun.comGo up and download the installation
eclipse:3.1.1 fromhttp://www.eclipse.orgGo up and download the decompression
Sqlexplorer fromhttp://eclipsesql.sourceforge.net/
Plug-in Management
Hint: the newly downloaded plugin plugin must not be placed in the original Eclipse directory.
The premise is that you have installed the Eclipse tools, such as installed in the E:\OpenSource\Eclipse\ directory, the following directory to%eclipse_home%;
At this time the default plug-in is in the%eclipse_home%\plugins directory;
To establish a pluginsnew directory under%eclipse_home%;
For example: E:\OpenSource\Eclipse\PlugInsNew\
You have downloaded a new plugin, such as: XYZ.
Then create the XYZ directory in the%eclipse_home%\pluginsnew\ directory, which is the Eclipse directory, and the Eclipse directory contains features and plugins two subdirectories, as shown in the following figure:
1, the download of the new plug-in files in the following appropriate directory
%eclipse_home%\pluginsnew\xyz\eclipse\features
%eclipse_home%\pluginsnew\ Xyz\eclipse\plugins
2, the establishment of the relevant. link files
Then create a xyz.link file in the%eclipse_home%\links directory.
Content as follows: Path=e:/opensource/eclipse/pluginsnew/xyz on a line of such path instructions only.
In this way, if you download a number of plug-ins can be done to create a number of link files, want to load which plug-ins to put the plug-in link file to the%eclipse_home%\links directory can be, use and management are very convenient, it is recommended not to put in the default installation directory;
3, if your%eclipse_home% is different from this, please modify the path in the Xyz.link file
Delete, close eclipse
deleting%eclipse_home%\links\xyz.link files can
Delete%eclipse_home%\pluginsnew\xyz Entire directory and file
4, restart Eclipse can
Use
After you restart Eclipse, you can see more sqlexplorer in the menu window => show View => the other =>
The Sqlexplorer has seven contents, respectively:
1, aliases alias, used to identify the database connection string.
2, Connection info connection information, used to display information connected to the database, such as database product name, version, JDBC driver name, version, user name, connection string, whether autocommit and so on.
3, connnections display activities of the connection.
4, Database Structure view Display the structure
5, Drivers configuration driver with
6, SQL History execution SQL history record
7. SQL Results Execute SQL result set
The following sections describe the specific uses of these seven items:
As shown in the following illustration:
Menu window => Preferences => sqlexplorer.
In the project on the right, you can set the number of rows to return when the table result set is previewed, the number of rows returned by the SQL set, whether to automatically commit, or whether to automatically complete the table and column names when committing and writing SQL after closing the SQL editing window.
Menu window => Preferences => sqlexplorer => SQL Editor
In the project on the right, you can set the font properties, text properties in the SQL editor
Menu Window => Show View => the other => sqlexplorer to display all seven items inside, you can customize it yourself
Start configuration driver, open drivers
After the default load successful plug-in, only JDBC ODBC bridge is tick-free, the other is red X is not available, think about why it (^_^)
Don't want to come out, next look
Right-button JDBC ODBC Bridge, click Change the selected driver menu in the pop-up menu
You can see the following information in the modified driver that pops up, as shown in driver Class name: Sun.jdbc.odbc.JdbcOdbcDriver, because the driver is automatically available in the JDK from JDK1.2, so it is displayed as usable.
Next we start to configure MySQL and Oracle drivers:
Right-Mmmysql Driver, click the Change the selected Driver menu in the pop-up menu.
As seen in the pop-up modification driver, the Driver Class name displays the Org.gjt.mm.mysql.Driver.
Click Extra Class Path => add => to select the path to your MySQL location and join it.
Add the driver as follows:
Click the List Drivers button, the driver class name in the lower right box can see three driver class names, select the one you need, OK.
You can see that the Mmmysql driver is also used to tick the state.
Configure Oracle Thin driver drivers in the same way
Default driver name, adding driver:
You can see the names of two drivers
Once you have configured the driver, you can begin to create the connection and switch to the aliases alias view.
Click the Create icon as follows:
Select Mmmysql Driver
Fill in the name of the alias, JDBC Connection string url, user name, password
Once identified, a newly established connection appears in the Aliases alias view
Right-click just established database connection alias, select Open in pop-up menu ... Open them.
A connection confirmation box pops up, you can change the username and password, or you can set whether to submit automatically.
When you are sure, you will automatically switch to the database Structure view, and then you can see the databases.
Then open it, you can see the database name, table and table number and name.
Select the table Userpwd, which is set up by yourself, and you can see the following display columns, indexes, primary keys, foreign keys, result set preview, row count of six information content.
The following shows the column information for the table.
The index information is shown below.
The primary key information is shown below.
The foreign key information is shown below.
The following shows the contents of the result set preview.
The following shows the number of record row information.
Switch to connection Info connection Information view, you can see the relevant information when connecting the database, such as database product name MySQL, version 4.1.0a-nt;jdbc driver name Mysql-ab JDBC Driver, Version mysql-connector-java-3.0.16-ga, username test@localhost, connection string jdbc:mysql://localhost:3306/test, autocommit mode is, and so on.
Displays the default transaction state.
Switch to the Connnections view, which displays the current database activity connection and has an active connection.
In the upper-right corner, you can open the open new Connection icon to open a newer connection, such as connecting to the same database, but different users.
In the upper-right corner, click the new SQL Editor icon to create an SQL editor to write your SQL statement.
In the Open SQL Editor, you can start writing the SQL statement as follows:
Press CTRL + F9 or click the Exceute SQL icon to execute the statement you entered.
This allows you to see the results of the following execution in the SQL results view.
Switch to SQL History's view of the history of executing SQL, and you can see a list of statements you have executed.
Write a different statement that shows the result set and the SQL history.
After execution, the record is displayed at the end of the execution result is in the back, in ascending order, namely 1, 2, 3, the last one is your final execution of the result information content display place, do not make a mistake.
This adds a record of the execution statement to the SQL history.
Also add an Oracle connectivity test.
Oracle databases, which display database, Monitor, security, instance four items in the database Structure view.
In the SQL Editor, select the Oracle link, and then enter the query statement to test.
Can be obtained in the result set if the content is in the 4th tab bar
Change the SQL statement again.
Get the following, in the 4th tab bar.
You can see four of messages that have been executed in the SQL history.
The use of this plugin should not be easy, and other application techniques and methods continue.