PK
EAoa, mimetypeapplication/epub+zipPK EA iTunesMetadata.plistj
This chapter contains:
Synchronizing the .NET and Oracle Database Locale Environments
Client Globalization Support in Oracle Data Provider for .NET
See Also:
|
This chapter discusses global application development with Oracle Database in .NET. It addresses the basic tasks associated with developing applications that are ready for global deployment, such as developing locale awareness and presenting data with cultural conventions of the user's locale. It also discusses globalization support features available in Oracle Data Provider for .NET.
Building a global-ready application that supports different locales requires good development practices.
A locale refers to a national language and the region in which the language is spoken. The application itself must be aware of the user's locale preference and be able to present content following the cultural convention expected by the user. It is important to present data with appropriate locale characteristics, such as the correct date and number formats. Oracle Database is fully internationalized to provide a global platform for developing and deploying global applications.
When planning a global-ready application, you have to consider two main tasks:
Globalization is the process of designing applications that can adapt to different cultures.
Localization is the process of translating resources for a specific culture.
In the .NET Framework, the System.Globalization
namespace contains classes that define information related to culture, such as language, country and region, calendars, format patterns for dates, currency, and numbers, and the sort order for strings. These classes simplify the process of developing a global-ready application, so that passing a CultureInfo
object that represents the user's culture to methods in System.Globalization
namespace initiates the correct set of rules and data.
The .NET Framework also supports the creation and localization of resources, and offers a model for packaging and deploying them. Localizing the application's resources for specific cultures supports development of translated versions of the application. The .NET Framework base class library provides several classes in the System.Resources
namespace for building and manipulating application resources.
Data in the application must be presented in a way that meets the user's expectations, or its meaning can be misinterpreted. For example, 12/11/05 implies December 11, 2005 in the United States and November 12, 2005 in the United Kingdom. Similar confusion exists for number and monetary formats. For example, the period (.) is a decimal separator in the United States and a thousand separator throughout Europe.
Different languages have their own sorting rules: some languages are collated according to the letter sequence in the alphabet, others according to stroke count in the letter, still others are ordered by the pronunciation of the words. Presenting data that is not sorted according to the linguistic sequence that the user is accustomed to can make searching for information difficult and time-consuming.
Depending on the application logic and the volume of data retrieved from the database, it may be more appropriate to format the data at the database level rather than at the application level. Oracle Database offers many features that refine the presentation of data when the user locale preference is known.
Several of the following examples require that you use SQL*Plus to connect as a user with database administrator privileges such as SYS
or SYSTEM
.
See Also: "Locking and Unlocking User Accounts" in the Oracle Database 2 Day DBA for further information |
There are three different date presentation formats in Oracle Database: standard, short, and long. The following steps illustrate the difference between the short and long date formats for United States and Germany.
To change the Oracle date format:
From a Windows command prompt, enter the following
C:\>sqlplus "sys as sysdba"
Enter password:passwd
where passwd
is the Sys
password that was established when the database was installed. The password does not appear when you type the characters.
Description of the illustration nls00.gif
Enter this command at the SQL prompt:
SQL> ALTER SESSION SET NLS_TERRITORY=america NLS_LANGUAGE=american;
This message appears: Session altered.
There is no problem with setting a parameter to its current setting. You may want to do this for security. To determine what your current settings are enter:
SQL> select * from v$nls_parameters;
or
select * from v$nls_parameters where parameter = 'NLS_LANGUAGE';
At the SQL prompt, enter the following query:
SQL> SELECT employee_id "ID", SUBSTR (first_name,1,1)||'. '||last_name "Name", TO_CHAR (hire_date, 'DS') "Short Hire", TO_CHAR (hire_date, 'DL') "Long Hire Date" FROM hr.employees WHERE employee_id < 105;
Note that you must use hr.employees
in order to access the employees
table in the hr
schema because you are currently logged in as sys
, not hr
.
The result of the query returns in the American format specified in Step 1.
Enter the following command at the SQL prompt:
SQL> ALTER SESSION SET NLS_TERRITORY=germany NLS_LANGUAGE=german;
This message appears: Session altered.
At the SQL prompt, enter the query from Step 3.
The result of the query returns in the German format specified in Step 4.
There are also differences in the decimal character and group separator. The following steps illustrate these difference between United States and Germany.
To change the Oracle number format:
Enter the following command at the SQL prompt:
SQL> ALTER SESSION SET NLS_TERRITORY=america NLS_LANGUAGE=american;
This message appears: Session altered.
At the SQL prompt, enter the following query:
SQL> SELECT employee_id "ID", SUBSTR (first_name,1,1)||'. '||last_name "Name", TO_CHAR (salary, '99G999D99') "Salary" FROM hr.employees WHERE employee_id < 105;
The result of the query returns in the American format specified in Step 1.
Enter the following command at the SQL prompt:
SQL> ALTER SESSION SET NLS_TERRITORY=germany;
This message appears: Session altered.
At the SQL prompt, enter the query in Step 2.
The result of the query returns in the German format specified in Step 3.
Spain traditionally treats ch
, ll
, and ñ
as letters of their own, ordered after c
, l
and n
, respectively. The following steps illustrate the effect of using a Spanish sort against the employee names Chen
, Chung
, and Colmenares
.
To change the Oracle linguistic sort:
Enter the following command at the SQL prompt.
SQL> ALTER SESSION SET NLS_SORT=binary;
This message appears: Session altered.
At the SQL prompt, enter the following query:
SQL> SELECT employee_id "ID", last_name "Name" FROM hr.employees WHERE last_name LIKE 'C%' ORDER BY last_name;
The result of the query returns in the binary sort specified in Step 1.
Enter the following command at the SQL prompt.
SQL> ALTER SESSION SET NLS_SORT=spanish_m;
This message appears: Session altered.
At the SQL prompt, enter the query in Step 2.
The result of the query returns in the Spanish sort specified in Step 3.
The NLS_LANGUAGE
parameter also controls the language of the database error messages. Setting this parameter prior to submitting a SQL query ensures the return of local language-specific error messages, as shown in these steps:
To change the Oracle NLS language parameter:
Enter the following command at the SQL prompt.
SQL> ALTER SESSION SET NLS_LANGUAGE=american;
This message appears: Session altered.
At the SQL prompt, enter the following query.
SQL> SELECT * FROM managers;
The result of the query return the error message in the language specified in Step 1.
Enter the following command at the SQL prompt.
SQL> ALTER SESSION SET NLS_LANGUAGE=french;
This message appears: Session altered.
At the SQL prompt, enter the query in Step 2.
The result of the query returns the error message in the language specified in Step 3.
Reset your language, local, and sort settings back to their original values.
When you are developing global applications, always synchronize the user locale settings between the database and clients. Otherwise, the application may present conflicting culture-sensitive information. For example, a .NET application must map the Culture ID of the application user to the correct NLS_LANGUAGE
and NLS_TERRITORY
parameter values before performing SQL operations.
Table 9-1 shows some of the more common locales, as defined in .NET and Oracle environments.
Table 9-1 Common NLS_LANGUAGE and NLS_TERRITORY Parameters
Culture | Culture ID | NLS_LANGUAGE | NLS_TERRITORY |
---|---|---|---|
Chinese (P.R.C.) |
|
|
|
Chinese (Taiwan) |
|
|
|
English (U.S.A.) |
|
|
|
English (U.K.) |
|
|
|
French (Canada) |
|
|
|
French (France) |
|
|
|
German |
|
|
|
Italian |
|
|
|
Japanese |
j |
|
|
Korean |
|
|
|
Portuguese (Brazil) |
|
|
|
Portuguese |
|
|
|
Spanish |
|
|
|
Oracle Data Provider for .NET enables applications to manipulate culture-sensitive data, such as ensuring proper string format, date, time, monetary, numeric, sort order, and calendar support using culture conventions defined in the Oracle Database. The default globalization settings are determined by the client's NLS_LANG
parameter, which is defined in the Windows Registry of the local computer. When the OracleConnection
Open
method establishes a connection, it implicitly opens a session with globalization parameters specified by the value of the NLS_LANG
parameter.
The client globalization parameter settings are read-only and remain constant throughout the lifetime of the application. Changing the OracleGlobalization
object properties does not change the globalization settings of the session or the thread. The following sections describe how to modify the globalization settings at the session and thread level.
Your .NET application can obtain globalization settings by calling the OracleGlobalization.GetClientInfo()
static method. The OracleGlobalization
sample code below demonstrates how to obtain some of the values in .NET.
Visual C#:
using System; using Oracle.DataAccess.Client; class ClientGlobalizationSample { static void Main() { OracleGlobalization ClientGlob = OracleGlobalization.GetClientInfo(); Console.WriteLine("Client machine language: " + ClientGlob.Language); Console.WriteLine("Client characterset: " + ClientGlob.ClientCharacterSet); } }
Visual Basic:
Imports System Imports Oracle.DataAccess.Client Class ClientGlobalizationSample Shared Sub Main() Dim ClientGlob As OracleGlobalization = OracleGlobalization.GetClientInfo() Console.WriteLine("Client machine language: " + ClientGlob.Language) Console.WriteLine("Client characterset: " + ClientGlob.ClientCharacterSet) End Sub End Class
Session globalization parameters are initially identical to client globalization settings, but they can be modified. To modify the session parameters, you must establish a connection to the database, and then call the GetSessionInfo()
method of an OracleConnection
object to retrieve the session globalization settings. Next, you modify the globalization settings as needed, then save the settings back to the OracleConnection
object through the SetSessionInfo(OracleGlobalization)
method.
To specify the globalization session setting:
Open the application HR_Connect_CS
or HR_Connect_VB
.
Make a copy of Form3.
xx
, which you finished at the end of Chapter 4 and name it Form5.
xx
, following the instructions in Appendix B, "Copying a Form".
Open Form1 of the project, and switch to design view.
From the View menu, select Toolbox.
From the Toolbox, under Windows Forms, drag and drop a Button onto Form1.
Right-click the new Button, select Properties. The Properties window appears.
In the Properties window, set these properties:
Under Appearance, change Text to Change
Date
Format
.
Under Design, change (Name) to date_change
.
Form1 should look much like this:
In the properties window, if you click Events (lightning bolt icon), date_change_Click()
now shows as the Event for the date button.
Open the new date_change_Click()
method just created and add the following code to change the date format from the standard DD-MON-RR
to YYYY-MM-DD
and to update the DataSet
.
Visual C#:
si.DateFormat = "YYYY-MM-DD"; conn.SetSessionInfo(si); ds.Clear(); da.Fill(ds); departments.DataSource = ds.Tables[0];
Visual Basic:
si.DateFormat = "YYYY-MM-DD" conn.SetSessionInfo(si) ds.Clear() da.Fill(ds) departments.DataSource = ds.Tables(0)
Note that the ds.Clear()
call will clear the old results before posting the changed data.
Also, the si
class variable will be declared and session globalization information retrieved in Step 10 and Step 11.
Within the appropriate method, add the code indicated.
Visual C#: In the Form1()
method
date_change.Enabled = false;
Visual Basic: In the Form1_Load
method
date_change.Enabled = false
Add the following class variable to the existing Form1 class declarations right after the public
Form1()
block with this code as indicated.
Visual C#:
private OracleGlobalization si;
Visual Basic:
private si As OracleGlobalization
Within the connect_Click()
method try
block, add the indicated code which does the following:
Retrieve the value of the OracleGlobalization
object.
Retrieve data from the EMPLOYEES
table (note the new query).
Enable the Change Date Format button.
The changed code is in bold typeface.
Visual C#:
conn.Open(); connect.Enabled = false; si = conn.GetSessionInfo(); string sql = "select employee_id, first_name, last_name, TO_CHAR(hire_date)" + " \"Hire Date\" from employees where employee_id < 105"; cmd = new OracleCommand(sql, conn); cmd.CommandType = CommandType.Text; da = new OracleDataAdapter(cmd); cb = new OracleCommandBuilder(da); ds = new DataSet(); da.Fill(ds); departments.DataSource = ds.Tables[0]; save.Enabled = true; date_change.Enabled = true;
Visual Basic:
conn.Open() connect.Enabled = false si = conn.GetSessionInfo() Dim sql As String = "select employee_id, first_name, last_name, " & _ "TO_CHAR(hire_date) ""Hire Date"" from employees where employee_id < 105" cmd = new OracleCommand(sql, conn) cmd.CommandType = CommandType.Text da = new OracleDataAdapter(cmd) cb = new OracleCommandBuilder(da) ds = new DataSet() da.Fill(ds) departments.DataSource = ds.Tables[0] save.Enabled = true date_change.Enabled = true
Save Form1
.
Run the application using the F5 keyboard shortcut.
The application successfully connects to the database so the data grid is populated with the results of the query.
Click Change Date Format.
Note that the date format changed from the original DD-MON-RR
to YYYY-MM-DD
.
Close the application.
Thread-based globalization parameter settings are specific to each thread. Initially, these settings are identical to the client globalization parameters, but they can be changed programmatically. When converting ODP.NET Types to and from strings, use the thread-based globalization parameters, if applicable.
Thread-based globalization parameter settings are obtained by calling the GetThreadInfo()
static method of the OracleGlobalization
class. A call to SetThreadInfo()
static method sets the globalization settings of the thread.
ODP.NET classes and structures rely solely on the OracleGlobalization
settings when manipulating culture-sensitive data. They do not use .NET thread culture information. If the application uses only .NET types, OracleGlobalization
settings have no effect. However, when conversions are made between ODP.NET Types and .NET Types, OracleGlobalization
settings are used where applicable.
Note: Changes to theSystem.Threading.Thread. CurrentThread.CurrentCulture property do not impact the OracleGlobalization settings of the thread or the session. The reverse is also true. |
This chapter contains:
Visual Studio groups all development code that you create into containers known as projects. Simpler projects often contain only one file. In this section, you will learn how to create a new development project.
The application you build in this chapter serves as a starting point for work in subsequent chapters, so it is important to follow the order of this guide.
NOTE: When necessary, instructions specify Visual C# or Visual Basic.
To start a new project:
Start Visual Studio.
Open the Start menu, select All Programs, and then select Microsoft Visual Studio 2008.
The Microsoft Visual Studio IDE environment appears.
In the Start Page, under the Recent Projects heading, click Create: Project.
Alternatively, from the File menu, select New, and then select Project.
A New Project dialog box appears.
In Project Types, select the type of project you are creating:
Visual C#:
Visual C#: Windows
Visual Basic:
Other Languages: Visual Basic: Windows
In Templates, select Windows Forms Application.
In the Name field, enter the appropriate name.
Visual C#:
HR_Connect_CS
Visual Basic:
HR_Connect_VB
The abbreviation CS
indicates C# projects and VB indicates Visual Basic projects.
In Location, enter the directory where you want to save the files.
For this guide, enter this directory C:\HR_Projects
.
In Solution Name, the appropriate name, HR_Connect_CS or HR_Connect_VB should appear.
A solution can contain several projects; when it contains only one project, you can use the same name for both.
Check Create directory for solution.
Click OK.
The project is created.
The main window now displays a new title, either HR_Connect_CS - Microsoft Visual Studio or HR_Connect_CS - Microsoft Visual Studio, depending on the language, and contains Form1 shown below.
It is important to remember that many projects automatically name the first form Form1. This is the name of the form control. Do not confuse this with the actual name given to the code file, which is typically Form1.cs
or Form1.vb
.
Both Form1 and Form
1.xx
can be renamed. For the purposes of this guide, we will rename Form
1.xx
several times.
This section shows you how to add a reference to the Oracle.DataAccess.dll
file, which contains the data provider, Oracle Data Provider for .NET.
To add a reference:
From the Project menu, select Add Reference.
The Add Reference windows appears.
In the Add Reference window, under the .NET tab, select Oracle.DataAccess. Click OK.
Note that the new reference appears in the Solution Explorer.
You can add Oracle namespace directives that allow you to indicate an assembly's namespaces within the module. To do this, add C# using
statements or Visual Basic Imports
statements, at or near the top of a code file.
Note: Adding a reference makes the namespace available within the application. Adding a namespace directive within the application code makes the namespace more visible and allows for additional scoping. |
To add Oracle namespace directives:
With Form1 active, from the View menu select Code.
Alternatively, you can use the F7 keyboard shortcut.
Add the following statements to the list of declarations depending on the language you are using.
Visual C#:
Add with other using
statements, before the namespace.
using Oracle.DataAccess.Client; using Oracle.DataAccess.Types;
Visual Basic:.
Add to the top of the file, in the declarations section.
Imports Oracle.DataAccess.Client Imports Oracle.DataAccess.Types
Save the changes by selecting Save from the File menu, or using the Ctrl+S keyboard shortcut.
You can create a user interface by adding the toolbox controls to the design form. This interface accepts connection information from the user.
To add toolbox controls:
From the View menu, select Designer.
This opens Form1, in design view, if it is not already open.
You will toggle between Code and Designer a lot. The keyboard shortcuts are F7 and shift- F7 respectively.
From the View menu, select Toolbox.
In the Toolbox, expand Common Controls.
In the Toolbox, select Label, and drag it onto the Form1.
On Form1, right-click label1.
From the menu, select Properties, if the Properties Window is not already visible.
The Properties Window appears.
In the Properties Window, change the Text property from label1 to User ID.
Repeat steps 4 through 7 twice, placing two more labels on Form 1 and changing their text properties to Password and Data Source.
In the Toolbox, select TextBox, and drag it onto the Form1, next to the User ID label.
In the Properties Window, change the Name property to userID.
Repeat steps 9 and 10 twice, positioning two more text boxes next to the existing labels, and setting the Name property to password and dataSource.
Select the text box next to the Password label. In the Properties Window, scroll to the PasswordChar property and set it to an asterisk (*).
This masks the password during entry.
From the Toolbox, select Button and drag it onto Form1.
In the Properties Window, change the Text property of the button from button1 to Connect, and change the Name property to connect.
Save.
Close the Toolbox.
Now we write the code that takes the information provided to the user interface and connects to the database.
To connect to the database, you must create a connection object.
To write code that connects to the database:
These steps enable your application to connect to the database based on data that the user enters into the Form1 control. See "Compiling and Running the Application".
From the View menu, select Code.
Add the code indicated to instantiate a database connection string.
Visual C#: Add the class variable conn
to the Form1
class right after the public
Form1()
block with this code.
private OracleConnection conn = new OracleConnection();
Visual Basic: Add the conn
class variable in the Form1
class declaration, using this code.
Public Class Form1
Dim conn As New OracleConnection
Save your changes.
Change to Designer view by clicking on the View menu and selecting Designer.
Double-click the Connect button on Form1 to open the code window to the connect_Click()
method.
Insert the code indicated into the connect_Click()
method.
Visual C#:
conn.ConnectionString = "User Id=" + userID.Text + ";Password=" + password.Text + ";Data Source=" + dataSource.Text + ";"; conn.Open();
Visual Basic:
conn.ConnectionString = "User Id=" + userID.Text & _ ";Password=" + password.Text & _ ";Data Source=" + dataSource.Text conn.Open()
Note: Before a connection can be opened, it must be built from user input for the User
ID
, Password
, and Data
Source
. The Open()
method makes the actual connection.
Set the Enabled
attribute of the button to false
by inserting the indicated code at the end of the connect_Click()
method.
This disables the Connect
button, which is a good practice once a connection is successfully made.
Visual C#:
connect.Enabled = false;
Visual Basic:
connect.Enabled = false
You have now finished writing an application that can connect to the Oracle database. The following sections show how to use it.
This section shows how to compile and run the application you created in the previous sections.
To compile and run the application:
From the Build menu, select Build Solution.
Ensure that there are no errors reported in the output window, available from the View menu.
The following graphics shows a typical output result.
If there are any errors indicated, from the View menu, select Error List and fix the errors.
From the Debug menu, select Start Without Debugging to run the application.
In the Form1 application, enter the User ID, Password, and Data Source.
Click Connect.
This is where the application makes use of the tnsnames.ora
file. See "Configuring a NET Connect Alias".
Once the connection is opened, the Connect button is disabled. You have succeeded in implementing a connection to an Oracle Database instance.
Applications must be able to handle run-time errors gracefully. For example, if you try to log in using an incorrect password, the application you developed so far cannot establish a connection to the database, and exits with the following unhandled exception error, ORA-1017:
invalid username/password,
logon
denied
.
You must reselect Start Without Debugging to try this with a different password.
Error handling manages occurrences of conditions that change the normal flow of program execution. Oracle Data Provider for .NET contains three classes for error handling and support:
The OracleError
class represents a warning or an error reported by Oracle.
An OracleErrorCollection
class represents a collection of all errors that are thrown by the Oracle Data Provider for .NET. It is a simple ArrayList
that holds a list of OracleError
s.
The OracleException
class represents an exception that is thrown when the Oracle Data Provider for .NET encounters an error. Each OracleException
object contains at least one OracleError
object in the Error
property that describes the error or warning.
.NET languages use Try-Catch-Finally block structure for error handling. With this structure, the Try code is the main code, the goal that the application wants to accomplish. The Catch code catches errors of various types, as shown in the next two section. The Finally block comes last and always executes.
The Finally block frequently contains the Dispose
method, which closes and disposes of the connection. Having the Dispose
method in the Finally block ensures that the database connection is always closed after the Try-Catch-Finally block completes. Closing database connections after the application no longer requires database access is important for many reasons, especially data security.
Attempting to close a closed database connection does not cause an error. The attempt is irrelevant. Nonetheless, placing Dispose()
in the Finally code block guarantees that the connection is closed.
The next section shows how to use Try-Catch-Finally block structure with general errors, and the section after that, with Oracle errors.
This section shows how to handle general errors using a Try-Catch-Finally block.
To handle general errors:
Change the code of the connect_Click()
method in Form1
by adding an implementation of the Try-Catch-Finally syntax.
New code is in bold font.
Visual C#:
private void connect_Click(object sender, EventArgs e) { conn.ConnectionString = "Data Source=ORCL;User Id=" + userID.Text + ";Password=" + password.Text + ";"; try { conn.Open(); connect.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } finally { conn.Dispose(); } }
Alternatively, you can use C# syntax that disposes of a connection when it goes out of scope, with the using
keyword, as follows:
using (OracleConnection conn = new OracleConnection()) { conn.Open(); // application code ... }
Visual Basic:
Try conn.Open() connect.Enabled = false Catch ex As Exception MessageBox.Show(ex.Message.ToString()) Finally conn.Dispose() End Try
From the Build menu, select Rebuild Solution.
Ensure that there are no errors.
From the Debug menu, select Start Without Debugging.
Run the application again, as described in section "Compiling and Running the Application", and attempt to connect using an incorrect password. This time, the application catches the error and displays it in a pop-up window, ORA-1017: invalid
username/password;
logon
denied
.
In the completed Try-Catch-Finally block code shown below, the first Catch statement branch is skipped if there are no OracleException
s. The second Catch statement branch catches all other Exception
s.
The first catch statement contains Case
statements, which can be used to trap common database errors and display them in a user-friendly manner.
Note that the second Case
statement catches a specific example of OracleException
, when the database is not accessible.
To handle specific errors:
Stop the database instance. See Appendix A, "Starting and Stopping an Oracle Database Instance".
Add the Catch
OracleException
block shown below in bold, before the Catch
Exception
block previously added in the connect_Click()
method.
Visual C#:
try { conn.Open(); connect.Enabled = false; } catch (OracleException ex) { switch (ex.Number) { case 1: MessageBox.Show("Error attempting to insert duplicate data."); break; case 12560: MessageBox.Show("The database is unavailable."); break; default: MessageBox.Show("Database error: " + ex.Message.ToString()); break; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } finally { conn.Dispose(); } }
Visual Basic:
Try conn.Open() connect.Enabled = false Catch ex As OracleException ' catches only Oracle errors Select Case ex.Number Case 1 MessageBox.Show("Error attempting to insert duplicate data.") Case 12560 MessageBox.Show("The database is unavailable.") Case Else MessageBox.Show("Database error: " + ex.Message.ToString()) End Select Catch ex As Exception MessageBox.Show(ex.Message.ToString()) Finally conn.Dispose() End Try
Compile and run the application again, as described in section "Compiling and Running the Application".
Note that the ORA-12560
error appears in the pop-up window as The
database
is
unavailable
with no error number provided.
Restart the database instance. See Appendix A, "Starting and Stopping an Oracle Database Instance".
2 Day + .NET Developer's Guide
11g Release 2 (11.2)
E10767-01
August 2009
Oracle Database 2 Day + .NET Developer's Guide, 11g Release 2 (11.2)
E10767-01
Copyright © 2006, 2009, Oracle and/or its affiliates. All rights reserved.
Primary Authors: Janis Greenberg, Roza Leyderman
Contributing Authors: John Paul Cook, Mark Williams
Contributors: Alex Keh, Christian Shay
This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited.
The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing.
If this software or related documentation is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, the following notice is applicable:
U.S. GOVERNMENT RIGHTS Programs, software, databases, and related documentation and technical data delivered to U.S. Government customers are "commercial computer software" or "commercial technical data" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, the use, duplication, disclosure, modification, and adaptation shall be subject to the restrictions and license terms set forth in the applicable Government contract, and, to the extent applicable by the terms of the Government contract, the additional rights set forth in FAR 52.227-19, Commercial Computer Software License (December 2007). Oracle USA, Inc., 500 Oracle Parkway, Redwood City, CA 94065.
This software is developed for general use in a variety of information management applications. It is not developed or intended for use in any inherently dangerous applications, including applications which may create a risk of personal injury. If you use this software in dangerous applications, then you shall be responsible to take all appropriate fail-safe, backup, redundancy, and other measures to ensure the safe use of this software. Oracle Corporation and its affiliates disclaim any liability for any damages caused by use of this software in dangerous applications.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
This software and documentation may provide access to or information on content, products, and services from third parties. Oracle Corporation and its affiliates are not responsible for and expressly disclaim all warranties of any kind with respect to third-party content, products, and services. Oracle Corporation and its affiliates will not be responsible for any loss, costs, or damages incurred due to your access to or use of third-party content, products, or services.
You may need to frequently stop and restart the database.
To start an Oracle Database Instance:
From the Start button, select Programs, then Administrative Tools, then Services, and select OracleServiceDatabaseName where DatabaseName is the service_name
of the database as indicated in the tnsnames.ora
file. See "Configuring a NET Connect Alias" for further details.
In the left panel, click the link to Start the service.
The database services begin and the Start Database window appears. Do not proceed until you see this message: "OracleService service was started successfully
".
To stop an Oracle Database Instance:
From the Start button, select Programs, then Administrative Tools, then Services, and select OracleServiceDatabaseName.
In the left panel, click the link to Stop the service.
The database begins to shut down, showing the Stop Database window. Do not proceed until you see this message: "OracleService service was stopped successfully
".
Because you will be using this application to learn about various aspects of application development with Oracle, you should make copies of your form for reuse.
To create a copy of an existing form:
In the Solution Explorer, right-click on Form
1
.xx
or any other file you need to copy. Select Copy.
If Form
1
.xx
does not appear in the Solution Explorer, from the Project menu, select Show All Files.
Right-click HR_Connect_CS or other project. Select Paste.
Right-click Copy of Form1.cs. Select Rename. Change the name of the form to Form2.cs.
Right-click on Form2.cs, and select Include In Project.
Right-click on Form1.cs
, and select Exclude From Project.
You can include and exclude forms from the project just by reversing these steps.
Note: This process generally works smoothly. If you encounter a problem, try running Rebuild Solution from the Build menu. |
This document is intended as an introduction to application development on Oracle Database with Oracle technologies for the Microsoft .NET Framework.
We assume that users of this book have already read the Oracle Database 2 Day DBA and the Oracle Database 2 Day Developer's Guide, are familiar with basics of SQL and PL/SQL, and know how to use Microsoft Visual Studio.
Our goal is to make Oracle products, services, and supporting documentation accessible to all users, including users that are disabled. To that end, our documentation includes features that make information available to users of assistive technology. This documentation is available in HTML format, and contains markup to facilitate access by the disabled community. Accessibility standards will continue to evolve over time, and Oracle is actively engaged with other market-leading technology vendors to address technical obstacles so that our documentation can be accessible to all of our customers. For more information, visit the Oracle Accessibility Program Web site at http://www.oracle.com/accessibility/
.
Accessibility of Code Examples in Documentation
Screen readers may not always correctly read the code examples in this document. The conventions for writing code require that closing braces should appear on an otherwise empty line; however, some screen readers may not always read a line of text that consists solely of a bracket or brace.
Accessibility of Links to External Web Sites in Documentation
This documentation may contain links to Web sites of other companies or organizations that Oracle does not own or control. Oracle neither evaluates nor makes any representations regarding the accessibility of these Web sites.
Deaf/Hard of Hearing Access to Oracle Support Services
To reach Oracle Support Services, use a telecommunications relay service (TRS) to call Oracle Support at 1.800.223.1711. An Oracle Support Services engineer will handle technical issues and provide customer support according to the Oracle service request process. Information about TRS is available at http://www.fcc.gov/cgb/consumerfacts/trs.html
, and a list of phone numbers is available at http://www.fcc.gov/cgb/dro/trsphonebk.html
.
For more information, see the following documents in Oracle Database documentation set:
Oracle Developer Tools for Visual Studio Dynamic Help
Oracle Database Express Edition Installation Guide for Microsoft Windows
The following text conventions are used in this document:
Convention | Meaning |
---|---|
boldface | Boldface type indicates graphical user interface elements associated with an action, or terms defined in text or the glossary. |
italic | Italic type indicates book titles, emphasis, or placeholder variables for which you supply particular values. |
monospace | Monospace type indicates commands within a paragraph, URLs, code in examples, text that appears on the screen, or text that you enter. |