Hello,
Is the Sql Plugin broken with Xwiki 2.2.5 ?
=>
1) I have added the xwiki-plugin-sql-1.5.jar file under WEB-INF/lib
2) I have updated xwiki.cfg with:
#-# List of active plugins.
xwiki.plugins=\
com.xpn.xwiki.monitor.api.MonitorPlugin,\
com.xpn.xwiki.plugin.skinx.JsSkinExtensionPlugin,\
com.xpn.xwiki.plugin.skinx.JsSkinFileExtensionPlugin,\
com.xpn.xwiki.plugin.skinx.CssSkinExtensionPlugin,\
com.xpn.xwiki.plugin.skinx.CssSkinFileExtensionPlugin,\
com.xpn.xwiki.plugin.feed.FeedPlugin,\
com.xpn.xwiki.plugin.ldap.LDAPPlugin,\
com.xpn.xwiki.plugin.google.GooglePlugin,\
com.xpn.xwiki.plugin.flickr.FlickrPlugin,\
com.xpn.xwiki.plugin.mail.MailPlugin,\
com.xpn.xwiki.plugin.packaging.PackagePlugin,\
com.xpn.xwiki.plugin.query.QueryPlugin,\
com.xpn.xwiki.plugin.svg.SVGPlugin,\
com.xpn.xwiki.plugin.charts.ChartingPlugin,\
com.xpn.xwiki.plugin.fileupload.FileUploadPlugin,\
com.xpn.xwiki.plugin.image.ImagePlugin,\
com.xpn.xwiki.plugin.userdirectory.UserDirectoryPlugin,\
com.xpn.xwiki.plugin.usertools.XWikiUserManagementToolsImpl,\
com.xpn.xwiki.plugin.zipexplorer.ZipExplorerPlugin,\
com.xpn.xwiki.plugin.autotag.AutoTagPlugin,\
com.xpn.xwiki.plugin.lucene.LucenePlugin,\
com.xpn.xwiki.plugin.diff.DiffPlugin,\
com.xpn.xwiki.plugin.rightsmanager.RightsManagerPlugin,\
com.xpn.xwiki.plugin.jodatime.JodaTimePlugin,\
com.xpn.xwiki.plugin.scheduler.SchedulerPlugin,\
com.xpn.xwiki.plugin.mailsender.MailSenderPlugin,\
com.xpn.xwiki.plugin.activitystream.plugin.ActivityStreamPlugin, \
com.xpn.xwiki.plugin.watchlist.WatchListPlugin, \
com.xpn.xwiki.wysiwyg.server.plugin.WysiwygPlugin, \
com.xpn.xwiki.plugin.tag.TagPlugin, \
ua.gradsoft.xwikisql.SqlPlugin
and
#---------------------------------------
# Sql Plugin behavior parameters
xwikisql.logSql=1
xwikisql.throwExceptions=1
3) I have created context.xml under META-INF with:
<Context>
<Resource name = "jdbc/NC" auth = "Container"
type = "javax.sql.DataSource"
driverClassName = "com.mysql.jdbc.Driver"
url = "jdbc:mysql://192.168.1.1:3306/NC"
username = "nc"
password = "nc"
maxActive = "30"
maxIdle = "20000"
maxWait = "120" />
</Context>
4) I have updated web.xml under WEB-INF with:
<resource-ref>
<description>NC DB Connection</description>
<res-ref-name>jdbc/NC</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
I know I can query this database from Xwiki because a groovy script with an
explicit declaration of the database, driver, user password etc and using
the very same query will dump a table.
5) I have updated log4j.properties under WEB-INF/classes with
## Activate Sql Plugin Loggging
log4j.logger.ua.gradsoft.xwikisql=debug
Then, after restarting Tomcat6, when I try:
{{velocity}}
#set ($mydb=$xwiki.sql.getDabase("jdbc/NC"))
#set ($rs=$mydb.executeQuery("select ID from TABLE"))
returned $rs.getNRows()
#set ($Message = "Why can't I get to the DB ?")
velocity message is $Message
{{/velocity}}
All I get is:
returned $rs.getNRows()
velocity message is Why can't I get to the DB ?
And in my xwiki.log I cannot see any error messages related to the sql
plugin. It's all looking like the sql plugin is totally ignored !!!
Can you tell me what I did wrong ?
Many thanks for your help,
Regards,
Christophe,