Show TOC Start of Content Area

Procedure documentation Creating Database Connections  Locate the document in its SAP Library structure

Use

You use this procedure to define a connection profile and establish a connection to the native database you are using for your application tables. You can:

      Create a new database connection profile and use it when creating the development project for your entities (EJB, Dynamic Web, JPA).

      Associate an existing database connection to an existing project that has the Java Persistence facet enabled.

Note

If you plan to use the system DataSource, you have to define your tables in the Java Dictionary. Therefore, you must create a connection to the Java Dictionary.

More information: Creating Connections to the Java Dictionary

Prerequisites

You have opened the Java EE perspective in the SAP NetWeaver Developer Studio.

Procedure

Creating New Database Connection Profiles

Choose ...

       1.      Select Databases in the Data Source Explorer.

       2.      In the context menu, choose New.

       3.      Select a connection profile type (for example, if you are using the system database server, select Generic JDBC Connection), then choose Next.

       4.      Enter a name for your connection profile, then choose Next.

       5.      Specify the driver and connection details:

                            a.      Select a driver from the dropdown list.

To define a new driver, choose This graphic is explained in the accompanying text and implement the following steps:

                                                  i.       Select a database vendor and version. For example, Database MaxDB 7.6.

                                                ii.       Choose Add.

                                               iii.       Select a driver type from the Available Driver Templates list. For example, MaxDB JDBC Driver.

                                               iv.       Select the Edit New Driver Definition Immediately checkbox, then choose OK.

                                                 v.       Select the driver file from the Driver File(s) list.

To edit the selected driver location, choose Edit Jar/Zip.

To specify a new location in the file system, choose Add Jar/Zip. For example, <MaxDB installation location>\programs\runtime\jar\sapdbc.jar.

                                               vi.       Choose OK.

                                              vii.       Select the driver and choose OK.

                            b.      Complete the database connection details fields:

                                                  i.       Enter the database name in the Database field. For the system database, use the system ID (SID).

                                                ii.       Enter the connection URL. For example, jdbc:sapdb://<DB Host Name>/<Database>?timeout=0

                                               iii.       Enter the user name and password for the database in the User name and Password fields, respectively. For the system database schema, you can use SAP<SID>DB as a user name.

Note

If you are using a custom DataSource, you should use the same user name and password that you specify for connecting to the database in the definition of your DataSource.

More information about DataSource definition: Deploying Data Sources

                            c.      (Optional) Choose Test Connection to ensure that you have specified the driver and the connection details properly.

       6.      Choose Finish.

The database connection appears in the Databases tree of the Data Source Explorer.

       7.      Connect to the database.

                            a.      In the Data Source Explorer, select the database connection profile.

                            b.      In the context menu, choose Connect.

Associating Existing Projects with Existing Database Connection Profiles

...

       1.      Select the project in the Project Explorer.

       2.      In the context menu, choose Properties.

       3.      In the properties tree, select JPA.

       4.      Select the database connection profile from the Connection dropdown list.

       5.      Choose Apply, then choose OK.

End of Content Area