473,396 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

IDbCommand, Oracle, Select query

Best programmer,

My mission is to execute a sql statement in vb.net and retrive the data
into a file. I have managed to detect som issues with my code:

queryString = "SELECT ...."

connectionString = "server=OraOLEDB.Oracle;User
id=x;password=x;Data source=x;"

Using connection As New SqlConnection(connectionString)
Dim command As New SqlCommand(queryString, connection)
Try
connection.Open()
Catch ex As Exception
If log.IsErrorEnabled Then log.Error(ex.Message)
End Try
Dim reader As SqlDataReader = command.ExecuteReader()

Try
While reader.Read()
writer.WriteLine(String.Format("{0}, {1}",
reader(0), reader(1)))
End While
Finally
reader.Close()
End Try
End Using
Error at connection.Open():

"An error has occurred while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the
fact that under the default settings SQL Server does not allow remote
connections. (provider: Named Pipes Provider, error: 40 - Could not
open a connection to SQL Server)"

this link : http://support.microsoft.com/kb/914277 is about how to
solve this my accepting remove access. But I think this is another
problem? I have no problem with my connectionstring...

I am running a oracle server with a database I am trying to access.

Any idea how I can reach my oracle db and get my information?

Regards,
Magnus

Dec 28 '06 #1
1 3083
On 28 Dec 2006 04:24:14 -0800, Magnus Flisberg wrote:
Best programmer,

My mission is to execute a sql statement in vb.net and retrive the data
into a file. I have managed to detect som issues with my code:

queryString = "SELECT ...."

connectionString = "server=OraOLEDB.Oracle;User
id=x;password=x;Data source=x;"

Using connection As New SqlConnection(connectionString)
Dim command As New SqlCommand(queryString, connection)
Try
connection.Open()
Catch ex As Exception
If log.IsErrorEnabled Then log.Error(ex.Message)
End Try
Dim reader As SqlDataReader = command.ExecuteReader()

Try
While reader.Read()
writer.WriteLine(String.Format("{0}, {1}",
reader(0), reader(1)))
End While
Finally
reader.Close()
End Try
End Using

Error at connection.Open():

"An error has occurred while establishing a connection to the server.
When connecting to SQL Server 2005, this failure may be caused by the
fact that under the default settings SQL Server does not allow remote
connections. (provider: Named Pipes Provider, error: 40 - Could not
open a connection to SQL Server)"

this link : http://support.microsoft.com/kb/914277 is about how to
solve this my accepting remove access. But I think this is another
problem? I have no problem with my connectionstring...

I am running a oracle server with a database I am trying to access.

Any idea how I can reach my oracle db and get my information?

Regards,
Magnus
If you're connecting to an oracle database i suggest you look at the
OracleConnection, OracleCommand and the OracleDataReader classes. Those
would be the ideal classes to use for data access from an Oracle database
--
Bits.Bytes
http://bytes.thinkersroom.com
Dec 28 '06 #2

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

Similar topics

4
by: francis70 | last post by:
Hi, I have these 2 problem? Is there a way in Oracle to read UNCOMMITED data. i.e. in Oracle the normal behaviour is that a user's updates to a table are visible to other users ONLY when the...
4
by: susmita_ganguly | last post by:
Hi I am trying to upgrade from oracle 8i to oracle 9i on the same server ..I don't know much abt migration . Can anyone help me out. Thanks. Susmita
7
by: vnl | last post by:
I'm trying to run a SQL query but can't find any records when trying to select a certain date. Here's the sql: SELECT field 1, field2, date_and_time, FROM table1 WHERE date_and_time =...
11
by: Markus Breuer | last post by:
I have a question about oracle commit and transactions. Following scenario: Process A performs a single sql-INSERT into a table and commits the transaction. Then he informs process B (ipc) to...
1
by: Cern | last post by:
Is it somebody out there who has made a migration from an Oracle server to an MySQL server?? The scenario is as simply: I've got a Oracle 8 server with a database with content that I want to...
8
by: Alfonso Esteban Gonzalez Sencion | last post by:
I am trying to use Access as a front end for extracting information from an Oracle database. I started using linked tables but I am getting a very curious behaviour. When I consult the linked...
0
by: totierne | last post by:
comp.databases.ms-access, I want to know how to use Oracle views with session variables in Access. The parameterised views in access, are migrated to views with per session variables. The...
5
by: jonceramic | last post by:
Hi All, I started developing in Access, and people took notice and so we're starting to migrate into our corporate's bigger Oracle system. I'll still be using my developed Access front ends,...
7
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Run multiple SQL statements from ASP/ADO to an Oracle 10g. Please help, I'm trying to write an ASP page to use ADO to run a long query against an Oracle 10g database, to create tables,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.