Recently, you need to access the database in Oracle. To use using system. Data. oracleclient, you still need to install the Oracle client, but do not want to install the complete client. An odac is installed, which is Oracle. and then you can reference using Oracle. dataaccess. client. net compatibility is not as good as the classes provided by Microsoft, so system is used. data. oracleclient.
Find the directory where odac is installed and find ...... \ Network \ ADMIN folder. Because Oracle 11g is installed, there is a sample folder, copy the two files to the admin folder, and open tnsnames in notepad. ora changes the sample data to the data to be accessed, as shown in figure
TTT =
(Description =
(Address_list =
(Address = (Protocol = TCP) (host = **. *. **. **) (Port = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
ThenProgramUse the connection string "Data Source = TTT; user id = sa; Password = sa;"; to access