こんにちは、私はOracle DBに非常に慣れていないので、VB.net 2010経由で接続しようとしています。私は次のことを試みています:
Dim myConnection As OleDbConnection
Dim myCommand As OleDbCommand
Dim dr As OleDbDataReader
myConnection = New OleDbConnection("Provider=MSDAORA.1;UserID=xxxx;password=xxxx; database=xxxx")
'MSDORA is the provider when working with Oracle
Try
myConnection.Open()
'opening the connection
myCommand = New OleDbCommand("Select * from emp", myConnection)
'executing the command and assigning it to connection
dr = myCommand.ExecuteReader()
While dr.Read()
'reading from the datareader
MessageBox.Show("EmpNo" & dr(0))
MessageBox.Show("EName" & dr(1))
MessageBox.Show("Job" & dr(2))
MessageBox.Show("Mgr" & dr(3))
MessageBox.Show("HireDate" & dr(4))
'displaying data from the table
End While
dr.Close()
myConnection.Close()
Catch ee As Exception
End Try
そして、Catch ee As Exception 行でエラーが発生します: ORA-12560: TNS:protocol adapter error
コンピューターに tnsnames.ora ファイルもありますが、接続時にそれを使用する必要があるかどうか (または、そもそもどのように使用するか) がわかりません。上記のコードに必要ですか?
DB への DNS レス接続を使用しようとしています。それがこれで何をしているのかわからないのですか?
どんな助けでも素晴らしいでしょう!!! :o)
デビッド