[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ms-java-com
Subject:    OSP crashes the VM
From:       Dan Adler <adan () INVEN ! COM>
Date:       1998-12-29 16:57:49
[Download RAW message or body]


I'm not sure who this should go to.

This example shows that OSP (OLE-DB Simple Provider) crashes the VM when
implemented in Java. The problem could be the MSDAOSP.DLL or the VM.

The basis for this is the MSDASDK/samples/osp/vj example from the 2.0
data sdk samples.

I made a simpler example that doesn't depend on anything external. I am
using the 3158 build of the VM and version 2.0 of OSP.

To run this example:

jvc *.java
./jreg

then, go to MSDASDK/bin/oledb and run RowsetViewer. Select the handshake
icon, select testODB provider and set 'Not Set' on the Prompt field of
Login. That connects to the provider.

Now type in any string into the window (can't be empty) and hit the (!)
button to load the data. Repeat this 10-15 times, and the app will
crash. The same crash occurs if you write an ADO example instead of
using RowsetViewer. In my "real" application, the crash occurs after
only one successful fetch.


--------------------------------------- file testOSP.java
---------------------------------------------------
import java.io.*;
import java.util.*;
import com.ms.com.*;
import com.ms.osp.*;

class testOSP implements OLEDBSimpleProvider
{
  public testOSP()
  {
  }

  // OLEDBSimpleProvider methods

  public int deleteRows(int iRow, int cRows) throws ComException
  {
    throw new ComFailException();
  }

  public int getColumnCount() throws ComException
  {
    return 10;
  }

  public String getLocale() throws ComException
  {
    Locale lc = Locale.US;
    return lc.getDisplayName(Locale.US);
  }

  public int getRowCount() throws ComException
  {
    return 5000;
  }

  public int getRWStatus(int iRow, int iColumn) throws ComException
  {
    return OSPRW.OSPRW_READONLY;
  }

  public Object getVariant(int iRow, int iColumn, int format) throws
ComException
  {
    if (iRow == 0) {
   return new Variant("Column"+iColumn);
    } else return new Variant(iRow + iColumn);
  }

  public void setVariant(int iRow, int iColumn, int format, Object var)
throws ComException
  {
    throw new ComFailException();
  }

  public int insertRows(int iRow, int cRows) throws ComException
  {
    throw new ComFailException();
  }

  public int find(int iRowStart, int iColumn, Object val, int findFlags,
int compType) throws ComException
  {
    throw new ComFailException();
  }

  public void addOLEDBSimpleProviderListener(OLEDBSimpleProviderListener
rospIListener) throws ComException
  {
  }

  public void
removeOLEDBSimpleProviderListener(OLEDBSimpleProviderListener
pospIListener) throws ComException
  {
  }

  public int isAsync() throws ComException
  {
    return 0;
  }

  public int getEstimatedRows() throws ComException
  {
    return getRowCount();
  }

  public void stopTransfer() throws ComException
  {
  }

}


------------------------------- file testDataSource.java
------------------------------------------------
import com.ms.com.*;
import com.ms.osp.*;
import java.util.*;

class testDataSource implements DataSource
{
  testOSP m_rOSPObject;

  public testDataSource()
  {
    m_rOSPObject = new testOSP();
  }

  public IUnknown getDataMember(String sDataMember, _Guid riid) throws
ComException
  {
    return (OLEDBSimpleProvider)m_rOSPObject;
  }

  public String getDataMemberName(int lIndex)
  {
    return "Foo";
  }

  public int getDataMemberCount()
  {
    return 1;
  }

  public void addDataSourceListener(DataSourceListener
rDataSourceListener) throws ComException
  {
  }

  public void removeDataSourceListener(DataSourceListener
rDataSourceListener) throws ComException
  {
  }
};

------------------------------- file reg
------------------------------------------------

REGEDIT4

[HKEY_CLASSES_ROOT\testODB]
@="test OLE DB Provider"

[HKEY_CLASSES_ROOT\testODB\CLSID]
@="{4C2018F1-1F0D-11d1-B3B8-22BA00C1A924}"

[HKEY_CLASSES_ROOT\CLSID\{4C2018F1-1F0D-11d1-B3B8-22BA00C1A924}]
@="testODB"

[HKEY_CLASSES_ROOT\CLSID\{4C2018F1-1F0D-11d1-B3B8-22BA00C1A924}\InprocServer32]

@="d:\\Program Files\\Common Files\\System\\OLE DB\\MSDAOSP.DLL"
"ThreadingModel"="Both"

[HKEY_CLASSES_ROOT\CLSID\{4C2018F1-1F0D-11d1-B3B8-22BA00C1A924}\ProgID]
@="testODB.1"

[HKEY_CLASSES_ROOT\CLSID\{4C2018F1-1F0D-11d1-B3B8-22BA00C1A924}\VersionIndependentProgID]

@="testODB"

[HKEY_CLASSES_ROOT\CLSID\{4C2018F1-1F0D-11d1-B3B8-22BA00C1A924}\OLE DB
Provider]
@="test OLE DB Provider"

[HKEY_CLASSES_ROOT\CLSID\{4C2018F1-1F0D-11d1-B3B8-22BA00C1A924}\OSP Data
Object]
@="testDataSource"

------------------------------- file jreg
------------------------------------------------
javareg /progid:testDataSource /register /class:testDataSource
/codebase:<path>

regedit -v reg

------------------------------- end
-------------------------------------------------------

----------------------------------------------------------------
Users Guide http://www.microsoft.com/workshop/essentials/mail.asp
contains important info including how to unsubscribe.  Save time, search
the archives at http://discuss.microsoft.com/archives/index.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic