Re: Help Required In Writing a New SDBC Driver For LDAP

Ocke Janssen <[email protected]> Fri, 01 Apr 2011 08:31:34 +0200
Newsgroups gmane.comp.openoffice.dba.devel
Organization ORACLE Deutschland B.V. & Co. KG
Message-ID <[email protected]>
Hi.

On 31.03.2011 21:28, Rohit Kulkarni wrote:
> hello,
>
> Tell me one thing --
> Lets come again to "mdrivermanager.cxx" file. In that can you please
> explain me --
> 1) How this "OSDBCDriverManager::bootstrapDrivers() " function works ?
It looks at the global registry where e.g. all drivers are registered=20
and collect them (createContentEnumeration).
> 2) That means how this function work in loop ?
It collects the names of the drivers.
> 3) How " aDriverDescriptor.sImplementationName " variable value change
> at each iteration ?
> At one iteration its value is "com.sun.star.comp.sdbc.ODBCDriver" then
> at second it is "com.sun.star.comp.sdbcx.adabas.ODriver" then next it i=
s
> "com.sun.star.comp.sdbc.calc.ODriver"
> and so on..
aDriverDescriptor.sImplementationName =3D xSI->getImplementationName();
> 4) And why my driver ( "com.sun.star.comp.sdbc.skeleton.SkeletonDriver"
> ) value is not part of it  ?
Because it is not registered. That's the root cause.
You may have a look at the file services.rdb (is a xml file)
Openoffice.org/openoffice/basis/program (path depends on your installatio=
n).

- oj

PS: I don't know if the tool regcomp still exists. If so, try it to=20
register your lib
>
> Kindly tell me answers of these questions as soon as possible ..
>
> Regards,
> Rohit
> On Thu, Mar 31, 2011 at 11:58 AM, Ocke Janssen <[email protected]
> <mailto:[email protected]>> wrote:
>
>     Rohit,
>
>
>     On 31.03.2011 06:32, Rohit Kulkarni wrote:
>
>         Oj,
>
>         I had updated the scp2 module, both the files you mentioned. I
>         also do a
>         build --all after my changes which must have done the
>         registration. I
>         still cannot see my driver loaded; as I said it wont find my
>         driver name
>         "org.openoffice.comp.connectivity.skeleton.SkeletonDriver" in
>         its list
>         of names in OSDBCDriverManager::implGetDriverForURL function.
>
>         Is there any way to debug this ?
>
>     First of all you should check if your library is okay. ldd or
>     similar tests.
>     You also should have a look at the log file generated in
>     instsetoo_native/unxlngi6.pro/ <http://unxlngi6.pro/> (search for
>     *.log file) may be you see an error there or that is was successful=
.
>
>     The last way should be to debug cppu and cppuhelper (is no fun).
>     I would remove the build output from connectivity and scp2 and then
>     make a build (--all) in instsetoo_native.
>
>
>         also for dbaccess code it have too many files with sdbc: what
>         exactly am
>         I looking for here ?
>
>
>     One place is dbaccess/source/core/misc/dsntypes.cxx
>
>     -oj
>
>
>         thanks,
>         Rohit
>
>         On Wed, Mar 30, 2011 at 12:43 AM, Ocke Janssen
>         <[email protected] <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>> wrote:
>
>             Hello Rohit,
>
>
>             On 30.03.2011 03:01, Rohit Kulkarni wrote:
>
>                 Hello Oj,
>
>                 I an not writing the sdbcx driver, also I can debug
>         everything
>                 else but
>                 my driver code. I am guessing I am not registering the
>         driver
>                 properly.
>
>                 I have written the .xml file for the driver and also
>         made changes to
>                 DataAccess.xcu. Should this be sufficient to register t=
he
>                 driver? if not
>                 what else do I need to do ?
>
>             Do have changed the module scp2 and added lines like
>             STD_LIB_FILE(gid_File_Lib_Mysql,mysql) in file_library_ooo.=
scp
>             and
>             gid_File_Lib_Mysql, in module_hidden_ooo.scp ?
>
>             You have to build OOo instset because your registration is
>         done there.
>             If the driver should not be an extension than we you could
>         remove
>             your dataaccess.xcu changes and adjust the code in dbaccess
>         (look
>             for sdbc: )
>
>             Best regards,
>
>             oj
>
>
>                 Here are excerpts from those files:
>
>                 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D DriverSkelet=
on.xml =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
>         <?xml version=3D'1.0' encoding=3D"UTF-8"?>
>         <!DOCTYPE COMPONENTDESCRIPTION PUBLIC "-//W3C//DTD HTML 3.2//EN=
"
>         "module-description.dtd">
>         <module-description xmlns:xlink=3D"http://www.w3.org/1999/xlink=
">
>         <module-name>   skeleton1 </module-name>
>         <component-description>
>         <Author>rohit</Author>
>         <Name>org.openoffice.comp.connectivity.skeleton.SkeletonDriver<=
/Name>
>         <description>This library implements the database driver for
>                 Skeleton.</description>
>         <loader-name>com.sun.star.loader.SharedLibrary</loader-name>
>         <language>c++</language>
>         <status value=3D"alpha"/>
>         <supported-service>com.sun.star.sdbc.Driver</supported-service>
>         <service-dependency>    ... </service-dependency>
>         </component-description>
>         <project-build-dependency>cppuhelper</project-build-dependency>
>         <project-build-dependency>cppu</project-build-dependency>
>         <project-build-dependency>sal</project-build-dependency>
>         <project-build-dependency>vos</project-build-dependency>
>         <runtime-module-dependency>cppuhelper</runtime-module-dependenc=
y>
>         <runtime-module-dependency>cppu1</runtime-module-dependency>
>         <runtime-module-dependency>sal1 </runtime-module-dependency>
>         <runtime-module-dependency>vos</runtime-module-dependency>
>         </module-description>
>
>                 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D DataAccess.xcu =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
>         <!DOCTYPE oor:component-data SYSTEM
>         "../../../../component-update.dtd">
>         <oor:component-data oor:name=3D"DataAccess"
>                 oor:package=3D"org.openoffice.Office"
>                 xmlns:oor=3D"http://openoffice.org/2001/registry"
>                 xmlns:xs=3D"http://www.w3.org/2001/XMLSchema"
>                 xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance"=
>
>         <node oor:name=3D"UserDefinedDriverSettings">
>         <node oor:name=3D"Driver Skeleton" oor:op=3D"replace">
>         <prop oor:name=3D"DriverTypeDisplayName">
>         <value>Driver Skeleton</value>
>         </prop>
>         <prop oor:name=3D"DriverPageDisplayName">
>         <value>Driver Skeleton Page</value>
>         </prop>
>         <prop oor:name=3D"DriverDsnPrefix">
>         <value>sdbc:skeleton:</value>
>         </prop>
>         </node>
>         </node>
>         <node oor:name=3D"ConnectionPool">
>         <node oor:name=3D"DriverSettings">
>         <node
>
>           oor:name=3D"org.openoffice.comp.connectivity.skeleton.Skeleto=
nDriver"
>                 oor:op=3D"replace">
>         <prop oor:name=3D"DriverName">
>         <value>org.openoffice.comp.connectivity.skeleton.SkeletonDriver=
</value>
>         </prop>
>         <prop oor:name=3D"Enable">
>         <value>false</value>
>         </prop>
>         <prop oor:name=3D"Timeout">
>         <value>60</value>
>         </prop>
>         </node>
>         <node oor:name=3D"com.sun.star.comp.sdbcx.adabas.ODriver"
>                 oor:op=3D"replace">
>         <prop oor:name=3D"DriverName">
>         <value>com.sun.star.comp.sdbcx.adabas.ODriver</value>
>         </prop> ...........
>                            :
>
>                 ----------
>
>                 there is also a DriverSkeleton.xcu as below:
>
>                 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D DriverSkeleton.=
xcu =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>         <oor:component-data oor:name=3D"Drivers"
>                 oor:package=3D"org.openoffice.Office.DataAccess"
>                 xmlns:oor=3D"http://openoffice.org/2001/registry"
>                 xmlns:xs=3D"http://www.w3.org/2001/XMLSchema">
>         <node oor:name=3D"Installed">
>         <node oor:name=3D"sdbc:skeleton:*" oor:op=3D"replace">
>         <prop oor:name=3D"Driver">
>         <value>org.openoffice.comp.connectivity.skeleton.SkeletonDriver=
</value>
>         </prop>
>         <prop oor:name=3D"DriverTypeDisplayName" oor:type=3D"xs:string"=
>
>         <value xml:lang=3D"en-US">Skeleton Driver</value>
>         </prop>
>         <node oor:name=3D"Features">
>         <node oor:name=3D"EscapeDateTime" oor:op=3D"replace">
>         <prop oor:name=3D"Value" oor:type=3D"xs:boolean">
>         <value>true</value>
>         </prop>
>         </node>
>         </node>
>         </node>
>         </node>
>         </oor:component-data>
>
>                 as for this I have updated the "build.lst and d.lst"
>         files so
>                 that it
>                 builds the "libDriverSkeletonli.so" file and copies it
>         into the
>                 installation set.
>                 But when I debug this I can see that my driver is not
>         returned
>                 as part
>                 of enumeration by "createContentEnumeration()"
>
>                 Could you suggest any way I can fix this?
>                 thanks in advance.
>
>                 -Rohit
>
>                 On Tue, Mar 29, 2011 at 12:06 AM, Ocke Janssen
>         <[email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]=
>>
>         <mailto:[email protected] <mailto:[email protected]=
>
>         <mailto:[email protected]
>         <mailto:[email protected]>>>> wrote:
>
>                     Hi Rohit,
>
>
>                     On 28.03.2011 17:43, Rohit Kulkarni wrote:
>
>                             Hello,
>                             1) I built whole openoffice and installed
>         it.(normal
>                 build
>                         i.e build
>                             --all)
>                             2) I built only dbaccess and connectivity
>         modules with
>                         debug=3Dtrue
>                             dbglevel=3D2
>                             3) Copied .so files from
>                 ../connectivity/unxlngi6.pro/lib/*
>         <http://unxlngi6.pro/lib/*> <http://unxlngi6.pro/lib/*>
>         <http://unxlngi6.pro/lib/*>
>         <http://unxlngi6.pro/lib/*> and ../dbaccess/unxlngi6.pr/lib/*
>         <http://unxlngi6.pr/lib/*>
>         <http://unxlngi6.pr/lib/*>
>         <http://unxlngi6.pr/lib/*>
>         <http://unxlngi6.pr/lib/*>  to ../../openoffice3/basis-link/pro=
gram/
>
>                             4) Now I set breakpoint to " b
>                             connectivity::flat::ODriver::acceptsURL "
>                             5) Run base through gdb.
>                             6) Execution stopped at breakpoint, whateve=
r I
>                 select flat or
>                             skeleton driver or any other from available
>         driver list.
>                             7) When I set breakpoint at " b
>
>           connectivity::skeleton::SkeletonDriver::acceptsURL ", it
>                         wont stop
>                             at breakpoint.
>                             8) That means execution of program never go=
es to
>                 SDriver.cxx
>                             (skeleton driver file) file which has accep=
tsURL
>                 function.
>
>                             The things I have noticed after some more
>         debugging
>                 in gdb
>                         are --
>
>                             1) I saw the function named
>                         OSDBCDriverManager::bootstrapDrivers()
>                             2) I think this is the function where it
>         populates
>                 the list
>                         of all
>                             drivers using
>         " createContentEnumeration " function.
>                             3) And this function is not returning my dr=
iver.
>                             4) I saw this after watching the value of "
>                 aDriverDescriptor "
>                             variable which is used for pushback in vect=
or "
>                 m_aDriverBS
>         " , I
>                             saw various strings for example , for flat =
it is
>         "com.sun.star.comp.sdbc.flat.ODriver" but not my driver name.
>
>                         What do I need to do so that
>         createContentEnumeration
>                 will return my
>                         driver object in the list ?
>
>
>                     Do you register the driver as an extension? If so
>         the lib
>                 are not
>                     located in basis-link/program they are located in
>         your user
>                 folder
>                     3/user/uno_package/cache/uno_package/...
>                     That would also explain why you can't set any
>         breakpoint.
>                     Another reason could be that your driver doesn't su=
pport
>         "com.sun.star.sdbc.Driver" or the driver was not registered.
>
>                     If that doesn't work I could look at the code if yo=
u
>         want to.
>
>                     Best regards,
>
>                     Ocke
>
>
>
>                         Regards,
>                         Rohit
>
>
>                         On Mon, Mar 28, 2011 at 1:16 PM, Ocke Janssen
>         <[email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]=
>>
>         <mailto:[email protected] <mailto:[email protected]=
>
>         <mailto:[email protected] <mailto:[email protected]=
>>>
>         <mailto:[email protected] <mailto:[email protected]=
>
>         <mailto:[email protected] <mailto:[email protected]=
>>
>         <mailto:[email protected] <mailto:[email protected]=
>
>         <mailto:[email protected]
>         <mailto:[email protected]>>>>> wrote:
>
>                             Hi,
>
>
>
>                             On 26.03.2011 06 <tel:26.03.2011%2006>
>         <tel:26.03.2011%2006>:47, Rohit Kulkarni wrote:
>
>                                 Hello,
>                                 I have successfully built skeleton
>         driver and I
>                 can see
>                         it in
>                                 available
>                                 list.
>                                 Now , I tried to debug it using gdb. Fo=
r
>         this I
>                 followed
>                                 instructions on
>         http://wiki.services.openoffice.org/wiki/Debugging
>                                 Build using debug=3Dtrue and copied .so
>         files to
>                         installation set.
>
>                                 I added a breakpoint at
>
>                   connectivity::skeleton::SkeletonDriver::acceptsURL th=
en,
>                                 run base -> select Skeleton Driver ->
>         Datasource url
>                         window appears
>                                 (typed any string in it) -> saved ->fin=
ish
>                                 In this process debugger wont stop at
>         breakpoint.
>
>                                 Another thing is that I added breakpoin=
t at
>                                 connectivity::flat::ODriver::acceptsURL
>         then,
>                 all same
>                         steps above.
>                                 Debugger stopped at breakpoint where I
>         can see
>                 flat file
>                         EDriver.cxx
>                                 code with acceptsURL function.
>
>                                 So, do you have any idea why it wouldn'=
t
>         call
>
>                   connectivity::skeleton::SkeletonDriver::acceptsURL
>         function?
>
>                             May be you copied the wrong files or you
>         built them
>                 not with
>                         debug=3Dt
>                             ? When you can set a break point for flat i=
t
>         should also
>                         work for
>                             your driver. No guess so far. Or may be set=
 the
>                 break point
>                         when the
>                             library was loaded. I'm not the gdb expert.
>
>                             - oj
>
>
>                                 Regards,
>                                 Rohit
>                                 On Tue, Mar 15, 2011 at 11:53 AM, Ocke
>         Janssen
>         <[email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]=
>>
>         <mailto:[email protected] <mailto:[email protected]=
>
>         <mailto:[email protected] <mailto:[email protected]=
>>>
>         <mailto:[email protected] <mailto:[email protected]=
>
>         <mailto:[email protected] <mailto:[email protected]=
>>
>         <mailto:[email protected] <mailto:[email protected]=
>
>         <mailto:[email protected] <mailto:[email protected]=
>>>>
>         <mailto:[email protected] <mailto:[email protected]=
>
>         <mailto:[email protected] <mailto:[email protected]=
>>
>         <mailto:[email protected] <mailto:[email protected]=
>
>         <mailto:[email protected] <mailto:[email protected]=
>>>
>         <mailto:[email protected] <mailto:[email protected]=
>
>         <mailto:[email protected] <mailto:[email protected]=
>>
>         <mailto:[email protected] <mailto:[email protected]=
>
>         <mailto:[email protected]
>         <mailto:[email protected]>>>>>> wrote:
>
>                                     On 14.03.2011 18:45, Rohit Kulkarni
>         wrote:
>
>                                         I could successfully built the
>         skeleton
>                 driver
>                         and now I
>                                 can see
>                                         it in
>                                         the list of available drivers a=
s
>         well!
>                                         Thanks a lot for your help. I r=
eally
>                 appreciate it.
>
>                                     :-)
>
>
>                                         I have a quick question.
>
>
>
>                                         Any idea on how to solve this?
>
>                                     No, sorry. I think that's a questio=
n
>         for the
>                 normal
>         [email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]>>
>         <mailto:[email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]>>>
>         <mailto:[email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]>>
>         <mailto:[email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]>>>>
>         <mailto:[email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]>>
>         <mailto:[email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]>>>
>         <mailto:[email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]>>
>         <mailto:[email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]>>>>> list=
.
>
>                                 May be a build
>
>                                     problem or a bug.
>
>
>                                         Also, Now, if I make any change=
s
>         to the
>                 skeleton
>                         driver,
>                                 do I
>                                         have to
>                                         build and install open office
>         every time?
>
>                                     No, just replace your copy of the
>         .so file
>                 in your
>                         office
>                                 installation.
>
>                                     - oj
>
>
>                                     --
>
>
>                                     Ocke Janssen | Software Developer
>                                     Phone: +40 23646500
>                                     Oracle Office
>
>                                     ORACLE Deutschland B.V. & Co. KG |
>         Nagelsweg
>                 55 |
>                         20097 Hamburg
>
>                                     ORACLE Deutschland B.V. & Co. KG
>                                     Hauptverwaltung: Riesstr. 25,
>         D-80992 M=FCnchen
>                                     Registergericht: Amtsgericht
>         M=FCnchen, HRA 95603
>
>                                     Komplement=E4rin: ORACLE Deutschlan=
d
>                 Verwaltung B.V.
>                                     Rijnzathe 6, 3454PV De Meern,
>         Niederlande
>                                     Handelsregister der Handelskammer
>                         Midden-Niederlande, Nr.
>                                 30143697
>                                     Gesch=E4ftsf=FChrer: J=FCrgen Kunz,=
 Marcel
>         van de
>                 Molen,
>                         Alexander
>                                 van der Ven
>
>
>
>                                     Oracle is committed to developing
>         practices
>                 and products
>                                 that help
>                                     protect the environment
>
>                                     --
>
>
>
>
>           -------------------------------------------------------------=
----
>                                     To unsubscribe send email to
>         [email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>>>>
>
>                                     For additional commands send email =
to
>         [email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]=
rg>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]=
rg>>>
>         <mailto:[email protected] <mailto:[email protected]=
rg>
>         <mailto:[email protected] <mailto:[email protected]=
rg>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]=
rg>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]=
rg>>>
>         <mailto:[email protected] <mailto:[email protected]=
rg>
>         <mailto:[email protected] <mailto:[email protected]=
rg>>
>         <mailto:[email protected] <mailto:[email protected]=
rg>
>         <mailto:[email protected]
>         <mailto:[email protected]>>>>>
>
>                                     with Subject: help
>
>
>
>                             --
>
>
>
>           -------------------------------------------------------------=
----
>                             To unsubscribe send email to
>         [email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>>>
>                             For additional commands send email to
>         [email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]=
rg>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]=
rg>>>
>         <mailto:[email protected] <mailto:[email protected]=
rg>
>         <mailto:[email protected] <mailto:[email protected]=
rg>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>>>
>                             with Subject: help
>
>
>
>                     --
>
>
>           -------------------------------------------------------------=
----
>                     To unsubscribe send email to
>         [email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>>
>                     For additional commands send email to
>         [email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]=
rg>>
>         <mailto:[email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]=
rg>>>
>                     with Subject: help
>
>
>
>             --
>
>           -------------------------------------------------------------=
----
>             To unsubscribe send email to
>         [email protected]
>         <mailto:[email protected]>
>         <mailto:[email protected]
>         <mailto:[email protected]>>
>             For additional commands send email to
>         [email protected] <mailto:[email protected]>
>         <mailto:[email protected] <mailto:[email protected]=
rg>>
>             with Subject: help
>
>
>
>

--
-----------------------------------------------------------------
To unsubscribe send email to [email protected]
For additional commands send email to [email protected]
with Subject: help