After the connection is successful, you can query it. It looks like WindowsProgramIt looks like a doscommand line tool. after entering the SQL statement, select "file/Run" to execute the SQL statement.
Configuration file (this file should be configured before use), because it is a lite version, no graphical tool configuration, all notepad
# Databasename =
# (Description =
# (Address_list =
# (Address = (Protocol = TCP) (host = 127.0.0.1) (Port = 1521 ))
#)
# (CONNECT_DATA =
# (SERVICE_NAME = servicename)
#)
#)
Modify the example configuration that has been commented out.
Myoracle =
(Description =
(Address_list =
(Address = (Protocol = TCP) (host = 33.33.33.33) (Port = 1521 ))
)
(CONNECT_DATA =
(SERVICE_NAME = mysid)
)
)
Here, myoracle is a random name, and the data source of the connection string = myoracle; host, port Needless to say; SERVICE_NAME = mysid fill in the SID of the server database instance, the database is determined here.
After the configuration is complete, you can access Oracle in the program. The following example shows how to obtain the data of a table displayed on the page.
Using system. Data. oracleclient;
Oracleconnection con = new oracleconnection ("Data Source = myoracle; user id = xxx; Password = xxx ;");
Oraclecommand cmd = new oraclecommand ("select * from table", con );
Con. open ();
Oracledatareader DR = cmd. executereader (commandbehavior. closeconnection );
Gridview1.datasource = Dr;
Gridview1.databind ();
Dr. Close ();
-- Display all table information, similar to the show tables command of MySQL.
Select * From all_tables
-- Display the first few items, similar to SQL Server's select top
Select * from TB where rownum <= 5
-- From table name should be owner. table_name
Select * from Ms. mytable
-- The parameter symbols are different. For ORACLE: for SQL Server, for @ MySQL,?
Select * From tab where id =: myid