net beans 2

Upload: smk-tanvir

Post on 07-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/4/2019 Net Beans 2

    1/2

    To connect to a database you first need to do the following:

    Confirm that a JDBC driver for your database is registered with the IDE.The registered JDBC drivers are visible under the Drivers node in the Services window.

    Create a database connection for the database.

    A database connection is represented by a database connection node ( ) under the Databasesnode in the Services window.

    When you create a database connection, you supply the details needed to connect to a specific database.

    The details needed to connect to a database include the location of the database, which driver to use andthe username and password information.

    To create a new connection:

    1. Confirm that your database is running.2. In the Services window, confirm that the appropriate JDBC driver for your database is listed under

    the Drivers node.

    3. Right-click the Databases node and choose New Connection.Alternatively, expand the Drivers node, right-click your driver's instance node and choose ConnectUsing.

    4. In the New Database Connection dialog box, select the Data Input Mode, which can be either afield entry or a direct JDBC database URL. The Data Input Mode option defines only the form in

    which you want to specify the database connection settings: either type the host name, port, and

    database name in separate fields or use a direct URL.

    5. Confirm that the correct driver for your database is selected in the Driver Name list.6. If you selected the Field Entry option, enter the host name, port, and database name in the

    respective fields. You can select the Show JDBC URL checkbox to see the actual URL for thenew connection.

    If you selected Direct URL Entry for the Data Input Mode, enter the JDBC database URL for the

    database connection in the Database URL field.

    This URL typically begins with jdbc:and a short code name for the driver, followed by anothercolon. The rest of the URL depends on the type of driver you are using. For example, you mightneed to specify a host and port; alternatively, the name of a database file might suffice, or an

    ODBC DSN. For MySQL, the Database URL might look as follows:

    jdbc:mysql://localhost:3306/mydatabase

    To help you get started, the IDE provides templates for the correct URL format for the most

    common drivers. If in doubt, refer to the documentation for the driver that you are using.

    7. Provide the user name and password, if required by your database configuration.8. Click the Remember Password checkbox to have the IDE remember your password.

  • 8/4/2019 Net Beans 2

    2/2

    If selected, you will not be prompted for the user name and password on subsequent connectionsto the database. To change this property, right-click the database connection node in the Services

    window and choose Properties and unselect the Remember Password property in the Properties

    window.

    9. Click OK to create the database connection and connect to the database from the IDE. When connecting to the database, the schema with the same name as the user name is set as

    default, but if a schema with that name does not exist, you are automatically switched to the

    Advanced Tab of the Connect dialog box to select a schema.

    If the connection is successful, the database connection node appears as a subnode of the Databases node.

    The database connection node appears whole ( ) indicating the database is connected. When the

    database is connected, you can expand the database connection node to see the child folders representing

    lists of tables, views and procedures. For more, seeBrowsing Structures.

    If the connection attempt fails, the IDE displays a dialog box indicating it was unable to add the

    connection. Check the connection information for the database in the New Database Connection dialog

    box.

    To disconnect from the database:

    1. Right-click the database connection node and choose Disconnect.You cannot browse the database until you reconnect to the database.

    http://browstruct.html/http://browstruct.html/http://browstruct.html/http://browstruct.html/