?
Solved

Connecting Oracle RDB Database from VB.net

Posted on 2004-11-10
5
Medium Priority
?
1,044 Views
Last Modified: 2008-01-09
Hi All,

I am trying to connect My Oracle RDB database from my Vb.Net. I have installed ODBC driver for Oracle RDB. Now from Application I don't have any problem with connection but when I am fetching data with select statement, I am receiving this error
"ERROR [HY000] [Oracle][ODBC][Rdb]%RDB-F-BAD_DB_HANDLE, invalid database handle"
Any body has solution for this

Thanks

Tarun

My code is as follows  

    Public OdbcCmd As New OdbcCommand
    Public OdbcCon As OdbcConnection = New OdbcConnection
    Public odbcReader As OdbcDataReader
    Public ODBCConnStr As String = "DSN=ADRData;SERVER=172.25.10.21@generic@0@W;SERVER=172.25.10.21;UID=xxxx;PWD=xxxx;TLO=0;SVR=172.25.10.21;CLS=generic;XPT=2=tcp/ip;CSO=1;"

        Try
                OdbcCon = New OdbcConnection(ODBCConnStr)
                OdbcCon.Open()

         Dim odbcCMD As OdbcCommand = New OdbcCommand(strsql, OdbcCon)
         Dim dataAdapter As OdbcDataAdapter = New OdbcDataAdapter
         Dim dsTable As New DataSet
            dataAdapter.SelectCommand = odbcCMD
            dataAdapter.Fill(dsTable, "dsTable")


        Catch ex As Exception
            MsgBox(ex.Message)
        End Try
0
Comment
Question by:tarun_ghosh
  • 2
  • 2
5 Comments
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 12543482
Why don't you use the standard oracleclient that comes with .net instea
0
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 12543508
Oeps,

Why don't you use the standard oracleclient that comes with .net instead of the generic odbc adapter


like

Public Sub InsertRow(myConnection As String)
    If myConnection = "" Then
        myConnection = "Data Source=Oracle8i;Integrated Security=yes"
    End If
    Dim myConn As New OracleConnection(myConnection)
    Dim myInsertQuery As String = "INSERT INTO Dept (DeptNo, Dname, Loc) values (50, 'TECHNOLOGY', 'DENVER')"
    Dim myOracleCommand As New OracleCommand(myInsertQuery)
    myOracleCommand.Connection = myConn
    myConn.Open()
    myOracleCommand.ExecuteNonQuery()
    myConn.Close()
End Sub
0
 

Author Comment

by:tarun_ghosh
ID: 12545072
Hi,

This works fine with Orcle 8i or later. But I am using ORACLE RDB.

Thanks
0
 

Author Comment

by:tarun_ghosh
ID: 12552797
Hi

I have solved the problem.
When we create the ODBC connection there is an option  to add attached statement, we need to put the full path of the database there.
Ex:
Attach Statement: "attach 'filename vmswrk$dka100:[wiz_adr.data.rdb]wizard_data.rdb' (attach 'filename disk:[dir]db_file_name')"

Thanks

 
0
 

Accepted Solution

by:
Tarun_Ghosh earned 375 total points
ID: 12572547
Attach statement is must when you are using Oracle RDB in VMS mechine.
Add the physical file name with pathe in the attach statement
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

850 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