Jeremiah Foster wrote:
On Tue, 2006-09-12 at 14:41 +0100, Dave Howorth wrote:
Jeremiah Foster wrote:
Is there a syntax for adding a remote host in the foo.tt file to access
a database that I should know? Or do I have to do everything from the
local host?
There's nothing special I know of. Just give the DSN to USE DBI:

  USE DBI( my_dsn );


I am doing something similar;
[% USE DBI %] [% DBI.connect('dbi:mysql:my_website', 'db_user',
'double_extra_secret') %]

Then I am doing
[% FOREACH item = DBI.query('SELECT * from table') %]


But if I change the DBI.connect line to include my remote host thusly;

[% USE DBI %] [% DBI.connect('dbi:mysql:my_website', 'db_user',
'double_extra_secret', 'remote_host') %]

it fails to work. This is why I suspect a syntax error despite the lack
of warnings in the logs, perl -C saying no syntax issues and no mention
of a remote host in perldoc DBI::Template::Plugins.

I must be doing something wrong. Just not sure where.

You're not specifying your DSN correctly.

'dbi:mysql:my_website'
 needs to become

'dbi:mysql:my_website;host=remote_host'

There's no magic 4th argument.

--
Richard Clamp <[EMAIL PROTECTED]>

_______________________________________________
templates mailing list
[email protected]
http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to