Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
DCI/ODBC database error inside TS, but works with
waldemar
Hello guys,
I don't know if I found a Teamsite bug or what is going on here...
This is the tiny code that's supposed to insert a new record into an odbc-connected mysql-database:
require DBI;
$db = DBI -> connect($strODBCName, $strUsername, $strPassword);
$sql = $db->prepare("INSERT INTO table (id) VALUES ('test')");
$sql->execute();
$sql->finish();
$db->disconnect;
Funny thing: Click on PREVIEW OR GENERATE creates a template error:
Could not process template: [...]
It looks like the code is able to open the connection but adding the line $db->prepare results in that error (also: I get the error when I connect and immediately disconnect the database!!)
...while when we run a script that calls the iwgen.exe everything works - as expected - fine!!!!!!
What's going on here?
Find more posts tagged with
Comments
waldemar
Sorry,the Subject of this post is:
DBI/ODBC database error inside TS, but works with iwgen.exe
Migrateduser
I think this is usally differences in the environment variable definitions in the two environments.
waldemar
since the code to be executed is identical... sounds reasonable, john... do you have any idea what environment vars could be involved and how any modifications to them need to look like?
Cheers
waldemar
Browsing a little in this forum it seems I found the right workaround. I read, for some reason (a bug?!?) the environment variables (at least the "important" ones" are cleared when the PT is "run".
Simply redefining the $ENV{SYSTEMROOT} solved the problem... (Of course this will cause some sysnchronisation trouble later; if the system-root on the client's machine is different)
thanks john for right hint!
Migrateduser
In case anyone else ever follows this thread, now I remember a second cause for this condition: on Windows a DSN can be user or system level, user level DSN would cause database interaction to work on the user's command line but not when running in the TeamSite (PT) environment.
Interwoven has said that clearing the environment is done for security reasons but I don't think that's the real reason (there are much bigger security issues).