How to Create an Oracle Database Project in the Oracle Developer Studio IDE
by Nikolay Krasilnikov
Published July 2012 (updated June 2016)
This article describes the support for Oracle Database projects that are added to the integrated development environment (IDE) in Oracle Developer Studio.
In the Oracle Developer Studio IDE, you can create a project for an Oracle Database application. Oracle Developer Studio added support for Pro*C/C++. And the Oracle Developer Studio release includes Oracle Instant Client, which contains native client libraries for communicating with databases, as a component that you can optionally install.
Creating a Database Project
The New Project wizard in the IDE includes a new project type for Oracle Database applications. To create an Oracle Database project, do the following:
- Choose File -> New Project.
-
On the Choose Project page of the New Project wizard, select the C/C++/Fortran category and the C/C++ Database Application project, and then click Next.
Figure 1. Choose Project Page of the New Project Wizard
-
On the Project Name and Location page, specify the name and location of your project. Then click Next.
Note: Make sure the tool collection is Oracle Developer Studio so that the IDE has access to the Oracle Instant Client in your Oracle Developer Studio installation. If you used a different tool collection, you have to manually provide paths to the Pro*C precompiler, include files, and libraries to the project makefile.Figure 2. Project Name and Location Page of New Project Wizard
-
On the Master Table page, you set up the connection to an Oracle database and select the table your application will use. Select a database from the Database Connection list, or select New Database Connection to create a new database connection.
Figure 3. Master Table Page of New Project Wizard
-
If you are creating a new database connection, enter the database address and your username and password on the Customize Connection page of the New Connection wizard.
Note: The wizard contains default values for Oracle Database, Express Edition. Change them if necessary.
Figure 4. Customize Connection Page of New Connection Wizard
- Click Next.
-
On the Choose Database Schema page of the New Connection wizard, enter the database schema or select it from the list.
Figure 5. Choose Database Schema Page of New Connection Wizard
- Click Finish.
-
When you have selected or created your database connection, the IDE connects to the database. Now, on the Master Table page, select the master table for your project from the Database Table list. Use the arrow keys between the Available Columns and Columns to Include lists to select the table columns you want to include in your project.
Figure 6. Master Table Page of New Project Wizard
- Click Finish.
-
Now that your database project is created, you can build and run it.
Figure 7. Output Window Showing Run Tab for the New Project
Pro*C/C++ Editor Support
The Source Editor support for Pro*C/C++ in the IDE includes coloring, code completion, and hyperlinks for Pro*C/C++ statements.
To provide code completion for database elements, the IDE uses the same database connection you established for the project when you created it. You can change the database connection used for code completion in the Services window or by clicking the Select Database Connection button in the Source Editor toolbar when you have a source file in your project open.
Figure 8. Select Database Connection Button in Source Editor Toolbar
Code completion is provided for the following:
-
SQL keywords:
Figure 9. Code in Source Editor Showing SQL Keyword Completion
-
Database table column names:
Figure 10. Code in Source Editor Showing Database Table Column Completion
-
C and C++ variable names:
Figure 11. Code in Source Editor Showing Variable Name Completion
-
Database table names:
Figure 12. Code in Source Editor Showing Table Name Completion
See Also
See the following resources for more information:
- The NetBeans article "Connecting to Oracle Database from NetBeans IDE" applies also to the Oracle Developer Studio IDE. However, you do not need to download the
ojdbc6.jar
file, as mentioned in the article, because it is already included in the Oracle Developer Studio IDE. - The Help menu in the IDE provides access to extensive information about using the IDE, including how to work with databases.
- For basic information about using the Oracle Developer Studio IDE, see the IDE Quick Start Tutorial
About the Author
Nikolay Krasilnikov joined Sun Microsystems in 2008. Now he is a senior software engineer for Oracle in St. Petersburg, Russia developing the Oracle Developer Studio IDE. His responsibilities include developing the C and C++ grammar, parser, and code model.
Revision 1.1, June 2016
Revision 1.0, July 2012