ASP Connection Database

Source: Internet
Author: User
Data | Database system environment:

1, operating system: Windows 2000
2. Database: Oracle 8i R2 (8.1.6) for NT Enterprise Edition
3, Installation path: C:\ORACLE





Access method:
1, connect to the Sql*plus to System/manager user login,sql> conn system/manager Create new users: such as User1/pass1, give Connect,resource permissions. Sql> Grant Connect,resource to User1 identified by Pass1; Sql> conn user1/pass1sql> CREATE TABLE Test (a date); Instance name of Oracle database, in this case: Oradboracle username, In this example: User1oracle host string: Oradbtnsnames.ora file oradb = (DESCRIPTION = (Address_list = (address = (PROTOCOL = TCP) (host = 192.1.1. 1) (PORT = 1521))) (Connect_data = (service_name = oradb))) 2, create test.asp under the IIS default WWW directory, with notebook edit, enter the following code <%<br> Set Conn=server.createobject ("Adodb.connection") <br>dns= "PROVIDER=ORAOLEDB.ORACLE.1;" Persist Security info=true; User Id=user1; Password=pass1;data source=oradb "<br>conn. Open dns<br><br>sql= "INSERT INTO Test (a) VALUES (sysdate)" <br>set Rs=conn.execute (SQL) <br> <br>set Rs=nothing<br>conn.close<br>set conn=nothing<br>%><br><br><% <br>set conn=server.createobject ("adodb.connection") <br>dns= "provider=oraoledb.oracle.1"; Persist Security info=true; User Id=user1; Password=pass1;data source=oradb "<br>conn. Open dns<br><br>sql= "Select To_char (A, ' hh24:mi:ss ') from Test" <br>set Rs=conn.execute (SQL) <br ><br>do while (not rs.eof) <br>%><br><table border=1><br><tr><td> <%=rs.fields (0). Value%></font></td><br></tr><br><%<br>rs.movenext <br>loop<br><br>rs.close<br>set Rs=nothing<br>conn.close<br>set conn=nothing <br>%><br>3, open a browser window, enter the following address to view the results of the operation, you can continue to press the F5 key to refresh the display results http://localhost/test.asp



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.