Problem using a msado15.Connection obtained through a com call 
Author Message
 Problem using a msado15.Connection obtained through a com call

Hi all,

I am trying to return a msado15.Connection from a Visual Basic app and use
it in a J++ app.  I have very little experience with VB so I believe that my
problem may be there.  The VB simply creates a connection and has a method
called getConnection.  The Java has access to it via com.  I can get the
connection and call its Execute method.  When I do this I get a valid
Recordset that is usable.  When I use a Recordset that is instantiated with
new Recordset I get this exception:

com.ms.com.ComFailException: The application is using arguments that are of
the
wrong type, are out of acceptable range, or are in conflict with one
another.
        at msado15/Recordset.setActiveConnection (Recordset.java)
        at ConnectionTest.main (ConnectionTest.java:35)

ERROR: The application is using arguments that are of the wrong type, are
out of
 acceptable range, or are in conflict with one another.

The following is the code that I am using.  Note the DbConnection is the com
object.

The VB Code looks like this:

Dim newConnection As ADODB.Connection

Public Function getConnection() As ADODB.Connection

    Set getConnection = newConnection

End Function

Private Sub Class_Initialize()

    Set newConnection = New ADODB.Connection
    newConnection.Open ("dsn=HAWAII")

End Sub

The java looks like this:

_Connection con = (new DbConnection()).getConnection();
 _Recordset rs = new RecordSet();
rs.setActiveConnection(con);

The following java works:
_Connection con = (new DbConnection()).getConnection();
 _Recordset rs = con.Execute("sp_tables", v1, 0);
  rs.Close();
  rs.setActiveConnection(con);

Thanks for any help
Matthew Field



Mon, 18 Dec 2000 03:00:00 GMT
 
 [ 1 post ] 

 Relevant Pages 

1. Using sp_OA procs to call COM executable in Active/Passive cluster

2. Using sp_OA procs to call COM executable in Active/Passive cluster

3. Using Triggers to Call COM INterface IINterchange:Submit(BizTalk)

4. VB6: Problem sharing ADO connection between COM Objects (complex problem)

5. Problem sharing ADO connection between COM Objects (complex problem)

6. com object will not read registry when com object called from asp (vb works fine)

7. com object will not read registry when com object called from asp (vb works fine)

8. Problem Obtaining Results using Distinct

9. Trigger calling COM object problem

10. Problem calling xp_sendmail from a C++ MTS COM Object

11. Error using connection object across COM boundry

12. Invalid Pointer exception using VC 6.0 and ADO (msado15.dll)


 
Powered by phpBB® Forum Software