1. VB.netCodeAs follows:
Dim ss as string
'Specify the connection string => 0 K
Ss = "(description = (address_list = (address = (Protocol = TCP) (host = 192.168.77.128) (Port = 1521) (CONNECT_DATA = (SERVICE_NAME = orcl )))"
'Specify the name of the service that has been created through the Oracle client ==> OK
Ss = "ora_128"
'Data source created using ODBC
Ss = "orcl"
Dim myconnection as data. oledb. oledbconnection
Dim myoracledataadapter as data. oledb. oledbdataadapter
Myconnection = new data. oledb. oledbconnection ("provider = oraoledb. Oracle; Data Source =" + SS + "; user id = Scott; Password = tiger ")
Myoracledataadapter = new data. oledb. oledbdataadapter ("select 'A' from dual", myconnection)
Dim mydataset as data. dataset = new data. dataset ()
Myoracledataadapter. Fill (mydataset, "dual ")
Response. Write (txtname. Text + mydataset. Tables ("dual"). Rows (0) (0 ))
(Note: my personal feelings for these three methods are as good as possible. It seems that Java is directly connected using the protocol. Both the second and third types require the Oracle client to be installed. Configure the service name. Note that When configuring the ODBC data source, pay attention to the third method. Select system DSN and add ..., select the Oracle driver, for example, 'oracle in stronglient10g'. This is the driver for installing the Oracle client. Do not select Micrsoft ODBC for Oracle. Add the required information, that is, OK)
2. php connection to Oracle
$ SQL = "select 'A' from dual ";
// Use the Oracle connection string to directly establish a connection with the database ==> OK
$ Ss = "(description = (address_list = (address = (Protocol = TCP) (host = 192.168.77.128) (Port = 1521) (CONNECT_DATA = (SERVICE_NAME = orcl ))) ";
// Use the 'service name' created by the Oracle Net manager tool to connect to the instance => 0 K
$ Ss = "ora_128 ";
$ Handler = ocilogon ("Scott", "Tiger", $ SS, "al32utf8 ");
$ Stmt = ociparse ($ handler, $ SQL );
Ociexecute ($ stmt, oci_default );
// Traverse the result
If (ocifetchinto ($ stmt, $ row ))
{
Echo $ row [0];
}