I'm testing a simple VB.Net (Visual Studio 2008) Windows Application, i.e. a form with one command button.
My machine is running Windows XP Professional with SP2 and has the Oracle9i R2 Client installed.
I'm trying to connect to a remote Oracle9i database hosted on the LAN.
I eventually need to insert rows into Oracle tables using VB.Net web services methods called synchronously.
However, I need immediate assistance in setting up a successful VB.Net Oracle9i connection string and retrieve rows from a table. Then display the retrieved rows in a window.
How can I display the retrieved rows?
After I overcome this hurdle, I'll be closer to my real objective of inserting rows into the Oracle table using the same connection.
Of course, I searched the archives on this site and tested several Oracle connection strings with
sample code to retrieve rows from an Oracle table. Of course, I haven't had any success so far.
Hopefully, someone can help me get over the hump.
The following Button code built successfully but the Oracle connection failed after checking the
sqlnet.log file generated by Oracle.:
Public Class Form1
Dim myConnection As OleDbConnection
Dim myCommand As OleDbCommand
Dim dr As OleDbDataReader
Private Sub Test_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Test_Button.Click
myConnection = New OleDbConnection
myConnection.ConnectionString = "Provider=MSDAORA.1;UserID=REPTUSER;password=r3p0rts;database=SIG9I.CITODNS.GOV.BZ"
'MSDORA is the provider when working with Oracle
'opening the connection
myCommand = New OleDbCommand("SELECT * FROM tax_centre", myConnection)
'executing the command and assigning it to connection
dr = myCommand.ExecuteReader()
'reading from the datareader
Windows.Forms.MessageBox.Show("TAX_CENTRE_NO" & dr(0))
Windows.Forms.MessageBox.Show("TAX_CENTRE_DESC" & dr(1))
Windows.Forms.MessageBox.Show("CONTACT_INFO" & dr(2))
Windows.Forms.MessageBox.Show("REV_DEPT_NO" & dr(3))
'displaying data from the table
Catch ex As Exception
The sqlnet.log file has the following error:
Fatal NI connect error 12560, connecting to:
I observe that the connection is not being made to the Oracle database that I specified in the
connection string. Also Oracle is trying to connect to a local database (BEQ) instead of using the
SQLNET,ora file containing the connection information for the database specified in the
Thanks in advance for your help. Knowledge is power, but it is only useful if it is shared.