Connect to Oracle database in C# ASP

Posted on 2007-03-20
Last Modified: 2013-12-19
Please help me in connecting to Oracle via a VPN connection.
My database is located on my school's server.  I can connect to it using the following parameters:
    * Name:
    * Port: 1521
    * Oracle SID: ite10g

 As long as I'm on the school network I can connect.  But I am not sure how to add these parameters for my ASP page.  Thank you,
Question by:adajani1
  • 3
  • 2
  • 2
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
What data provider are you wanting to use?  I suggest ODP.Net which is Oracle's .Net data provider but some people like OLEDB and use either Oracle's or Microsofts.

Once you have the dataprovider installed you'll just need the proper references.

There's a decent page that has just about ever type of connection string available:

Author Comment

Comment Utility
MY *.asp page will be on the school's network.

I was only provided with the above parameters.   Not sure what driver they installed.

Author Comment

Comment Utility
I did an application with java b4 using the following parameters and it worked.. I just don't know how to include this info for my ASP.

String driverName = "oracle.jdbc.driver.OracleDriver";

       System.out.println("Connecting   to Oracle...");  

       String url = "";
       Connection conn = DriverManager.getConnection(url,"name","password");

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

LVL 76

Accepted Solution

slightwv (䄆 Netminder) earned 250 total points
Comment Utility
It's very similar in .Net to the Java connection you posted.

I would guess the Microsoft OLEDB for Oracle driver.

Take a look at:

If you're still unsure, here's a simple .Net page using VB.Net and ODP.Net.  Hopefully it will give you a starting place.
<%@ import namespace = "System.Data" %>
<%@ import namespace = "System.XML" %>
<%@ import namespace = "Oracle.DataAccess.Client" %>
<%@ import namespace = "Oracle.DataAccess.Types" %>

<title>simple DB test</title>

<script language="VB" runat="server">

sub page_load(sender as object,e as eventargs)

      Dim con As New OracleConnection("User Id=<user>;Password=<pass>;Data Source=<DBAlias>;")

      Dim cmd as OracleCommand = new OracleCommand()
      cmd.Connection      = con
      cmd.CommandType      = CommandType.Text
      cmd.commandText      = " select  sysdate from dual "


            response.write("<br/>Got: " &  cmd.executeScalar())

      catch ex as exception
            response.write("Error: " & ex.message)

      end try
end sub



Assisted Solution

ramumorla earned 250 total points
Comment Utility
This is a common problem on VPN connections

Try to  ping your server with FQDN (ping 99.99% the ping will fail
then if it fails, learn the ip address of the oracle server from ur admin and replace
 with the ip address.

Your problem is solved-- Very simple
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
I suggest a split between ramumorla and myself.

Expert Comment

Comment Utility
i agree

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows how to recover a database from a user managed backup

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now