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 persistent entities. You can either create a new database connection profile or use an existing one.

Note

If you plan to use the system DataSource, you have to define your tables in the Java Dictionary. Therefore, you have to connect to the Java Dictionary instead of a native database.

More information: Creating Connections to the Java Dictionary

Procedure

Creating a New Database Connection Profile

Choose ...

       1.      In the SAP NetWeaver Developer Studio, switch to the Data Source Explorer view:

                            a.      Choose Window Show View Other.

                            b.      Select Connectivity Data Source Explorer and choose OK.

       2.      In the Data Source Explorer, select Databases.

       3.      In the context menu, choose New.

       4.      Select a connection type and choose Next.

Example

If you are using the system database server, select SQL Model-JDBC Connection.

       5.      Enter the required data and choose Next.

       6.      Specify the driver and connection details:

                            a.      Select a driver class from the dropdown list, or choose This graphic is explained in the accompanying text to define a new driver class.

                                                  i.       Select a database vendor and version.

Example

If you are using the system database server, select Database MaxDB 7.6.

                                                ii.       Choose Add.

                                               iii.       Select a driver type from the Available Driver Templates list. The name of the driver is automatically displayed in the Driver Name field.

Example

For the system database server, select MaxDB JDBC Driver.

                                               iv.       Set the Edit New Driver Definition Immediately indicator and choose OK.

                                                 v.       Select the driver file from the Driver File(s) list or choose Add Jar/Zip to provide a new location in the file system.

Example

<MaxDB installation location>\programs\runtime\jar\sapdbc.jar

                                               vi.       Choose OK.

                                              vii.       Select the newly added driver and choose OK.

                            b.      Complete the database connection details fields:

                                                  i.       Enter your database name in the Database field.

Note

To check the name of your database, open the SAP Management Console (SAP MMC), expand the node of your application server in the SAP Systems tree and select the database.

                                                ii.       Enter the connection URL.

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.

Note

If you are using a custom DataSource for your application, 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

       7.      Choose Finish.

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

       8.      Connect to the database:

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

                            b.      In the context menu, choose Connect.

Associating an Existing Project with an Existing Database Connection Profile

...

       1.      In the Package Explorer, select the project to associate with the database connection profile.

       2.      In the context menu, choose Properties.

       3.      Choose JPA from the properties tree.

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

       5.      Choose Apply, then choose OK.

       6.      Connect to the database:

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

                            b.      In the context menu, choose Connect.

Connecting to the Database

...

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

       2.      In the context menu, choose Connect.

End of Content Area