Connecting the database in MyEclipse

Source: Internet
Author: User

Connecting the Database Explorer to the database is a two-step process. First, you configure the database resource Manager driver for your database, and then you open a database connection. The driver configuration is a one-time configuration task for each database that you want to use. In this tutorial, you will learn to:

    • Configuring the JDBC Database driver
    • Create a database configuration file and a connection

Duration: 15 minutes

No myeclipse? Download Now

I. Configuring database Connections

This tutorial uses an Oracle database as an example. All other JDBC drivers create a connection similar to the process. For more information about JDBC, visit the Sun website.

1. Select Window>open perspective>myeclipse Database Explorer. When you first open the view, the database browser view shown on the left contains only the pre-configured MyEclipse Derby driver.

Perspective Tools for Database Explorer

You need to create a new driver for each connection to the database separately.

2. Click the db Browser View and select New.

Add a new driver

3. Select Oracle (thin driver) from the drop-down list of driver templates.

4. The Name field type for the driver is Oracle.

5. Modify the provided URL template to be the correct connection string. In this example, the local Oracle server is Jdbc:oracle:thin: @localhost: 1521:dbtest.

6. Fill in the appropriate user name and password field values for your server. If you do not want to save your password, you do not need to fill in the password field.

Database driver Details

7. Click the Add Jars button.

8. When browsing the location of the JDBC driver's jar file or folder class, select it and click Open.

Selecting the jar file for the Oracle JDBC driver

Note : In this case, the Oracle JDBC Connector is considered to be part of the Oracle installation file.

9. Check the value of the driver class name. The Ojdbc6.jar file contains two possible drive classes, which can be selected from a drop-down menu of the driver class name.

10. Select Oracle.jdbc.driver.OracleDriver from the drop-down list of the driver class name and click Finish.

Field Required Description
Driver name Yes displays a descriptive name for the database browser view.
Url Yes database connection string. Each database has its own URL structure, for example: jdbc:oracle:thin://
User name No logon name when creating a database connection.
Password No The password is created when the database connection is made.
Jars drivers Yes adds the user-managed jars in this list to the driver manager's classpath. If the driver for the database is not available on the Java classpath, it should be added here.
Driver class name Yes to fully qualify the Java JDBC Driver class name. Access to this class must be in the location of the merge classpath of the Java Classpath + driver's jar file list.
Save Password No Select this option to instruct the Database Explorer to store the password locally. If you select this option, you will not be prompted to enter a password when you try to connect.
Open Eclipse Startup No Select this option to instruct Database Explorer to automatically create the connection during Eclipse startup.

The new driver appears in the DB browser view.

DB Browser View for Oracle driversSecond, open the database connection

Opens a connection when the MyEclipse startup or database connection causes any events to be discarded. For example, the database server restarts.

1. Right-click the driver and select Open Connection.

Open a database connection

If the connection configuration file is configured to disable the Save Password option, the Database Connection Wizard opens.

Enter user name and password

2. Enter the password.

3. If you need to commit the changes to the database immediately, select the Auto-submit check box. You can set the auto-commit as the default setting in the preferences of the MyEclipse Database Explorer.

4. Click OK to start the database connection process, and the new database connection opens and appears in the DB browser.

New database connections in DB Explorer

Note : If you close the Database browser view or switch to a different perspective, the connection remains open.

MyEclipse official Chinese online line, welcome to download Communication!

Connecting the database in MyEclipse

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.