Issue 81899 - Allow system-wide configuration of JDBC classes
Summary: Allow system-wide configuration of JDBC classes
Status: CLOSED FIXED
Alias: None
Product: Base
Classification: Application
Component: code (show other issues)
Version: OOo 2.3
Hardware: All All
: P3 Trivial with 3 votes (vote)
Target Milestone: OOo 3.1
Assignee: marc.neumann
QA Contact: issues@dba
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-24 14:40 UTC by mux2005
Modified: 2010-02-22 14:42 UTC (History)
8 users (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description mux2005 2007-09-24 14:40:46 UTC
According to (lack of) answers on the devel mailing list, it seems that atm the
only way to register a JAR file for a JDBC driver with OOo is via
Tools/Options/Java/Classpath or manual modification of javasettings_*.xml in the
user configuration. This is not an adequate solution for a corporate setup with
many machines. We need a way to register a JDBC driver with OOo system-wide, not
per user. Preferably the classpath would be settable via an .xcu file that can
be overridden with a UNO package. I find it strange that this is not already the
case when all the rest is configured via .xcu files.
Comment 1 rene 2007-09-24 15:21:15 UTC
mux2005: what about jvmfwk3rc/.ini?

That's what I do for the SDBC drivers packages in Debian:

UNO_JAVA_JFW_CLASSPATH_URLS=${${$ORIGIN/$UNO_SETTINGS:PKG_UserUnoFile}:UNO_JAVA_CLASSPATH}
${${$ORIGIN/$UNO_SETTINGS:PKG_SharedUnoFile}:UNO_JAVA_CLASSPATH}
$ORIGIN/classes/jurt.jar $ORIGIN/classes/ridl.jar $ORIGIN/classes/java_uno.jar
[...] file:///usr/share/java/mysql.jar file:///usr/share/java/sapdbc.jar
file:///usr/share/java/postgresql.jar

Note the last three.
Comment 2 mux2005 2007-09-25 09:09:43 UTC
Hacking a config file from a script is messy, especially under Windows, where
you don't always have tools like sed, perl, patch available. And then there's
the point that it increases the maintenance burden. When you already maintain a
.uno.pkg for the OOo configuration it's just easier and more natural to put your
Java classpath configuration in there, too. Ideally, it should be possible to
put the JDBC driver into the .uno.pkg, too, so that the same package can be used
to install the JDBC driver under Linux and Windows.
Comment 3 Frank Schönheit 2007-09-25 09:22:01 UTC
I'm not sure whether the latter - putting the JAR into the .oxt so that it is
automatically added to the classpath - is already possible. Stephan?
Comment 4 rene 2007-09-25 09:25:46 UTC
mux2005: I agree. I also agree that this doesn't scale and may make other
problems appear but I just wanted to mention it for completeness' sake.
Comment 5 Stephan Bergmann 2007-09-25 09:38:59 UTC
@fs:  No, there is no mechanism available by which an OOo extension can make
available a jar outside the scope of the extension itself.
Comment 6 marc.neumann 2007-09-26 10:01:53 UTC
Hi,

I send this issue to jl for a general solution.

Bye Marc
Comment 7 joachim.lingner 2007-09-26 10:29:12 UTC
JL->OJ: Maybe the DB code needs to use a class loader which evaluates
configuration data in order to find additional JDBC driver. What do you think?
Comment 8 ocke.janssen 2007-09-26 12:11:23 UTC
qjl: Yes, this should be possible. We have a mechanism in the jdbc driver to
load from specific classpath. Thanks sb. :-) So to read from the config should
not be the problem.
Comment 9 ocke.janssen 2008-07-04 15:29:44 UTC
Fixed in cws dba31a

You now have to add this in your DataAccess.xcu file

<node oor:name="JDBC">
    <node oor:name="DriverNames">
      <node oor:name="com.mysql.jdbc.Driver" oor:op="replace">
        <prop oor:name="DriverName">
          <value>com.mysql.jdbc.Driver</value>
        </prop>
        <prop oor:name="Path">
         
<value>file:///d:/src/drv/mysql-connector-java-5.1.3-rc/mysql-connector-java-5.1.3-rc-bin.jar</value>
        </prop>
      </node>
    </node>
  </node>
Comment 10 Frank Schönheit 2008-07-18 20:48:01 UTC
re-opening.
While the configuration settings seems to work, there is (in a non-product
version) an assertion from connectivity/source/drivers/jdbc/tools.cxx, line 169,
saying that a parameter is passed as wrong type. Since this assertion does not
happen in an MWS build with the same database (and the driver added to
Tools/Options' class path), this sounds as if its related to the fix here.
Comment 11 Frank Schönheit 2008-07-18 22:47:28 UTC
fixed the assertion problem in dba31b
Comment 12 Frank Schönheit 2008-07-18 22:50:15 UTC
Note: the configuration path to configure the class path for a given driver is not
  org.openoffice.Office.DataAccess/JDBC/DriverNames
anymore, but
  org.openoffice.Office.DataAccess/JDBC/DriverClassPaths
Additionally, the unused DriverName node has been removed. So, oj's config
fragment from above transforms to 
  <node oor:name="JDBC">
    <node oor:name="DriverClassPaths">
      <node oor:name="com.mysql.jdbc.Driver" oor:op="replace">
        <prop oor:name="Path">
          <value>url_to_jar_file</value>
        </prop>
      </node>
    </node>
  </node>
Multiple nodes can appear below the DriverClassPaths node, where the node name
specifies the driver class name for which the driver class path should be applied.
Comment 13 Frank Schönheit 2008-07-25 14:14:47 UTC
fs-> msc: please verify in CWS dba31a
Comment 14 marc.neumann 2008-08-08 12:16:10 UTC
verified in CWS dba31a

find more information about this CWS, like when it is available in the master
builds, in EIS, the Environment Information System:
http://eis.services.openoffice.org/EIS2/cws.ShowCWS?Path=DEV300%2Fdba31a
Comment 15 thorsten.ziehm 2009-07-20 14:52:04 UTC
This issue is closed automatically and wasn't rechecked in a current version of
OOo. The fixed issue should be integrated in OOo since more than half a year. If
you think this issue isn't fixed in a current version (OOo 3.1), please reopen
it and change the field 'Target Milestone' accordingly.

If you want to download a current version of OOo =>
http://download.openoffice.org/index.html
If you want to know more about the handling of fixed/verified issues =>
http://wiki.services.openoffice.org/wiki/Handle_fixed_verified_issues
Comment 16 thorsten.ziehm 2009-07-20 15:35:26 UTC
Sorry this issue was wrongly closed. This issue will be reopened automatically.
And will be set after that back to fixed/verified.
Comment 17 thorsten.ziehm 2009-07-20 15:39:56 UTC
Set to state 'fixed'.
Comment 18 thorsten.ziehm 2009-07-20 15:44:09 UTC
Set back to state 'verified/fixed'.

Again. Sorry for the mass of mails.
Comment 19 eberlein 2009-11-11 09:35:57 UTC
Please consider to reopen the issue.
The settings are ok with GUI, but not with API.
The following snippet has worked in 320m3 with the classpath settings via
OptionsDialog/Java:

mDBProperties(3).Name = "JavaDriverClass"
mDBProperties(3).Value = "oracle.jdbc.driver.OracleDriver"

oEnvironment = createUNOService("com.sun.star.sdbc.DriverManager")    
sDatabaseURL = "jdbc:oracle:thin:@" & ip & ":1521:" & sid
oConnection = oEnvironment.getConnectionWithInfo(sDatabaseURL,mDBProperties())
Now a message says, that the driver could not be loaded.
Set fs to cc, because he did the last changes
 
Comment 20 Frank Schönheit 2009-11-11 09:40:45 UTC
Peter, are you saying your code fragment worked with OOO320.m3, but not with
OOO320.m4 anymore?
Comment 21 eberlein 2009-11-11 09:48:44 UTC
no, the fragment works with manually setting the classpath via the OptionDialog,
which corresponds to the javasettings_*.xml.
After removing the classpath in the OptionsDialog and using the DataAccess.xcu
file, the connection can be established via GUI (with an odb-file), but not with
API.
Comment 22 Frank Schönheit 2009-11-11 21:24:56 UTC
ah .... Indeed, your code works on SDBC level, while the code for fixing this
issue has been added to the SDB level. In particular, the css.sdb.DataSource
implementation evaluates the configuration.

I don't see a reason why this code could not be in the SDBC/JDBC bridge, but
somehow I'd prefer a new issue over re-opening this one here.
Comment 23 eberlein 2009-11-13 07:23:13 UTC
Opened issue 106875 for it.
Comment 24 Frank Schönheit 2009-11-13 07:39:24 UTC
thanks
Comment 25 thorsten.ziehm 2010-02-22 14:42:20 UTC
This issue is closed automatically. It should be fixed in a version with is
available for longer than half a year (OOo 3.1). If you think this issue isn't
fixed in the current version (OOo 3.2) please reopen it. But then please pay
attention about the field 'target milestone'.
The closure was approved by the Release Status Meeting at 22nd of February 2010
and it is based on the issue handling guideline for fixed/verified issues  : 
http://wiki.services.openoffice.org/wiki/Handle_fixed_verified_issues