<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Xyiry PHP Blog &#124; Where Open Source Lives &#187; IBM DB2</title>
	<atom:link href="http://php.xyiry.com/category/ibm-db2/feed/" rel="self" type="application/rss+xml" />
	<link>http://php.xyiry.com</link>
	<description>My open source playground</description>
	<lastBuildDate>Wed, 18 Nov 2009 12:06:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Linux db2cc cannot open display</title>
		<link>http://php.xyiry.com/linux-db2cc-cannot-open-display/</link>
		<comments>http://php.xyiry.com/linux-db2cc-cannot-open-display/#comments</comments>
		<pubDate>Wed, 18 Nov 2009 08:20:13 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[IBM DB2]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/?p=43</guid>
		<description><![CDATA[If you are having problem as mention below, you may try this.
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;
Problem Scenario db2cc
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;
db2inst1@ubuntu:/home/xyiry$ export DISPLAY=:0.0
db2inst1@ubuntu:/home/xyiry$ db2cc
No protocol specified
Error : Can not open display
db2inst1@ubuntu:/home/xyiry$
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;
Problem Solving db2cc
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;
Type in this command in terminal.
db2inst1@ubuntu:/home/xyiry$ xhost +
db2inst1@ubuntu:/home/xyiry$ su db2inst1
db2inst1@ubuntu:/home/xyiry$ export DISPLAY=:0.0
db2inst1@ubuntu:/home/xyiry$ db2cc
Hope it works&#8230;
]]></description>
			<content:encoded><![CDATA[<p>If you are having problem as mention below, you may try this.</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
<strong>Problem Scenario db2cc</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
<strong>db2inst1@ubuntu:/home/xyiry$</strong> export DISPLAY=:0.0<br />
<strong>db2inst1@ubuntu:/home/xyiry$</strong> db2cc<br />
No protocol specified</p>
<p>Error : Can not open display<br />
<strong>db2inst1@ubuntu:/home/xyiry$</strong></p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
<strong>Problem Solving db2cc</strong><br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Type in this command in terminal.</p>
<p><strong>db2inst1@ubuntu:/home/xyiry$</strong> xhost +<br />
<strong>db2inst1@ubuntu:/home/xyiry$</strong> su db2inst1<br />
<strong>db2inst1@ubuntu:/home/xyiry$</strong> export DISPLAY=:0.0<br />
<strong>db2inst1@ubuntu:/home/xyiry$</strong> db2cc</p>
<p>Hope it works&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/linux-db2cc-cannot-open-display/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to export db2 table</title>
		<link>http://php.xyiry.com/how-to-export-db2-table/</link>
		<comments>http://php.xyiry.com/how-to-export-db2-table/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 08:53:49 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[IBM DB2]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/how-to-export-db2-table/</guid>
		<description><![CDATA[This is how you export your table in a DB2 Database.
1) First of all make sure you already login as a db2admin or db2 privilege user.
2) Secondly key in  -&#62;    db2 EXPORT TO file.del of DEL &#8216; select * from yourtablename&#8217;
3) You&#8217;re done. It will export your file into a comma [...]]]></description>
			<content:encoded><![CDATA[<p>This is how you export your table in a DB2 Database.</p>
<p>1) First of all make sure you already login as a db2admin or db2 privilege user.</p>
<p>2) Secondly key in  -&gt;    db2 EXPORT TO file.del of DEL &#8216; select * from yourtablename&#8217;</p>
<p>3) You&#8217;re done. It will export your file into a comma separated value file or known as a CSV format file.</p>
<p>By Zairy</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/how-to-export-db2-table/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to backup your DB2</title>
		<link>http://php.xyiry.com/how-to-backup-your-db2/</link>
		<comments>http://php.xyiry.com/how-to-backup-your-db2/#comments</comments>
		<pubDate>Mon, 15 Sep 2008 08:49:32 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[IBM DB2]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/how-to-backup-your-db2/</guid>
		<description><![CDATA[Hi today I&#8217;m going to share with you on how to backup your db2 database.
I&#8217;m assuming you guys are running db2 on Unix platform.  So make sure you login as a DB2 Administrator.
For my case I logged in as db2inst1
Steps:
1) su db2inst1
2) db2 connect to databasename
3) mkdir /usr/db2backup
4) db2 backup db databasename to /usr/db2backup
So [...]]]></description>
			<content:encoded><![CDATA[<p>Hi today I&#8217;m going to share with you on how to backup your db2 database.</p>
<p>I&#8217;m assuming you guys are running db2 on Unix platform.  So make sure you login as a DB2 Administrator.</p>
<p>For my case I logged in as db2inst1</p>
<p>Steps:</p>
<p>1) su db2inst1</p>
<p>2) db2 connect to databasename</p>
<p>3) mkdir /usr/db2backup</p>
<p>4) db2 backup db databasename to /usr/db2backup</p>
<p>So that&#8217;s all for db2 backup.</p>
<p>By Zairy</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/how-to-backup-your-db2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to truncate DB2 Table</title>
		<link>http://php.xyiry.com/how-to-truncate-db2-table/</link>
		<comments>http://php.xyiry.com/how-to-truncate-db2-table/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 03:48:27 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[IBM DB2]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/how-to-truncate-db2-table/</guid>
		<description><![CDATA[DB2 Truncate is not as straight forward as Oracle Truncate. If in Oracle you can use &#8220;truncate table &#8220;&#8230;  You may use the below command to truncate table in db2.
alter table schema.table_name activate not logged initially with empty table
]]></description>
			<content:encoded><![CDATA[<p>DB2 Truncate is not as straight forward as Oracle Truncate. If in Oracle you can use &#8220;truncate table &#8220;&#8230;  You may use the below command to truncate table in db2.</p>
<p><span name="intelliTXT" id="intelliTXT"><code>alter table schema.table_name activate not logged initially with empty table</code></span></p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/how-to-truncate-db2-table/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to stop db2 instance , if &#8220;db2stop&#8221; fails &#8230;</title>
		<link>http://php.xyiry.com/how-to-stop-db2-instance-if-db2stop-force-fails/</link>
		<comments>http://php.xyiry.com/how-to-stop-db2-instance-if-db2stop-force-fails/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 09:35:37 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[IBM DB2]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/how-to-stop-db2-instance-if-db2stop-force-fails/</guid>
		<description><![CDATA[If your DB2 fails to stop using db2 instance, you may use &#8220;db2stop force&#8221;.
To Start Db2 : db2start
To Stop Db2  : db2stop
To Force Stop Db2  : db2stop force
 

]]></description>
			<content:encoded><![CDATA[<p>If your DB2 fails to stop using db2 instance, you may use &#8220;db2stop force&#8221;.</p>
<p>To Start Db2 : db2start<br />
To Stop Db2  : db2stop</p>
<p>To Force Stop Db2  : db2stop force<br />
<span style="font-size: 10pt; font-family: 'Helvetica','sans-serif'; color: #336666"> <!--[if !supportLineBreakNewLine]--><br />
<!--[endif]--></span></p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/how-to-stop-db2-instance-if-db2stop-force-fails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DB2 General Statements</title>
		<link>http://php.xyiry.com/db2-general-statements/</link>
		<comments>http://php.xyiry.com/db2-general-statements/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 07:43:46 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[IBM DB2]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/db2-general-statements/</guid>
		<description><![CDATA[Table of Contents          
* db2_autocommit — Returns or sets the AUTOCOMMIT state for a database connection
* db2_bind_param — Binds a PHP variable to an SQL statement parameter
* db2_client_info — Returns an object with properties that describe the DB2 database client
* db2_close — Closes a database connection
* db2_column_privileges — Returns a result set listing the columns and [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Table of Contents          </strong></p>
<p>* db2_autocommit — Returns or sets the AUTOCOMMIT state for a database connection<br />
* db2_bind_param — Binds a PHP variable to an SQL statement parameter<br />
* db2_client_info — Returns an object with properties that describe the DB2 database client<br />
* db2_close — Closes a database connection<br />
* db2_column_privileges — Returns a result set listing the columns and associated privileges for a table<br />
* db2_columns — Returns a result set listing the columns and associated metadata for a table<br />
* db2_commit — Commits a transaction<br />
* db2_conn_error — Returns a string containing the SQLSTATE returned by the last connection attempt<br />
* db2_conn_errormsg — Returns the last connection error message and SQLCODE value<br />
* db2_connect — Returns a connection to a database<br />
* db2_cursor_type — Returns the cursor type used by a statement resource<br />
* db2_escape_string — Used to escape certain characters.<br />
* db2_exec — Executes an SQL statement directly<br />
* db2_execute — Executes a prepared SQL statement<br />
* db2_fetch_array — Returns an array, indexed by column position, representing a row in a result set<br />
* db2_fetch_assoc — Returns an array, indexed by column name, representing a row in a result set<br />
* db2_fetch_both — Returns an array, indexed by both column name and position, representing a row in a result set<br />
* db2_fetch_object — Returns an object with properties representing columns in the fetched row<br />
* db2_fetch_row — Sets the result set pointer to the next row or requested row<br />
* db2_field_display_size — Returns the maximum number of bytes required to display a column<br />
* db2_field_name — Returns the name of the column in the result set<br />
* db2_field_num — Returns the position of the named column in a result set<br />
* db2_field_precision — Returns the precision of the indicated column in a result set<br />
* db2_field_scale — Returns the scale of the indicated column in a result set<br />
* db2_field_type — Returns the data type of the indicated column in a result set<br />
* db2_field_width — Returns the width of the current value of the indicated column in a result set<br />
* db2_foreign_keys — Returns a result set listing the foreign keys for a table<br />
* db2_free_result — Frees resources associated with a result set<br />
* db2_free_stmt — Frees resources associated with the indicated statement resource<br />
* db2_get_option — Retrieves an option value for a statement resource or a connection resource<br />
* db2_lob_read — Gets a user defined size of LOB files with each invocation<br />
* db2_next_result — Requests the next result set from a stored procedure<br />
* db2_num_fields — Returns the number of fields contained in a result set<br />
* db2_num_rows — Returns the number of rows affected by an SQL statement<br />
* db2_pconnect — Returns a persistent connection to a database<br />
* db2_prepare — Prepares an SQL statement to be executed<br />
* db2_primary_keys — Returns a result set listing primary keys for a table<br />
* db2_procedure_columns — Returns a result set listing stored procedure parameters<br />
* db2_procedures — Returns a result set listing the stored procedures registered in a database<br />
* db2_result — Returns a single column from a row in the result set<br />
* db2_rollback — Rolls back a transaction<br />
* db2_server_info — Returns an object with properties that describe the DB2 database server<br />
* db2_set_option — Set options for connection or statement resources<br />
* db2_special_columns — Returns a result set listing the unique row identifier columns for a table<br />
* db2_statistics — Returns a result set listing the index and statistics for a table<br />
* db2_stmt_error — Returns a string containing the SQLSTATE returned by an SQL statement<br />
* db2_stmt_errormsg — Returns a string containing the last SQL statement error message<br />
* db2_table_privileges — Returns a result set listing the tables and associated privileges in a database<br />
* db2_tables — Returns a result set listing the tables and associated metadata in a database</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/db2-general-statements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Change date format DB2 from YYYYMMDD to MM/DD/YYYY</title>
		<link>http://php.xyiry.com/change-date-format-db2-from-yyyymmdd-to-mmddyyyy/</link>
		<comments>http://php.xyiry.com/change-date-format-db2-from-yyyymmdd-to-mmddyyyy/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 07:36:43 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[IBM DB2]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/change-date-format-db2-from-yyyymmdd-to-mmddyyyy/</guid>
		<description><![CDATA[==============================================
Module : To get date format for DB2 Date
Programmer : Mohd Izzairi Yamin
Date : 31/03/2008 15:36
==============================================
# DB2 Date Format :
2008-03-24 16:38:58.623431
Lets say, the Field that stores the date is in db2 time stamp format and you want to format it , you can use this simple way to solve that :
Example 1
select Year (DATEFIELD) from [...]]]></description>
			<content:encoded><![CDATA[<p>==============================================<br />
Module : To get date format for DB2 Date<br />
Programmer : Mohd Izzairi Yamin<br />
Date : 31/03/2008 15:36<br />
==============================================</p>
<p># DB2 Date Format :<br />
2008-03-24 16:38:58.623431</p>
<p>Lets say, the Field that stores the date is in db2 time stamp format and you want to format it , you can use this simple way to solve that :</p>
<p><u>Example 1</u></p>
<p>select Year (DATEFIELD) from TABLENAME<br />
select Month (DATEFIELD) from TABLENAME<br />
select day (DATEFIELD) from TABLENAME</p>
<p><u>Example 2</u></p>
<p>select Year(FDTARIKH),MONTH(FDTARIKH),day(FDTARIKH) from TBLOGLOGIN</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/change-date-format-db2-from-yyyymmdd-to-mmddyyyy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple DB2 Query in Functions</title>
		<link>http://php.xyiry.com/simple-db2-query-in-functions/</link>
		<comments>http://php.xyiry.com/simple-db2-query-in-functions/#comments</comments>
		<pubDate>Mon, 13 Aug 2007 03:42:35 +0000</pubDate>
		<dc:creator>Xyiry</dc:creator>
				<category><![CDATA[IBM DB2]]></category>

		<guid isPermaLink="false">http://php.xyiry.com/simple-db2-query-in-functions/</guid>
		<description><![CDATA[This is a library for you to connect to DB2 with simpler query in array results.
Click Here to Download &#62;&#62; 
================================================================
Module     : PHP database class
Programmer : Mohd Izzairi Yamin
Date       : 5/10/2007 9:30AM
Modified   : 8/10/2007 12:12PM
================================================================
&#60;?
session_name(&#8221;DBSESSID&#8221;);
session_start();
class connection {
function db_conn(){
global $conn;
$database = &#8216;UATBIND2&#8242;;
$user = &#8216;db2admin&#8217;;
$password [...]]]></description>
			<content:encoded><![CDATA[<p><strong>This is a library for you to connect to DB2 with simpler query in array results.</strong></p>
<p><a href="http://www.xyiry.com/demo/db2.zip" title="DB2 Simple Library">Click Here to Download &gt;&gt; </a><br />
================================================================<br />
Module     : PHP database class<br />
Programmer : Mohd Izzairi Yamin<br />
Date       : 5/10/2007 9:30AM<br />
Modified   : 8/10/2007 12:12PM<br />
================================================================</p>
<p>&lt;?<br />
session_name(&#8221;DBSESSID&#8221;);<br />
session_start();</p>
<p>class connection {</p>
<p>function db_conn(){<br />
global $conn;</p>
<p>$database = &#8216;UATBIND2&#8242;;<br />
$user = &#8216;db2admin&#8217;;<br />
$password = &#8216;db2admin&#8217;;<br />
$hostname = &#8216;192.168.0.201&#8242;;<br />
$port = 50000;</p>
<p>//To initialize the database connection<br />
//with connection name,port,username &amp; password<br />
$conn = &#8220;DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$database;&#8221; .<br />
&#8220;HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;&#8221;;<br />
$conn = db2_connect($conn, &#8221;, &#8221;);</p>
<p>if ($conn) {<br />
echo &#8220;&#8221;;<br />
//db2_close($conn);<br />
}<br />
else {<br />
echo &#8220;&lt;center&gt;&lt;b&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;font face=&#8217;tahoma&#8217; color=&#8217;red&#8217; size=&#8217;3&#8242;&gt;Hahaha !  &#8230;. Database Server Down !&lt;/font&gt;&lt;br&gt;&#8221;;<br />
echo &#8220;&lt;font face=&#8217;tahoma&#8217; color=&#8217;blue&#8217; size=&#8217;3&#8242;&gt;Please contact Mohd Izzairi Yamin &lt;/font&gt;&lt;br&gt;&lt;/center&gt;&#8221;;<br />
error_reporting(0);<br />
die();<br />
}<br />
return $conn;<br />
}<br />
// This function is for db2 to query the SQL statement<br />
// where $sql is the parameters and will be read by the function<br />
function db_query($sql) {<br />
global $res_rs,$res,$conn,$b;<br />
$res = &#8220;$sql&#8221;;<br />
$res_rs=db2_prepare($conn,$res);<br />
$b=db2_execute($res_rs);<br />
return $res_rs;<br />
return $b;<br />
}<br />
// This function is for db2 to get array results in row set from the SQL queried<br />
function db_fetch_row($res_rs) {<br />
global $arr;<br />
$arr = db2_fetch_row($res_rs);<br />
return $arr;<br />
}</p>
<p>function db_array($val) {<br />
global $res_rs,$arr;<br />
$arr = db2_result($res_rs,$val);<br />
return $arr;<br />
}</p>
<p>// This function is for db2 to get array results from the SQL queried<br />
function db_fetch_array($res_rs) {<br />
global $arr;<br />
$arr = db2_fetch_array($res_rs);<br />
return $arr;<br />
}</p>
<p>function check_session(){<br />
if (!isset($_SESSION['USERNAME'])){<br />
$goto=&#8217;../index.php&#8217;;<br />
echo &#8220;&lt;SCRIPT language=&#8217;JavaScript&#8217;&gt;&#8221;;<br />
echo &#8220;parent.window.location=&#8217;$goto&#8217;;&#8221;;<br />
echo &#8220;&lt;/SCRIPT&gt;&#8221;;</p>
<p>}<br />
}</p>
<p>} // End Class Connection<br />
?&gt;</p>
<p>See more on how to implement<br />
<span id="more-26"></span>&lt;?<br />
/*================================================================<br />
# Module     : Creating simple database query with smarty templating<br />
# Programmer : Mohd Izzairi Yamin<br />
# Date       : 8/10/2007 12:12PM<br />
# Modified   : 8/10/2007 12:12PM<br />
================================================================*/<br />
include_once&#8221;db2.php&#8221;;<br />
include_once&#8221;lib/smarty.php&#8221;;<br />
$db=new connection();<br />
$db-&gt;db_conn();</p>
<p>$tpl=new dfs_sm();<br />
$tpl-&gt;inc_tmp();</p>
<p>//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV<br />
//  Declare title for templating<br />
//VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV</p>
<p>$title=&#8221;Welcome to Xyiry Systems | Smart Business Solutions&#8221;;<br />
$pathname=&#8221;index.tpl&#8221;;</p>
<p>$sql = &#8220;select * from x_user_records where username=&#8217;$username&#8217;&#8221;;</p>
<p>$stmt = $db-&gt;db_query($sql);<br />
while($sql_rs2=$db-&gt;db_fetch_array($stmt)){<br />
$tpl-&gt;name(&#8217;agent&#8217;,$sql_rs2[0]);<br />
}</p>
<p>$tpl-&gt;name(&#8217;html_title&#8217;,$title);<br />
$tpl-&gt;page($pathname);<br />
?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://php.xyiry.com/simple-db2-query-in-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
