Opened 14 years ago

Closed 13 years ago

#312 closed enhancement (fixed)

Easier database setup

Reported by: osjonathan Owned by: geonetwork-devel@…
Priority: minor Milestone: v2.7.0
Component: General Version: v2.6.0RC2
Keywords: Cc:

Description

Something I posted to the geonet-users mailing list but doesn't seem to have been picked up.

My I suggest more consistency and clarity in the config.xml file where it comes to the jdbc <url>? At present the various default <url> lines look like this:

<url>jdbc:mckoi://localhost:9157/</url>

<url>jdbc:mysql://$WEBSERVER_HOST/geonetwork</url>

<url>jdbc:oracle:thin:@IP:1521:fs</url>

<url>jdbc:postgresql:geonetwork</url>

At present the various default <url> lines look like this:

<url>jdbc:mckoi://localhost:9157/</url>

<url>jdbc:mysql://$WEBSERVER_HOST/geonetwork</url>

<url>jdbc:oracle:thin:@IP:1521:fs</url>

<url>jdbc:postgresql:geonetwork</url>

i.e. They all specify the IP address and port in a different manner and to someone new to jdbc (i.e. myself) it's hard to know what part is what, especially for postgre which isn't showing any connection details. May I suggest the following instead:

<url>jdbc:mysql://localhost:3306/$DATABASE_NAME</url>

<url>jdbc:oracle:thin:localhost:1521:$SID</url>

<url>jdbc:postgresql:localhost:5432/$DATABASE_NAME</url>

This way all four database connection types are consistent in their default setup, allowing the user to easily configure them.

(Hint: if you are going to use the above, check them for accuracy; as noted I am new to JDBC).

Change History (8)

comment:1 by osjonathan, 14 years ago

Whoops, messed up the copying and pasting there. The middle set of URL's shouldn't be there obviously.

comment:2 by heikki, 14 years ago

All JDBC drivers have different connection strings -- some include hostname, some include portname, other ones only use a database schema name, and so on. For a list of thise see for example http://www.java2s.com/Tutorial/Java/0340__Database/AListofJDBCDriversconnectionstringdrivername.htm.

Conceivable we could create a kind of façade to this, as you are suggesting, so one could enter the necessary information for each driver in the same format, but in my opinion this is not desired, for the following reasons:

  1. it is normal amongst JDBC applications to put the connection string just like GeoNetwork does it; this is what everybody expects
  1. because of the variety in information needed to be provided to build the connection string for various drivers, any façade necessarily will be full of parts that should not carry any information for any particular driver; this will be only more confusing, I think

Just my 2¢ ..

comment:3 by osjonathan, 14 years ago

Hi Heikki, I think you mis-understand me. My suggestion is purely a aesthetic one really. Basically, the current strings all use different syntax to say the same thing in the default config. Instead I'm suggesting something very like your link shows with its use of <HOST> and <PORT> to consistently show the parameters across different strings.

I'm not suggesting GeoNetwork changes the way the strings are use or processed, only that the default values in the config.xml be changed to something clearer.

I.e. At present in the default config.xml one says "$WEBSERVER_HOST", one says "@IP", and another says "geonetwork", yet all of these are supposed to be representing the <HOSTNAME>.

Hope that clears it up.

comment:4 by heikki, 14 years ago

OK, so I had indeed misunderstood you there.

In this case, sure.

I'd suggest we follow the connection string representations as they are listed in http://www.java2s.com/Tutorial/Java/0340__Database/AListofJDBCDriversconnectionstringdrivername.htm.

And why not put in a few more, while at it ? With Oracle we already have non-Open Source in there anyway.

comment:5 by osjonathan, 14 years ago

No Problem. Yes, using the representation methods from that page should be good (i.e. the Angle brackets<> ), though the Oracle ones on there don't seem to include <host>.

As to other strings - If Geonetwork can use those databases then it'd be a good thing though probably a different ticket.

comment:6 by ticheler, 14 years ago

Milestone: v2.6.0v2.6.1

comment:7 by heikki, 14 years ago

Milestone: v2.6.1v2.6.2

comment:8 by fxp, 13 years ago

Milestone: v2.6.3v2.7.0
Resolution: fixed
Status: newclosed

Committed revision 7494.

Note: See TracTickets for help on using tickets.