Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
iw_sql_open on a remote db
dlukezic
I have a presentation template where I would like to perform a query on a database that resides on a different machine. Does anyone have an example of how to set up the iw_sql_open statement for this?
Thanks very much!
Doreen
Find more posts tagged with
Comments
Jens
Hi,
maybe this will work.
<iw_sql_open data_source = "dbi
racle:host=DB-NAME;port=PORT;sid=SID"
user_name = "USERNAME"
password = "PASSWORD"
connection = "dbh">
<iw_sql_query stmt = 'select * from tablename'
connection = 'dbh'
result_set = 'rs'/>
<iw_sql_iterate var='row' result_set='rs'>
<iw_value name='$row->{COLUMN_1}'/> <iw_value name='$row->{COLUMN_1}'/><br>
</iw_sql_iterate>
</iw_sql_open>
-- Jens
sample1.txt
MergedoutputTEST.pdf
Migrateduser
A common gotcha is this:
Regardless of whether a column in the database is specified in upper or
lower case, it will always be accessed via lower case within presentation
templates (this eliminates database-to-database inconsistancies in the
way case conversion is handled). For example, whether the "hat_size"
column was present in the database as "Hat_Size", or "HAT_SIZE",
templates will refer to the database column as "hat_size".
Migrateduser
Also, this works:
<iw_sql_open connection = 'dbh'
data_source = 'dbi
DBC:servername'
user_name = 'username'
password = 'passwrd'
aux_env="TEMP => 'C:\TEMP',
SYSTEMROOT => 'C:\WINNT'">
<iw_sql_query stmt = 'select * from article where iarticleid={iw_value name="kb.Tech Note #"/}'
connection = 'dbh'
result_set = 'all_customers' />
<iw_sql_iterate var ='titles'
result_set ='all_customers'
>
<b> <iw_value name='$titles->{nvchtitle}'/></b><br/>
<i><iw_value name='$titles->{ntextsynopsis}'/></i>
</iw_sql_iterate>
</iw_sql_open>