Connect to SQL Server from UNIX

If you are looking for how to connect to SQL Server from UNIX here are few simple steps to configure them

1) First Download n install the POD
2) Then you need to run this JDBC driver as init 3 service. The script is at /etc/rc3.d/S77spmf
Code of S77spmf
#!/bin/sh
#
# Start/stop processes required for SPMF
#


case “$1″ in
‘start’)
/apps/iw-home/local/bin/spmf/db/start_jdbc.sh
;;
‘stop’)
/apps/iw-home/local/bin/spmf/db/stop_jdbc.sh
;;
*)
echo “Usage: $0 { start | stop }”
exit 1
;;
esac
exit 0
3) Copy these jar & properties files into a separate directory and start the JDBC service as given below in the script
sqljdbc.jar
log4j-1.2.15.jar
dbd_jdbc.jar
log4j.properties
/apps/iw-home/local/bin/spmf/db/start_jdbc.sh
#!/bin/sh
CLASSPATH=/apps/iw-home/local/bin/spmf/db/dbd_jdbc.jar:/apps/iw-home/local/bin/spmf/db/log4j-1.2.15.jar:/apps/iw-home/local/bin/spmf/db:/apps/iw-home/loca
l/bin/spmf/db/sqljdbc.jar
export CLASSPATH
DRIVERS=com.microsoft.sqlserver.jdbc.SQLServerDriver
/usr/bin/java -Xms64m -Xmx512m -Djdbc.drivers=$DRIVERS -Ddbd.port=9001 com.vizdom.dbd.jdbc.Server &
JDBC_PID=$!
echo $JDBC_PID > /apps/iw-home/local/bin/spmf/db/jdbc.pid
/apps/iw-home/local/bin/spmf/db/stop_jdbc.sh
echo “Killing: `cat /apps/iw-home/local/bin/spmf/db/jdbc.pid`”
kill -9 `cat /apps/iw-home/local/bin/spmf/db/jdbc.pid`
4) Now connect to the JDBC port 9001 instead of the SQL Server port in the code
use DBI;
use DBD::JDBC;
my $dbh = DBI->connect( “dbi:JDBC:hostname=$host;port=9001;url=jdbc:sqlserver://tucgpsqlnp:1445″,”userid”,”password” ) or die print $DBI::errstr;
my $sql = “select DepartmentID from Department where DepartmentName like ‘$dept%'”;
$sth = $dbh->prepare($sql);
$sth->execute()
That’t it. Enjoy

Clear ComboBox in DCT

Since FormAPI doens’t have a method to clear the first NULL value in the dropdown, this workaround should work

var cmb = IWDatacapture.getItem(“/combo”);
var cmb_options = cmb.getOptions();
if (cmb_options != null) {
for (var i = 0; i<cmb_options.length; i++) {
cmb_options[i].selected = false;
}
cmb.setOptions(cmb_options);
}

Improve EventSubsystem Perfomance

If you don’t really use DataDeploy DAS use can comment out the following file from iw-home/httpd/webapps/eventsubsystem/WEB-INF/iw_bridge_cfg.xml

<logFile name=”TeamSiteClientDASLog”
baseLogName=”/logs/iw/iwevents/TeamSiteClientEvents”
stateFileName=”/apps/iw-home/servletd/logs/iwclientDASproxy.properties”
waitTime=”30000″
isDAS=”true” />

<logFile name=”TeamSiteDASLog”
baseLogName=”/logs/iw/iwevents/TeamsiteEvents”
stateFileName=”/apps/iw-home/servletd/logs/iwDASproxy.properties”
waitTime=”30000″
isDAS=”true” />

Pradeep

ssh without password

Here is a simple how-to on setting up ssh without password

1) Client%: ssh-keygen2
2) Client%: scp id_dsa_2048_a.pub user@server:/$home/.ssh2/id_dsa_2048_a.client.pub
3) Client%: vi identification and put in this line IdKey id_dsa_2048_a

1) Server%: Login as user
2) If .ssh2 directory doesn’t exist then create one under $home/.ssh2
3) Server%: vi authorization and put in this line Key id_dsa_2048_a.client.pub

1) Client%: ssh user@Server

This should do the trick.

TeamSite Import Event

If you ever want to write some TeamSite triggers on Import Event, the event to capture is not CreateFSE or Lock. It’s RenameFSE, cos TeamSite before the file isimported create a new filename in temporary location. You need to capture ARGV[6] in your script to get the actual original filename. So in brief

Register the event
iwat RenameFSE /apps/xxxxx/script.ipl

In the script capture $import_rename = $ARGV[6];

Hope this helps.

Preview and Generate Error

The following error occurs when you try to preview a DCR.

Template Preview And Generate Error:

The following error occured while creating file
/.iwmnt/default/main/InternetMarketing/SystemsIntegrator/WORKAREA/Common/zz_tst_sun_lock:
No such file or directory
The templated file was not generated.

Though you the user is part of the group that owns that directory, you might repeatedly and randomly get this error. Resolution to this, navigate to the preview-dir specified in your templating.cfg and delete all .nsf* files that reside on that location. Also make sure to delete zz_tst_username_*_manifest file located under /templatedata directory.

I have been going nuts on this issue. Hope it helps.

Pradeep