Home » Infrastructure » Windows » ADO Connection to Oracle, URGENT HELP NEEDED PLEASE!
ADO Connection to Oracle, URGENT HELP NEEDED PLEASE! [message #101369] Wed, 01 September 2004 09:45 Go to next message
DesperateVB_Developer
Messages: 1
Registered: September 2004
Junior Member
I have a Application Developed in VB6 and use Oracle as a Dtabase obviously. I am connecting to the Database using ADO.

Here is my code that I use to connect to the Database, Execute Sql Statements as well as retrieving Recordsets.

 

Option Explicit
Dim mCon As New ADODB.Connection
Dim mCom As New ADODB.Command

Public Function grsGetRs(sSql As String, cnConn As ADODB.Connection) As ADODB.Recordset
   
    With mCom
        .ActiveConnection = cnConn
        .CommandText = sSql
    End With

    Set grsGetRs = mCom.Execute

   
End Function

Public Sub gExecSql(sSql As String, cnConn As ADODB.Connection)

    With mCom
        .ActiveConnection = cnConn
        .CommandText = sSql
        .Execute
    End With
   
End Sub

Public Function gdbAdoConnect(sDataSource As String, sUser As String, sPass As String) As ADODB.Connection

    With mCon
        .CursorLocation = adUseClient
        .Provider = "MSDAORA.1"
        .ConnectionString = "User ID=" & sUser & ";Password=" & sPass & ";Data Source=" & sDataSource & ";"
        .Open
    End With

    Set gdbAdoConnect = mCon
   
End Function

Now my problem is that I have a clean Machine with windows xp on it. I installed my application on it as well as the Application Database, as well as MDAC 2.6. For some reason I cannot connect to the Database at all, but from a different machine I can connect to the Database on the XP Machine without any problems. I never had this problem and was always able to connect to the database and it didnt matter on what type of machine I installed it. I think it has somethiing to do with the cursorlocation property, because as you see in the code it is currently set to adUseClient, I changed that to adUseServer and then I could conenct to the Database, but as soon as I needed to retrieve data via a recordset from the DB, it returned nothing. Also I dont really know what the cursorlocation is for, any info regarding that will be extremely appreciated. Hope someone can help regarding this problem as soon as possible.

 

 
Re: ADO Connection to Oracle, URGENT HELP NEEDED PLEASE! [message #101389 is a reply to message #101369] Thu, 09 September 2004 00:08 Go to previous message
Neolle
Messages: 2
Registered: September 2004
Junior Member
Perhaps you can take a look at this
I use ADO 2.5 for Reference.

Option Explicit
Public dbConnection As ADODB.Connection

Public Sub Connection_Initialise( _
Byval vPassword As String, _
Byval vUserId As String, _
Byval vDataSource As String)

Dim strConnectionString

strConnectionString = _
"Provider=OraOLEDB.Oracle.1;" & _
"Password=" & vPassword & ";" & _
"Persist Security Info=False;" & _
"User ID=" & vUserId & ";" & _
"Data Source=" & vDataSource

Set dbConnection = New ADODB.Connection
dbConnection.Open strConnectionString
End Sub

This works all the time..
Previous Topic: OraDatabase.Parameters - Suggestions
Next Topic: Cannot connect to remote Oracle via VB
Goto Forum:
  


Current Time: Fri May 27 01:28:48 CDT 2022