Trouble externalising DataSource.groovy username and password

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Trouble externalising DataSource.groovy username and password

micke_
Hi

I'm not sure why this doesn't work, looking at proposed way to do this online makes me think that what I'm trying to do should work:

What I'm doing in Config.groovy:

environments{

    devmysql {
        grails.config.locations << gapet.config.GapetDevConfig
        resourceToLoad = 'http://pastebin.com/raw.php?i=hfMHckRt'
    }
}

// loading some common config
grails.config.locations << gapet.config.GapetCommonConfig
grails.config.locations << "file:"+new ResourceToFileHelper().toFile(resourceToLoad).absolutePath
println "(*) ${grails.config.locations}"

The contents of http://pastebin.com/raw.php?i=hfMHckRt :
dataSource.username =sa
dataSource.password= 
jadajada =some jada jada value

In DataSource.groovy I don't have any username and password details.

The println prints:
(*) [class gapet.config.GapetDevConfig, class gapet.config.GapetCommonConfig, file:C:\Users\User\AppData\Local\Temp\temp4029658572197469487.properties]

None of the external config seems to get loaded, I get this error message:
Caused by SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user ''@'localhost' to database 'gapet_1')
->> 1549 | createPoolableConnectionFactory in org.apache.commons.dbcp.BasicDataSource

Any ideas about where I'm going wrong? Debugging the ConfigurationHelper I can see that the values are being read in, but aren't used when creating the data source.

Cheers,
 Micke
Reply | Threaded
Open this post in threaded view
|

Re: Trouble externalising DataSource.groovy username and password

micke_
Also noticed that when I have:
file:C:\Users\User\AppData\Local\Temp\temp4029658572197469487.properties

dataSource.username and password seems to be cleared, tried putting them back in DataSource.groovy to see it it would work but it doesn't unless I remove the temp4029658572197469487.properties file from grails.config.locations


On 9 October 2012 21:16, Mikael Andersson <[hidden email]> wrote:
Hi

I'm not sure why this doesn't work, looking at proposed way to do this online makes me think that what I'm trying to do should work:

What I'm doing in Config.groovy:

environments{

    devmysql {
        grails.config.locations << gapet.config.GapetDevConfig
        resourceToLoad = 'http://pastebin.com/raw.php?i=hfMHckRt'
    }
}

// loading some common config
grails.config.locations << gapet.config.GapetCommonConfig
grails.config.locations << "file:"+new ResourceToFileHelper().toFile(resourceToLoad).absolutePath
println "(*) ${grails.config.locations}"

The contents of http://pastebin.com/raw.php?i=hfMHckRt :
dataSource.username =sa
dataSource.password= 
jadajada =some jada jada value

In DataSource.groovy I don't have any username and password details.

The println prints:
(*) [class gapet.config.GapetDevConfig, class gapet.config.GapetCommonConfig, file:C:\Users\User\AppData\Local\Temp\temp4029658572197469487.properties]

None of the external config seems to get loaded, I get this error message:
Caused by SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user ''@'localhost' to database 'gapet_1')
->> 1549 | createPoolableConnectionFactory in org.apache.commons.dbcp.BasicDataSource

Any ideas about where I'm going wrong? Debugging the ConfigurationHelper I can see that the values are being read in, but aren't used when creating the data source.

Cheers,
 Micke