473,766 Members | 2,055 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

is it possible to access an Oracle db in .net

this may seem a trivial question (as .net may have been solely developed for
this purpose),
but i'm not certain whether this is possible,

i.e. is it possible to access an Oracle DB in .NET (and is it the same as
accessing any other db - except for the connection string & object).
What is mean is, can i use the same select statements, update statements
with the orable database that i used with MSDE & SQL database?

thank u all
Nov 21 '05 #1
5 2069
rs
http://msdn.microsoft.com/library/de...ClassTopic.asp
"Amueerie" <a_*******@msn. com> wrote in message
news:u%******** ********@TK2MSF TNGP10.phx.gbl. ..
this may seem a trivial question (as .net may have been solely developed
for
this purpose),
but i'm not certain whether this is possible,

i.e. is it possible to access an Oracle DB in .NET (and is it the same as
accessing any other db - except for the connection string & object).
What is mean is, can i use the same select statements, update statements
with the orable database that i used with MSDE & SQL database?

thank u all

Nov 21 '05 #2
Bob
Hi,
Yes,
Change your declaration of the data access variables to the oracle flavour.
Following snippet shows using a compiler directive to control which database
this routine is looking at.
Oracle have OMWB (Oracle migration workbench) which will do a passable job
of converting an SQL Server database to an Oracle one.
The caveat being that you will have to massage the stored procedures to get
them to work.
If you go this way then suggest a copy of TOAD as it takes away the pain
when working with Oracle schemas.
Note: that you need a a cursor output parameter to get data back with an
Oracle SPROC. ( You'll see this below)
HTH
Bob
#If Not Oracle Then

Dim cmdConn As New SqlClient.SqlCo mmand

Dim cmdSource As SqlClient.SqlDa taReader

Try

cmdConn = New SqlClient.SqlCo mmand(strSQL, New
SqlClient.SqlCo nnection(mstrCo nn))

strSQL = "exec proc_GetContact @contact_id"

cmdConn.Paramet ers.Add(New SqlParameter("@ contact_id", SqlDbType.Int))

cmdConn.Paramet ers("@contact_i d").Value = intContactID

cmdConn.Command Text = strSQL

cmdConn.Connect ion.Open()

cmdSource = cmdConn.Execute Reader(CommandB ehavior.CloseCo nnection)

'End If

If cmdSource.Read Then

C.ID = cmdSource.GetSq lInt32(0).Value

If Not cmdSource.GetSq lString(1).IsNu ll Then C.Firstname =
cmdSource.GetSq lString(1).Valu e

If Not cmdSource.GetSq lString(2).IsNu ll Then C.Surname =
cmdSource.GetSq lString(2).Valu e

If Not cmdSource.GetSq lString(3).IsNu ll Then C.EmailAddress =
cmdSource.GetSq lString(3).Valu e

If Not cmdSource.GetSq lString(4).IsNu ll Then C.SMSAddress =
cmdSource.GetSq lString(4).Valu e

If Not cmdSource.GetSq lString(5).IsNu ll Then C.Phone =
cmdSource.GetSq lString(5).Valu e

If Not cmdSource.GetSq lString(6).IsNu ll Then C.FAX =
cmdSource.GetSq lString(6).Valu e

Return True

End If

Catch obja As System.Exceptio n

WriteErrorLog(" DT.GetContactLi st Error " & obja.Message)

Finally

cmdSource.Close ()

cmdConn.Dispose ()

End Try

#Else

Dim cmdConn As OracleClient.Or acleCommand

Dim cmdSource As OracleClient.Or acleDataReader

Try

strSQL = "proc_GetContac t"

cmdConn = New OracleClient.Or acleCommand(str SQL, New
OracleClient.Or acleConnection( mstrConn))

cmdConn.Paramet ers.Add(New OracleParameter ("contact_id ", OracleType.Numb er,
0, ParameterDirect ion.Input, _

True, 0, 0, "", DataRowVersion. Default, mydbNull))

cmdConn.Paramet ers.Add(New OracleClient.Or acleParameter(" o_cursor",
OracleClient.Or acleType.Cursor , _

2000, ParameterDirect ion.Output, True, 0, 0, "", DataRowVersion. Default,
mydbNull))

cmdConn.Command Type = CommandType.Sto redProcedure

cmdConn.Paramet ers("contact_id ").Value = intContactID

cmdConn.Connect ion.Open()

cmdSource = cmdConn.Execute Reader(CommandB ehavior.CloseCo nnection)

'End If

If cmdSource.Read Then

C.ID = CInt(cmdSource. GetOracleNumber (0).Value)

If Not cmdSource.GetOr acleString(1).I sNull Then C.Firstname =
cmdSource.GetOr acleString(1).V alue

If Not cmdSource.GetOr acleString(2).I sNull Then C.Surname =
cmdSource.GetOr acleString(2).V alue

If Not cmdSource.GetOr acleString(3).I sNull Then C.EmailAddress =
cmdSource.GetOr acleString(3).V alue

If Not cmdSource.GetOr acleString(4).I sNull Then C.SMSAddress =
cmdSource.GetOr acleString(4).V alue

If Not cmdSource.GetOr acleString(5).I sNull Then C.Phone =
cmdSource.GetOr acleString(5).V alue

If Not cmdSource.GetOr acleString(6).I sNull Then C.FAX =
cmdSource.GetOr acleString(6).V alue

Return True

End If

Catch obja As System.Exceptio n

WriteErrorLog(" DT.GetContactLi st Error " & obja.Message)

Finally

cmdSource.Dispo se()

If cmdConn.Connect ion.State <> ConnectionState .Closed Then

cmdConn.Connect ion.Close()

End If

cmdConn.Dispose ()

End Try

#End If
"Amueerie" <a_*******@msn. com> wrote in message
news:u%******** ********@TK2MSF TNGP10.phx.gbl. ..
this may seem a trivial question (as .net may have been solely developed for this purpose),
but i'm not certain whether this is possible,

i.e. is it possible to access an Oracle DB in .NET (and is it the same as
accessing any other db - except for the connection string & object).
What is mean is, can i use the same select statements, update statements
with the orable database that i used with MSDE & SQL database?

thank u all

Nov 21 '05 #3
Amueerie,

You can use OleDB for almost everything, however it is not clever.
There are 3 main base classes which acts (almost) the same
SQLClient for SQL Server
OracleClient for Oracle
OleDb for the rest

In my opinion is it better to create seperate classes for the database
handling for those or integrate in your classes for that the different
types.

Just my thought,

Cor
Nov 21 '05 #4
"Amueerie" <a_*******@msn. com> schrieb:
i.e. is it possible to access an Oracle DB in .NET (and is it the same as
accessing any other db - except for the connection string & object).
What is mean is, can i use the same select statements, update statements
with the orable database that i used with MSDE & SQL database?


..NET Framework Developer's Guide -- .NET Framework Data Providers
<URL:http://msdn.microsoft. com/library/en-us/cpguide/html/cpconADONETProv iders.asp>

<URL:http://support.microso ft.com/search/?catalog=LCID%3 D1033&query=Ora cle+.NET>

<URL:http://www.connections trings.com/>
-> "Oracle"

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #5
> i.e. is it possible to access an Oracle DB in .NET (and is it the same as
accessing any other db - except for the connection string & object).
The objects are not exactly the same, they are OraXXX objects. The only way
to use portable objects is to use the underlying IdbXXX interfaces that
implement the objects.
What is mean is, can i use the same select statements, update statements
with the orable database that i used with MSDE & SQL database?


Surely not. MSDE and SQL Server uses Transact SQL while Oracle uses PL/SQL.
That means that SQL statements can vary slightly. The industry has done 2
attempts to solve this problem:

- Make vendors to be compliant with ANSI SQL. The conformance level is
increasingly better, but you have to verify your SQL statements.
- Microsoft provided neutral ODBC syntax which at least ODBC drivers and
OLEDB providers support, not sure about .NET Data Providers.

--

Carlos J. Quintero

MZ-Tools 4.0: Productivity add-ins for Visual Studio .NET
You can code, design and document much faster.
http://www.mztools.com
Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
5411
by: sedefo | last post by:
I ran into this Microsoft Patterns & Practices Enterprise Library while i was researching how i can write a database independent data access layer. In my company we already use Data Access Application Block (DAAB) in our .Net projects. We use SqlHelper in SQL based projects, and OracleHelper in Oracle based ones. OracleHelper was not published officially by Microsoft as part of the DAAB but it was given as a helper code in a sample .Net...
3
23457
by: Jon Ole Hedne | last post by:
My Access 2002-application need to work with tables from both Oracle and Access. To solve this, I want to run some querys on three views in Oracle and import the results into temporary Access-tables. I have tried this: conn.Provider = "Microsoft.Jet.OLEDB.4.0" conn.ConnectionString = "data source=" & datafil & ";Jet OLEDB:Database Password=" conn.Open datafil
10
3535
by: Andrea M. Segovia | last post by:
Hello, I am a newbie to Oracle databases.... We have a visualization front-end tool connected to an Oracle back-end database on a Tru64 UNIX server. We also have clients with MS access databases who would like to share their data using this visualization tool but do not want to import their data into the Oracle server back-end.
13
3325
by: BigDaDDY | last post by:
Um yeah....In case you haven't figured it out, Microsoft sucks. I'm going to be kicked back in my chair eating popcorn and watching football 10 years from now, while all you clowns are scrambling to rewrite all your code because Microsoft upgraded all their crap and nothing you wrote 10 years earlier works. It doesn't take a rocket scientist to figure out that Microsoft is unreliable. Try opening an Excel 95 spreadsheet you wrote in...
1
9199
by: Andrew Arace | last post by:
I scoured the groups for some hands on code to perform the menial task of exporting table data from an Access 2000 database to Oracle database (in this case, it was oracle 8i but i'm assuming this will work for 9i and even 10g ) No one had what I needed, so I wrote it myself. I Rule. This code isn't going for efficiency, and isn't trying to be dynamic. It doesn't create the table structure in Oracle, that's up to you. (I
11
17061
by: Rosco | last post by:
Does anyone have a good URL or info whre Oracle and Access are compared to one another in performance, security, cost etc. Before you jump on me I know Oracle is a Cadillac compared to Access the Ford Fairlane. I need this info to complete a school project. Thanks.
6
1695
by: M. Schroeder | last post by:
I use an Access-form to write into an external Oracle table via Oracle-ODBC driver. It is not a read-only connection, and batch autocommit mode set to "all successful statements". I can read all records from table, but update, insert, and delete is allowed on form level, but I cannot change records and I cannot insert. Whats wrong? Thanks, Schroeder
2
4239
by: egoldthwait | last post by:
I need to convert a 17mb access 2000 db to Oracle and house it in a Citrix farm. The issue: we have never converted an Access Db to Oracle but can probably use Oracle's Workbench to assist with this. Also - the citrix folks do not want us to keep the FE in Access as the queries and other activities consume a lot of power. The users will be in 3 different offices across the globe all accessing the 1 Oracle DB in Citrix. Does anyone have...
8
1754
by: Lykins | last post by:
We currently use Access 2003 in our company and have had this issues from every version from Access 97 to 2003. We deal with large databases and run a lot of queries over tables with millions of records in them. The problem comes in that when we pull a dataset out of a large table we do not get the same result every time. Example is transaction count for store 1 shows 3000 one time, the next run it is 3015, the next is 2089. All of...
0
10168
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9959
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9837
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6651
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2806
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.