ASP Script Home » ADO » Connecting to Oracle 9i the ASP Way for standalone
Connecting to Oracle 9i the ASP Way for standalone
Category: ADO
Added on: 5/2/2003 Hits: 14548 Rating: (3.20) votes 61
Rate: 1-star 2-stars 3-stars 4-stars 5-stars
E-mail this Script to a friend Bookmark this ASP Script
I am here giving you both the dsn as well as the dsnless connection for Oracle 9i connection with ASP applications. A dynamic way to explore the best database and scripting language.
Code
First the DSN Connection.
1) Create a Connection
->Go To the settings
->Control panel
->ODBC
->System DSN
->ADD-> Oracle In OraHome90
It will show you a screen with"Oracle ODBC Driver Configuration"
->Call the Data Source Name "ORA" Or whatever you want. Here I am calling it "ORA" For this example.
APPLICATION
-----------
At Enable Result Sets
->Check On Enable Query Timeout ->Read only connection(For Data Manipulation statement enable this). The rest you can apply As And when you require specific functions.
->Leave the default For the rest.
->Click On "Test Connection". If you have installed your personal Oracle 9i well, it should start up your database "Mounting Database"
[In the taskbar you will have a small blue color database icon displaying your database Is mounted]
->It will Open up another window called "Oracle ODBC Driver Connect"
-> As it Is a personal database With no service name, leave the service name blank.
-> For testing purpose use the default username="scott" And password="tiger"
->If you have come so far successfully it will say "Connection Successful"
Now you are all Set For testing your trial program.
As we are going To try In Windows -PWS For checking ASP
I am creating a folder called "ASP-oracle" In c:\inetpub\wwwroot\
This will be my working environment For the testing.
Create a file by any name inside this. I am calling it trial.asp
Copy And paste the following code To test.
Connecting To an Oracle database using ODBC And DSN connection
==============================================================
<%@language="vbscript"%>
<HTML>
<HEAD>
<TITLE>JULIE GEORGE'S-DSN CONNECTION TO ORACLE</TITLE>
</HEAD>
<BODY>
<%
Set jul_conn=Server.CreateObject("adodb.connection")
jul_conn.Open "DSN=ORA;" & _
"Uid=scott;" & "Pwd=tiger"
SQLStr="SELECT empno, ename, deptno FROM Emp ORDER BY deptno, ename"
Set jul_ora=jul_conn.execute(SQLStr)
If Not jul_ora.EOF Then
Response.Write("<P>Connecting to Oracle the ASP way</P>")
Response.Write("<TABLE border=1><TR><TH>Employee No</TH>" & _
"<TH>Name</TH><TH>Department No</TH>")
Do While Not jul_ora.EOF
Response.Write("<TR><TD>" & jul_ora("empno") & "</TD>")
Response.Write("<TD>" & jul_ora("ename") & "</TD>")
Response.Write("<TD>" & jul_ora("deptno") & "</TD></TR>")
jul_ora.movenext()
Loop
Response.Write("</TABLE>")
Else
Response.Write("<P>No Records...!!</P>")
End If
%>
</BODY>
</HTML>
This Is a simple code just For viewing your connected Oracle Database the ASP way!
Execute it by going To http://localhost/ASP-oracle/trial.asp
You will be able To view your simple employee database.
--------------------------------------------------------------------------------------------
DSNLESS CONNECTION Is MUCH EASIER And USEFUL
-------------------------------------------------------------------------------------------
Assuming you have created a folder called "ASP-oracle"
Try working In the same folder For testing For it will easy To work around your logics then.
I will create here another file called "trial1.asp". The only difference will be the connection string.
Connecting To an Oracle database using OLE And DSNLess connection
<%@language="vbscript"%>
<HTML>
<HEAD>
<TITLE>JULIE GEORGE'S-DSNLESS CONNECTION TO ORACLE</TITLE>
</HEAD>
<BODY>
<%
Set jul_conn=Server.CreateObject("adodb.connection")
jul_conn.Open "Provider=OraOLEDB.Oracle; Data Source=;" & _
"User ID=scott;" & "Password=tiger"
jul_str="SELECT empno, ename, deptno FROM Emp ORDER BY deptno, ename"
Set jul_rs=jul_conn.execute(jul_str)
If Not jul_rs.EOF Then
Response.Write("<P>Connecting to Oracle the ASP way</P>")
Response.Write("<TABLE BORDER=1><TR>" & _
"<TH>Employee No</TH><TH>Name</TH><TH>Department No</TH>")
While Not jul_rs.EOF
Response.Write("<TR><TD>" & jul_rs("empno") & "</TD>")
Response.Write("<TD>" & jul_rs("ename") & "</TD>")
Response.Write("<TD>" & jul_rs("deptno") & "</TD></TR>")
jul_rs.movenext()
Wend
Response.Write("</TABLE>")
Else
Response.Write("<P>No Records Found!!</P>")
End If
%>
</BODY>
</HTML>
Execute it by going To http://localhost/ASP-oracle/trial1.asp
Will try To post the adding updating inserting Option In the next.
Useful Tip For Database Connection.
1)Use DSNLess connection
2)Keep the connection String In a seperate file And Call the file As an
include file In all the header of your applications.
This will help a great deal As manipulation of one file Is easier than
all your application files.
3) When testing keep your basics clear And simple logic To work.
All the best again For your research...It Is fun To work With Oracle 9i And ASP.
分享到:
相关推荐
### ASP 连接 Oracle 9i 数据库成功实例解析 #### 概述 在Web开发领域,特别是使用ASP(Active Server Pages)进行开发时,连接并操作后端数据库是必不可少的一项技能。本文将通过一个实际的例子来展示如何利用ASP...
5. **ASP (Application Server Pages)**:Oracle 9i也支持微软的ASP技术,通过Oracle ODBC桥接,开发者可以在ASP环境中利用Oracle数据库的强大功能。 6. **XML支持**:Oracle 9i引入了内置的XML处理能力,包括...
### 利用 DBCA 建立与管理 Oracle 9i 资料库 在探讨如何使用Oracle Database Configuration Assistant (DBCA)来建立Oracle 9i资料库之前,让我们先简要回顾Oracle 9i环境下的资料库管理概念。Oracle 9i是一款由甲骨...
### Oracle 9i 服务器端和客户端安装及配置详解 #### 一、环境准备与部署 根据提供的信息,本文档将详细介绍如何在虚拟机中安装Windows Server 2003并在此基础上安装Oracle 9i数据库服务器端和客户端,包括配置...
本文将详细介绍如何利用Database Configuration Assistant (DBCA) 创建一个Oracle 9i数据库。 Oracle 9i是Oracle数据库的一个版本,它在2001年发布,引入了许多新特性和改进,如数据仓库优化、自动存储管理(ASM)...
关于与Web开发相关的标签,如AJAX、ASP.NET、C#和Java、XML,Oracle 9i也提供了集成支持。AJAX(Asynchronous JavaScript and XML)可以用于创建交互式Web应用,与Oracle数据库结合,可以实现异步数据更新,提高用户...
在压缩包中,uninstall_oracle9i.reg和install_oracle9i.reg文件分别用于卸载和安装客户端。这些注册表脚本通常包含了安装过程中所需的关键信息,如安装路径、服务注册等,简化了客户端的部署流程。 安装说明.txt...
Oracle9i备课笔记——吕海东 第1讲 Oracle9i简介 目的: 1. 了解数据库的发展,关系数据库的基本原理。 2. 了解目前市场上流行的数据库产品及特点 3. 了解Oracle数据库的发展 4. 掌握Oracle9i产品系列 5. 掌握Oracle...
Oracle 9i是Oracle数据库产品的一个重要版本,它在2001年发布,提供了许多增强功能和优化,以满足企业级数据库管理的需求。Oracle 9i的核心知识点涵盖了数据库架构、安装与配置、性能调优、安全性、网络配置等多个...
Oracle 9i 纯粹实践入门由安装到编程全程图解 安装调试环境: <br>Oracle 版本: Oracle 9i 2.0.1.0 操作系统: Windows2003 server sp2 + IIS6.0 数据库连接类型为: 本地asp.net程序连接本地Oracle数据库...
3. **互联网连接性**:Oracle 9i加强了与互联网的集成,通过Internet Database Connector (IDC) 支持多种Web应用服务器和编程语言,如Java和ASP,使得数据库可以直接处理Web请求,提高Web应用的响应速度。...
传统的评教方式如机读卡和调查表存在诸多不便,因此提出了基于Oracle9i数据库和ASP技术的网络评教系统。 系统设计采用了三层B/S(Browser/Server)架构,包括用户层、中间层和数据层。用户层由ASP开发的用户界面...
xorg-x11-deprecated-libs-6%5B1%5D.9.0-1.112.16.14asp.i386.rpm xorg-x11-deprecated-libs-6.8.2-1.EL.52.i386.rpm xorg-x11-deprecated-libs-devel-6.8.2-1.EL.52.i386.rpm xorg-x11-devel-6.8.2-1.EL.52.i386....
同时,标签中的"ajax asp.net c# java vb.net"暗示了这些Web开发技术也可能是相关认证考试中的一部分,尽管不是Oracle 9i DBA的主要知识点,但可能在实际工作中与Oracle数据库的集成和应用开发中有所涉及。
Oracle Instant Client 11.2.0.1.0是轻量级Oracle客户端,用于连接访问Oracle 9i、10g、11g 11.2.0.1.0版本的Oracle数据库。 Oracle Instant Client11.2.0.1.0 安装程序包含OCI/ OCCI、JDBC-OCI SDK(软件开发工具...
- **9053 Oracle论坛**(http://www.9053.net/formu/flist.asp?cat_ID=21):提供了Oracle数据库技术的讨论区,适合于寻求技术帮助或参与讨论的用户。 以上这些网站不仅覆盖了Oracle的基础知识和技术细节,还包括了...
- Oracle 9i OCA:要获得9i OCA认证,考生需通过1z0-007和1z0-031两门考试,无须参加任何培训。 - Oracle 10g OCA:仅需通过1z0-042一门考试,同样不需要培训,即可获取10g OCA证书。 - Oracle 11g OCA:这里有三...
波谱库是国家863计划课题——我国典型地物标准波谱数据库的简称,是建立在Oracle 9i数据平台上的、以典型地物为基础的波谱数据体系,包括典型地物标准波谱测量数据、遥感影像数据库、先验知识库、模型库等。...
6. 兼容性:Oracle.DataAccess不仅支持最新的Oracle数据库版本,也向下兼容旧版本,如Oracle 9i、10g等,确保了代码的可移植性。 7. 错误处理和诊断:通过异常处理机制,Oracle.DataAccess能够提供详细的错误信息,...
- **课程地位**:在IT领域,Oracle与.NET/C#、SQL Server、XML、ASP.NET/Web Service等技术紧密相关,构成了软件开发和数据处理的重要组成部分。 - **课程目标**:旨在帮助学习者理解Oracle数据库体系结构、熟练运用...