How to Connect to MySQL DB without GAST?

2 messages Options
Embed this post
Permalink
Ryan Clark

How to Connect to MySQL DB without GAST?

Reply Threaded More More options
Print post
Permalink
I'm working with GeoNetwork 2.4.2 running off of Tomcat 6.

On my Windows machine, I've been able to easily use GAST to connect to a
MySQL database. However, I have an Ubuntu Server 9.04 machine I'm also
trying to setup GeoNetwork on. On this machine I cannot run GAST (no GUI),
but also need to get GeoNetwork connected to MySQL. I thought that I would
make the change by adjusting the /web/geonetwork/WEB-INF/config.xml file as
shown below but that did not work. When I try to log in, I'm greeted with a
NullPointerException.

 Also, I noticed that on my Windows machine, GAST had not made any
adjustments to the config.xml file -- something else must be telling
GeoNetwork where to connect.

How do I configure GeoNetwork to connect to MySQL when I cannot use GAST?

Thanks,
Ryan

______________________________________

Adjusted config.xml file on Ubuntu machine:

<resources>
 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- mckoi standalone -->
 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<resource enabled="false">
 <name>main-db</name>
<provider>jeeves.resources.dbms.DbmsPool</provider>
 <config>
<user>xRgAPQLl</user>
<password>*******</password>
 <driver>com.mckoi.JDBCDriver</driver>
<url>jdbc:mckoi://localhost:9157/</url>
 <poolSize>10</poolSize>
</config>


 <activator
class="org.fao.geonet.activators.McKoiActivator"><configFile>WEB-INF/db/db.conf</configFile></activator></resource>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- mysql -->
 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

<resource enabled="true">
 <name>main-db</name>
<provider>jeeves.resources.dbms.DbmsPool</provider>
 <config>
<user>catalogAdmin</user>
<password>*******</password>
 <driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql://localhost:3306/geonetwork</url>
 <poolSize>10</poolSize>
<reconnectTime>3600</reconnectTime>
 </config>
</resource>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
GeoNetwork-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork
Heikki Doeleman

Re: How to Connect to MySQL DB without GAST?

Reply Threaded More More options
Print post
Permalink
you're correct to set it in config.xml.

The NPE indicates you're probably not correctly connected to the DB.

It should look something like

        <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
        <!-- mysql -->
        <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->

        <resource enabled="true">
            <name>main-db</name>
            <provider>jeeves.resources.dbms.DbmsPool</provider>
            <config>
                <user>YOUR_USERNAME</user>
                <password>YOUR_PASSWORD</password>
                <driver>com.mysql.jdbc.Driver</driver>

<url>jdbc:mysql://localhost:3306/YOUR_DB_NAME?useUnicode=true&characterEncoding=utf-8&mysqlEncoding=utf8&autoReconnect=true&jdbcCompliantTruncation=false</url>
                <poolSize>10</poolSize>
                <reconnectTime>3600</reconnectTime>
            </config>
</resource>

and any other <resource> definitions in that file, you should either remove
them or set the "enabled" attribute to "false".


Kind regards
Heikki Doeleman




On Fri, Nov 6, 2009 at 7:06 PM, Ryan Clark <[hidden email]> wrote:

> I'm working with GeoNetwork 2.4.2 running off of Tomcat 6.
>
> On my Windows machine, I've been able to easily use GAST to connect to a
> MySQL database. However, I have an Ubuntu Server 9.04 machine I'm also
> trying to setup GeoNetwork on. On this machine I cannot run GAST (no GUI),
> but also need to get GeoNetwork connected to MySQL. I thought that I would
> make the change by adjusting the /web/geonetwork/WEB-INF/config.xml file as
> shown below but that did not work. When I try to log in, I'm greeted with a
> NullPointerException.
>
>  Also, I noticed that on my Windows machine, GAST had not made any
> adjustments to the config.xml file -- something else must be telling
> GeoNetwork where to connect.
>
> How do I configure GeoNetwork to connect to MySQL when I cannot use GAST?
>
> Thanks,
> Ryan
>
> ______________________________________
>
> Adjusted config.xml file on Ubuntu machine:
>
> <resources>
>  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
> <!-- mckoi standalone -->
>  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
>
> <resource enabled="false">
>  <name>main-db</name>
> <provider>jeeves.resources.dbms.DbmsPool</provider>
>  <config>
> <user>xRgAPQLl</user>
> <password>*******</password>
>  <driver>com.mckoi.JDBCDriver</driver>
> <url>jdbc:mckoi://localhost:9157/</url>
>  <poolSize>10</poolSize>
> </config>
>
>
>  <activator
>
> class="org.fao.geonet.activators.McKoiActivator"><configFile>WEB-INF/db/db.conf</configFile></activator></resource>
>
> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
> <!-- mysql -->
>  <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
>
> <resource enabled="true">
>  <name>main-db</name>
> <provider>jeeves.resources.dbms.DbmsPool</provider>
>  <config>
> <user>catalogAdmin</user>
> <password>*******</password>
>  <driver>com.mysql.jdbc.Driver</driver>
> <url>jdbc:mysql://localhost:3306/geonetwork</url>
>  <poolSize>10</poolSize>
> <reconnectTime>3600</reconnectTime>
>  </config>
> </resource>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> GeoNetwork-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/geonetwork-users
> GeoNetwork OpenSource is maintained at
> http://sourceforge.net/projects/geonetwork
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
GeoNetwork-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/geonetwork-users
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork