Can I also have the steps as far as starting the project or give me a link to accomplish this. I am new to ASP.Net and this is my first and only project
Step 2: Set Oracle_Home environment.
For example: Set Oracle_Home = C:\oracle\product\10.2.0\client_1
Step 3: Create sqlnet.ora and tnsnames.ora files under:
<Oracle_Home>\NETWORK\ADMIN
To setup connection, you can use tnsping to test it.
For example: tnsping your_oracle_service
Step 4: Add reference Oracle.DataAccess.dll
Sample Code:
<%@ Page Language="VB" %>
<%@ Import Namespace="Oracle.DataAccess.Client" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim cn As OracleConnection = New OracleConnection()
Dim strconn As String
strconn = "Data Source = "
strconn &= "(DESCRIPTION = "
strconn &= " (ADDRESS_LIST ="
strconn &= " (ADDRESS = (PROTOCOL = TCP)(HOST = your_oracle_server)(PORT = 1521))"
strconn &= " )"
strconn &= " (CONNECT_DATA ="
strconn &= " (SERVICE_NAME = your_oracle_service)"
strconn &= " )"
strconn &= ");"
strconn &= "User Id=your_userid;"
strconn &= "password=your_password;"
'If you do set up tnsnames.ora , you can use the following code:
'strconn = "user id=your_userid;password=your_password;data source=your_oracle_server/your_oracle_service"
cn.ConnectionString = strconn
cn.Open()
Response.Write(cn.ServerVersion)
End Sub
</script>
We are struggling to connect to Oracle 10g from our ASP.NET 2.0. We have these installed on our dedicated server.
We're trying to figure out the Connection String so that the ASPX pages can read the Oracle database. Do we need to take all the steps that you listed? Do your steps pertain to the server or to the client?
With regards to your Connection String, we have never been able to figure out Data Source, Host, your_oracle_service or your_oracle_server for Oracle 10g. How do we do this? In Oracle Database Home Page, it does not give the Database Name. Is it "SYSTEM"?
This is the first time I've tried an Oracle connection and I completed all the above steps (but in C#) and still NO connection. I continue to receive the "Database error: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor"
error message.
mikensu
0 Points
15 Posts
How to connect to Oracle
Aug 14, 2007 04:34 PM|LINK
Here is my code
Public Shared strConString As String = "data source=Oracle;user id=scott;password=tiger"
How do I excess the string to see if i am connected.
johram
All-Star
28531 Points
3567 Posts
Re: How to connect to Oracle
Aug 14, 2007 08:46 PM|LINK
See guide here: http://www.startvbdotnet.com/ado/oracle.aspx
mikensu
0 Points
15 Posts
Re: How to connect to Oracle
Aug 15, 2007 03:01 PM|LINK
Can I also have the steps as far as starting the project or give me a link to accomplish this. I am new to ASP.Net and this is my first and only project
StevenSw
Participant
1486 Points
292 Posts
Re: How to connect to Oracle
Aug 16, 2007 12:55 PM|LINK
Couple questions:
Radical Development
Dont forget to click "Mark as Answer" on the post that helped you.
ecocoma
Member
2 Points
1 Post
Re: How to connect to Oracle
Aug 17, 2007 04:07 PM|LINK
Step 1: Install Oracle10g Release 2 ODAC and Oracle Developer Tools for Visual Studio .NET
http://www.oracle.com/technology/software/tech/dotnet/utilsoft.html
Step 2: Set Oracle_Home environment.
For example: Set Oracle_Home = C:\oracle\product\10.2.0\client_1
Step 3: Create sqlnet.ora and tnsnames.ora files under:
<Oracle_Home>\NETWORK\ADMIN
To setup connection, you can use tnsping to test it.
For example: tnsping your_oracle_service
Step 4: Add reference Oracle.DataAccess.dll
Sample Code:
<%@ Page Language="VB" %> <%@ Import Namespace="Oracle.DataAccess.Client" %> <script runat="server"> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Dim cn As OracleConnection = New OracleConnection() Dim strconn As String strconn = "Data Source = " strconn &= "(DESCRIPTION = " strconn &= " (ADDRESS_LIST =" strconn &= " (ADDRESS = (PROTOCOL = TCP)(HOST = your_oracle_server)(PORT = 1521))" strconn &= " )" strconn &= " (CONNECT_DATA =" strconn &= " (SERVICE_NAME = your_oracle_service)" strconn &= " )" strconn &= ");" strconn &= "User Id=your_userid;" strconn &= "password=your_password;" 'If you do set up tnsnames.ora , you can use the following code: 'strconn = "user id=your_userid;password=your_password;data source=your_oracle_server/your_oracle_service" cn.ConnectionString = strconn cn.Open() Response.Write(cn.ServerVersion) End Sub </script>http://www.ecocoma.com/
mikensu
0 Points
15 Posts
Re: How to connect to Oracle
Aug 17, 2007 05:03 PM|LINK
TNS Ping Utility for 32-bit Windows: Version 9.2.0.3.0 - Production on 17-AUG-20
07 12:35:02
Copyright (c) 1997 Oracle Corporation. All rights reserved.
Used parameter files:
C:\oracle\ora92\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = testoracle)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE
_NAME = prod) (SID = prod)))
OK (20 msec)
BugInfested
Member
420 Points
107 Posts
Re: How to connect to Oracle
Oct 23, 2007 11:44 PM|LINK
eCocoma,
We are struggling to connect to Oracle 10g from our ASP.NET 2.0. We have these installed on our dedicated server.
We're trying to figure out the Connection String so that the ASPX pages can read the Oracle database. Do we need to take all the steps that you listed? Do your steps pertain to the server or to the client?
With regards to your Connection String, we have never been able to figure out Data Source, Host, your_oracle_service or your_oracle_server for Oracle 10g. How do we do this? In Oracle Database Home Page, it does not give the Database Name. Is it "SYSTEM"?
Curt
britemareena
Member
10 Points
5 Posts
Re: How to connect to Oracle
Jan 14, 2008 03:38 PM|LINK
Its realy good. But how we know about the default database in oracle. Is it "ora"?
.net 2.0
John Happy
Member
23 Points
34 Posts
Re: How to connect to Oracle
Jan 15, 2008 02:00 AM|LINK
I just installed the Oracle 10g Express Edition without customizing any paths or names on my Windows 2003 Server....
This Visual Basic code works for me on my asp.net web page:
<%@ Page Language="VB" Debug="True" %> <%@ Import Namespace="System.Data" %> <% @ Import Namespace="Oracle.DataAccess.Client"%> <% @ Import Namespace="Oracle.DataAccess.Types" %> Dim cn As New OracleConnection("Data Source=216.255.200.XX1/XE;User ID=myID;Password=myPW")jsblakley
Member
89 Points
19 Posts
Re: How to connect to Oracle
Jan 15, 2008 02:05 PM|LINK
This is the first time I've tried an Oracle connection and I completed all the above steps (but in C#) and still NO connection. I continue to receive the "Database error: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor" error message.
Can someone please help me back on track?
Thanks!