Moin Michael,
first of all great to hear that you want to write a driver :-) I'll do
my best I can to help you at any time.
First of all you have to know which kind of driver you want. I just look
at the code and it looks promising to use either the ODBC or JDBC in the
independent way as well.
Michael Strobel wrote:
Hi,
I try to develop a SDBC driver for Ingres and OOo, as the SDBC-ODBC and the
JDBC-ODBC driver both support the features of the com.sun.start.sdbc.Driver,
but not those of the com.sun.start.sdbcx.Driver service. What I like to do, is
to implement a SDBC driver similar to the one in the OOo source code for MySQL,
which uses the functionality of the SDBC-ODBC or the SDBC-JDBC driver and add
features of the the com.sun.start.sdbcx.Driver service as far as possible.
Currently I managed to compile the driver skeleton from the OOo SDK and install the resulting component in OOo, which gives me an entry in the available drivers list, but of couse no real driver functionality. I already tried to simply copy the source code of the SDBC driver for MySQL and to adapt it, but I was not able to compile the source code, because I use the OOo SDK, but the source code includes some header files from the OOo source itself and just adding them to the include path or copying them to the OOo SDK gives a missing external symbol, as I do not know what lib is to link and how to do this.
That the first step. Good.
Could you give me some advice how to manage this problem, please? Do I need to compile the whole OOo source code, besides using the OOo SDK or should I try something totally different?
First you should copy the YDriver.(hc)xx files. Remove/(Comment it out)
or replace all code which doesn't compile. For example replace the
defines with the real code. http://lxr.go-oo.org/ is a nice tool to search.
As I am a newbie to UNO programming I also have some questions concerning the implementation of the SDBC driver for MySQL. So far I can see the the SDBC-ODBC or the JDBC-ODBC driver is loaded when the connect() Method is invoked, but I don't understand why the XUnoTunnel and the OMetaConnection object is needed in this Method. I tried to set up a connection omitting all steps concerning the XUnoTunnel and the OMetaConnection object, but it didn't work, so this seems to be something essential for establishing a connection that way. Could you please give me some hints on this?
The XUnoTunnel is used to get the implementation of an interface. In
this case it is used to set the correct URL which should be returned
when you ask the XDatabaseMetaData::getURL()
So when not doing so, the metadata will return for example the
jdbc:ingres:xxx and not sdbc:ingres as you may want.
When removing the code for OMetaConnection don't forget that you have to
sore the XConnection objects inside the map of connections otherwise you
won't get a catalog for it.
The work around for the URL problem would be to write a own connection
which would forward all calls to the JDBC/ODBC connection except the
getMetaData() call and to write this one as well. Doing the same
forwarding thing and just when asking for getURL() return the correct
one. May be I was a little bit lazy when implementing the mysql driver ;-)
I also don't understand why there is a map for multiple JDBC drives from
different driver classes. Shouldn't there only be one JDBC driver from one
driver class loaded by the SDBC-JDBC driver at any time?
When you create a new database file in OOo for mysql and you choose
mysql jdbc you'll can on the next page select the driver name. So it is
possible to define different names. By the way I never tried to insert a
different one ;-) Do you try to insert a ingres one?
Regards,
Michael
So if you have question please feel free to ask. By the way I would
prefer the independent way, just a little bit more coding but therefore
everybody using a OOo2.x can use it otherwise you have to wait for 3.0.
Best regards,
Ocke
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Ocke Janssen Tel: +49 40 23646 661, x66661
Dipl. Inf(FH) Fax: +49 40 23646 550
Sun Microsystems Inc.
Nagelsweg 55 mailto:[EMAIL PROTECTED]
D-20097 Hamburg http://www.sun.com/staroffice
Sitz der Gesellschaft: Sun Microsystems GmbH, Sonnenallee 1,
D-85551 Kirchheim-Heimstetten
Amtsgericht Muenchen: HRB 161028
Geschaeftsfuehrer: Thomas Schroeder Wolfgang Engels, Dr. Roland Boemer
Vorsitzender des Aufsichtsrates: Martin Haering
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]