<?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>Weez.com &#187; connecting</title>
	<atom:link href="http://www.weez.com/tag/connecting/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.weez.com</link>
	<description>Solving everyday practical LAMP problems... one at a time</description>
	<lastBuildDate>Sat, 11 Feb 2012 03:24:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Connecting orphaned .ibd files</title>
		<link>http://www.weez.com/2011/05/connecting-orphaned-ibd-files/</link>
		<comments>http://www.weez.com/2011/05/connecting-orphaned-ibd-files/#comments</comments>
		<pubDate>Fri, 13 May 2011 08:44:00 +0000</pubDate>
		<dc:creator>Abidoon</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[.ibd]]></category>
		<category><![CDATA[connecting]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[orphaned]]></category>

		<guid isPermaLink="false">http://www.weez.com/2011/05/connecting-orphaned-ibd-files/</guid>
		<description><![CDATA[There are two ways InnoDB can organize tablespaces. First is when all data, indexes and system buffers are stored in a single tablespace. This is typicaly one or several ibdata files. A well known innodb_file_per_table option brings the second one. Tables and system areas are split into different files. Usually system tablespace is located in [...]]]></description>
			<content:encoded><![CDATA[<p>There are two ways InnoDB can organize tablespaces. First is when all data, indexes and system buffers are stored in a single tablespace. This is typicaly one or several ibdata files. A well known <em>innodb_file_per_table</em> option brings the second one. Tables and system areas are split into different files. Usually system tablespace is located in <em>ibdata1 </em>file and every InnoDB table has two files e.g.  <em>actor.frm</em> and <em>actor.ibd</em>.</p>
<p>The annoying thing about .ibd files you can&#8217;t easily copy the an .ibd file to another MySQL server. If you try to very often you&#8217;ll get an error in the log:</p>
<pre>InnoDB: Error: tablespace id is 10 in the data dictionary
InnoDB: but in file ./sakila/actor.ibd it is 15!</pre>
<p>However sometimes you have to connect the .ibd file to an alien ibdata1.<br />
<span id="more-6558"></span><br />
There are several situation when you have to:</p>
<p>1. ibdata1 is erroneously removed</p>
<p>2. ibdata1 is heavily corrupted and innodb_force_recovery doesn&#8217;t help</p>
<p>Chris Calender suggests <a href="http://www.chriscalender.com/?p=28" target="_blank">two methods</a>. The first is create/drop the table many times until space_id in InnoDB dictionary and .ibd file match. The second is to edit space_id inside .ibd file with a hex editor.</p>
<p>I would like to elaborate the second method.</p>
<p>But let&#8217;s understand first what&#8217;s going on and why InnoDB refuses to use suggested .ibd file.</p>
<p>There is an InnoDB dictionary. It consists of several internal tables. For our topic only SYS_TABLES and SYS_INDEXES are relevant. These are usual InnoDB tables, but they&#8217;re hidden from a user(you can see them in <a href="http://www.percona.com/docs/wiki/percona-server:features:innodb_show_sys_tables">information_scheme database</a> in <a href="http://www.percona.com/software/percona-server/">Percona Server</a> though).</p>
<p>The structure of these tables is following:</p>
<p>SYS_TABLES:</p>
<pre>CREATE TABLE `SYS_TABLES` (
`NAME` varchar(255) NOT NULL default '',
`ID` bigint(20) unsigned NOT NULL default '0',
`N_COLS` int(10) default NULL,
`TYPE` int(10) unsigned default NULL,
`MIX_ID` bigint(20) unsigned default NULL,
`MIX_LEN` int(10) unsigned default NULL,
`CLUSTER_NAME` varchar(255) default NULL,
`SPACE` int(10) unsigned default NULL,
PRIMARY KEY  (`NAME`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1</pre>
<p>SYS_INDEXES:</p>
<pre>CREATE TABLE `SYS_INDEXES` (
`TABLE_ID` bigint(20) unsigned NOT NULL default '0',
`ID` bigint(20) unsigned NOT NULL default '0',
`NAME` varchar(120) default NULL,
`N_FIELDS` int(10) unsigned default NULL,
`TYPE` int(10) unsigned default NULL,
`SPACE` int(10) unsigned default NULL,
`PAGE_NO` int(10) unsigned default NULL,
PRIMARY KEY  (`TABLE_ID`,`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1</pre>
<p>Please note field <em>SPACE</em>. For table actor it is equal to 15:</p>
<pre>mysql&gt; select * from `INNODB_SYS_TABLES` where `SCHEMA` = 'sakila' AND `NAME` = 'actor'\G
*************************** 1. row ***************************
SCHEMA: sakila
NAME: actor
ID: 13
N_COLS: 2147483652
TYPE: 1
MIX_ID: 0
MIX_LEN: 0
CLUSTER_NAME:
SPACE: 15
1 row in set (0.00 sec)</pre>
<p><em>SPACE </em>is equal to 15 in all actor&#8217;s indexes:</p>
<pre>mysql&gt; select * from INNODB_SYS_INDEXES WHERE TABLE_ID = 13\G
*************************** 1. row ***************************
TABLE_ID: 13
ID: 15
NAME: PRIMARY
N_FIELDS: 1
TYPE: 3
SPACE: 15
PAGE_NO: 3
*************************** 2. row ***************************
TABLE_ID: 13
ID: 16
NAME: idx_actor_last_name
N_FIELDS: 1
TYPE: 0
SPACE: 15
PAGE_NO: 4
2 rows in set (0.00 sec)</pre>
<p>In InnoDB world actor.ibd is a tablespace. It has space_id and it is equal to 15 for this particular table at this particular server.</p>
<p>As you can see secondary indexes are stored in actor.ibd as well.</p>
<p>But where is space_id in actor.ibd?</p>
<p>Like any other tablespace actor.ibd costsists of a set of InnoDB pages. A page is 16k long (UNIV_PAGE_SIZE in the source code).</p>
<p>Let&#8217;s take a look at the page header:</p>
<table border="1">
<caption>InnoDB Page Header</caption>
<tbody>
<tr>
<th>Name</th>
<th>Size</th>
<th>Description</th>
</tr>
<tr>
<td>FIL_PAGE_SPACE_OR_CHKSUM</td>
<td>4</td>
<td>/* in &lt; MySQL-4.0.14 space id the<br />
page belongs to (== 0) but in later<br />
versions the &#8216;new&#8217; checksum of the<br />
page */</td>
</tr>
<tr>
<td>FIL_PAGE_OFFSET</td>
<td>4</td>
<td>ordinal page number from start of space</td>
</tr>
<tr>
<td>FIL_PAGE_PREV</td>
<td>4</td>
<td>offset of previous page in key order</td>
</tr>
<tr>
<td>FIL_PAGE_NEXT</td>
<td>4</td>
<td>offset of next page in key order</td>
</tr>
<tr>
<td>FIL_PAGE_LSN</td>
<td>8</td>
<td>log serial number of page&#8217;s latest log record</td>
</tr>
<tr>
<td>FIL_PAGE_TYPE</td>
<td>2</td>
<td>current defined types are: FIL_PAGE_INDEX, FIL_PAGE_UNDO_LOG, FIL_PAGE_INODE, FIL_PAGE_IBUF_FREE_LIST</td>
</tr>
<tr>
<td>FIL_PAGE_FILE_FLUSH_LSN</td>
<td>8</td>
<td>&#8220;the file has been flushed to disk at least up to this lsn&#8221; (log serial number), valid only on the first page of the file</td>
</tr>
<tr>
<th>FIL_PAGE_ARCH_LOG_NO_OR_SPACE_NO</th>
<td>4</td>
<td>/* starting from 4.1.x this<br />
contains the space id of the page */</td>
</tr>
</tbody>
</table>
<p>So, space_id is 4 bytes written to every InnoDB page. An .ibd file can be huge, while ibdata1 is usually smaller. Thus, it is easier to modify space_id in InnoDB dictionary once than in every InnoDB page.</p>
<p>How let&#8217;s connect actor.ibd from sakila database taken from some MySQL server.</p>
<p>0. Create empty InnoDB tablespace.</p>
<p>1. Create the table:</p>
<pre>mysql&gt;CREATE TABLE actor (
actor_id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
first_name VARCHAR(45) NOT NULL,
last_name VARCHAR(45) NOT NULL,
last_update TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY  (actor_id),
KEY idx_actor_last_name (last_name)
)ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
<p>This command will create respective records in SYS_TABLES and SYS_INDEXES.</p>
<p>2. Now let&#8217;s modify SPACE in InnoDB dictionary. <strong>MySQL must be stopped at this point</strong>. There is a tool <strong>ibdconnect </strong>in <a href="https://launchpad.net/percona-innodb-recovery-tool">Percona InnoDB Recovery Tool</a>. Make sure you&#8217;re using the latest version from the trunk.</p>
<p>It reads space_id from an .ibd file and updates the dictionary in ibdata1.</p>
<pre># ./ibdconnect -o /var/lib/mysql/ibdata1 -f /var/lib/mysql/sakila/actor.ibd -d sakila -t actor
actor.ibd
actor.ibd belongs to space #15
... Skipped output...
SYS_TABLES is updated successfully
... Skipped output...
SYS_INDEXES is updated successfully</pre>
<p>It is possible that space_id from actor.ibd is already used by some other table.<br />
In this case if ibdata was updated MySQL will fail to start with error:</p>
<pre>InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Error: trying to add tablespace 15 of name './sakila/customer.ibd'
InnoDB: to the tablespace memory cache, but tablespace
InnoDB: 15 of name './sakila/actor.ibd' already exists in the tablespace
InnoDB: memory cache!</pre>
<p>To refrain from such error ibdconnect does check if the space_id is already used.<br />
It will refuse to update ibdata1:</p>
<pre>$ ./ibdconnect -o ibdata1 -f t2.ibd -d sakila -t actor
...
Error: Space id: 12 is already used in InnoDB dictionary for table test/t2</pre>
<p>In this case you need to drop table `test`.`t2` and create it again. InnoDB will assign other space_id, thus 12 will be freed.</p>
<p>3. Now SPACE is modified in the dictionary, but checksums are bad. To regenerate them use <strong>innochecksum </strong>from the same toolset. Run it two times:</p>
<pre># ./innochecksum -f /var/lib/mysql/ibdata1
page 8 invalid (fails new style checksum)
page 8: new style: calculated = 0x B7C5C82C; recorded = 0x BFE71C21
fixing new checksum of page 8
page 11 invalid (fails new style checksum)
page 11: new style: calculated = 0x E4189B9B; recorded = 0x C168689B
fixing new checksum of page 11
#
# ./innochecksum -f /var/lib/mysql/ibdata1
page 8 invalid (fails old style checksum)
page 8: old style: calculated = 0x 8195646B; recorded = 0x DA79A2EE
fixing old checksum of page 8
page 8 invalid (fails new style checksum)
page 8: new style: calculated = 0x 119FD630; recorded = 0x B7C5C82C
fixing new checksum of page 8
page 11 invalid (fails old style checksum)
page 11: old style: calculated = 0x 908297E7; recorded = 0x 6536CEE8
fixing old checksum of page 11
page 11 invalid (fails new style checksum)
page 11: new style: calculated = 0x D5DC3269; recorded = 0x E4189B9B
fixing new checksum of page 11</pre>
<p>4. The third time to be sure ibdata1 has valid checksums:</p>
<pre>#./innochecksum /var/lib/mysql/ibdata1
#</pre>
<p>5. Now you can start MySQL and take a dump from the table. The table is accessible, but due to obvious reason it shold not be used in production.</p>
<p>The tool ibdconnect was tested on MySQL 5.1 on CentOS 5.6 x86_64. However it expected to work on all versions of MySQL/InnoDB.</p>
<p>View full post on <a href="http://www.mysqlperformanceblog.com/2011/05/13/connecting-orphaned-ibd-files/">MySQL Performance Blog</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.weez.com/2011/05/connecting-orphaned-ibd-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connecting To A Website Using File Transfer Protocols [Linux/Mac/PC]</title>
		<link>http://www.weez.com/2010/08/connecting-to-a-website-using-file-transfer-protocols-linuxmacpc/</link>
		<comments>http://www.weez.com/2010/08/connecting-to-a-website-using-file-transfer-protocols-linuxmacpc/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 22:34:04 +0000</pubDate>
		<dc:creator>Abidoon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[connecting]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[Linux/Mac/PC]]></category>
		<category><![CDATA[Protocols]]></category>
		<category><![CDATA[Transfer]]></category>
		<category><![CDATA[using]]></category>
		<category><![CDATA[Website]]></category>

		<guid isPermaLink="false">http://www.weez.com/2010/08/connecting-to-a-website-using-file-transfer-protocols-linuxmacpc/</guid>
		<description><![CDATA[In this video I demonstrate a simple method to connect to a host, in this case a website, to allow full access to the files in the root directory. This will allow you to edit the content of the website as you wish. FileZilla: filezilla-project.org Our website, with more tutorials such as this: www.brewedimagination.com Thanks [...]]]></description>
			<content:encoded><![CDATA[<p>					<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/RLilK36ZOX0?fs=1"></param><param name="allowFullScreen" value="true"></param>
					<embed src="http://www.youtube.com/v/RLilK36ZOX0?fs=1" type="application/x-shockwave-flash" width="425" height="355" allowfullscreen="true"></embed></object><br />
In this video I demonstrate a simple method to connect to a host, in this case a website, to allow full access to the files in the root directory. This will allow you to edit the content of the website as you wish. FileZilla: filezilla-project.org Our website, with more tutorials such as this: www.brewedimagination.com Thanks for watching! Please comment, rate, and subscribe!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weez.com/2010/08/connecting-to-a-website-using-file-transfer-protocols-linuxmacpc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do you create a chat system between 2 computers using PHP without connecting them into the internet?</title>
		<link>http://www.weez.com/2010/07/how-do-you-create-a-chat-system-between-2-computers-using-php-without-connecting-them-into-the-internet/</link>
		<comments>http://www.weez.com/2010/07/how-do-you-create-a-chat-system-between-2-computers-using-php-without-connecting-them-into-the-internet/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 13:03:57 +0000</pubDate>
		<dc:creator>Abidoon</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[between]]></category>
		<category><![CDATA[Chat]]></category>
		<category><![CDATA[computer's]]></category>
		<category><![CDATA[connecting]]></category>
		<category><![CDATA[Create]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[into]]></category>
		<category><![CDATA[system]]></category>
		<category><![CDATA[them]]></category>
		<category><![CDATA[using]]></category>
		<category><![CDATA[without]]></category>

		<guid isPermaLink="false">http://www.weez.com/2010/07/how-do-you-create-a-chat-system-between-2-computers-using-php-without-connecting-them-into-the-internet/</guid>
		<description><![CDATA[with mysql i suppose.. and/or any web-based language.. but i prefer php and mysql.^^ please give me links and/or tips. i really need to make this in 3 days. :&#8217;c thank you.]]></description>
			<content:encoded><![CDATA[<p>with mysql i suppose.. and/or any web-based language.. but i prefer php and mysql.^^</p>
<p>please give me links and/or tips.</p>
<p>i really need to make this in 3 days. :&#8217;c</p>
<p>thank you. <img src='http://www.weez.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.weez.com/2010/07/how-do-you-create-a-chat-system-between-2-computers-using-php-without-connecting-them-into-the-internet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to resolve the following error with MYSQL while connecting with PHP?</title>
		<link>http://www.weez.com/2010/04/how-to-resolve-the-following-error-with-mysql-while-connecting-with-php/</link>
		<comments>http://www.weez.com/2010/04/how-to-resolve-the-following-error-with-mysql-while-connecting-with-php/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 10:18:03 +0000</pubDate>
		<dc:creator>Abidoon</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[connecting]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[following]]></category>
		<category><![CDATA[Resolve]]></category>

		<guid isPermaLink="false">http://www.weez.com/2010/04/how-to-resolve-the-following-error-with-mysql-while-connecting-with-php/</guid>
		<description><![CDATA[I get the following error while connecting php with mysql. &#8220;Access denied for user &#8216;ODBC&#8217;@'localhost&#8217; (using password: NO)&#8221;.How to resolve this? what should be my username?]]></description>
			<content:encoded><![CDATA[<p>I get the following error while connecting php with mysql. &#8220;Access denied for user &#8216;ODBC&#8217;@'localhost&#8217; (using password: NO)&#8221;.How to resolve this? what should be my username?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weez.com/2010/04/how-to-resolve-the-following-error-with-mysql-while-connecting-with-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Connecting Open Office to mysql for Mail Merge #2</title>
		<link>http://www.weez.com/2010/04/connecting-open-office-to-mysql-for-mail-merge-2/</link>
		<comments>http://www.weez.com/2010/04/connecting-open-office-to-mysql-for-mail-merge-2/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 10:31:49 +0000</pubDate>
		<dc:creator>Abidoon</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[connecting]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Open]]></category>

		<guid isPermaLink="false">http://www.weez.com/2010/04/connecting-open-office-to-mysql-for-mail-merge-2/</guid>
		<description><![CDATA[In this tutorial, we use the existing database connection we created in #1 and use it to create a mail merge letter and labels]]></description>
			<content:encoded><![CDATA[<p>					<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/AjCFuyqJRqU?fs=1"></param><param name="allowFullScreen" value="true"></param>
					<embed src="http://www.youtube.com/v/AjCFuyqJRqU?fs=1" type="application/x-shockwave-flash" width="425" height="355" allowfullscreen="true"></embed></object><br />
In this tutorial, we use the existing database connection we created in #1 and use it to create a mail merge letter and labels</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weez.com/2010/04/connecting-open-office-to-mysql-for-mail-merge-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connecting Open Office to mysql for Mail Merge</title>
		<link>http://www.weez.com/2010/04/connecting-open-office-to-mysql-for-mail-merge/</link>
		<comments>http://www.weez.com/2010/04/connecting-open-office-to-mysql-for-mail-merge/#comments</comments>
		<pubDate>Fri, 02 Apr 2010 07:06:14 +0000</pubDate>
		<dc:creator>Abidoon</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[connecting]]></category>
		<category><![CDATA[Mail]]></category>
		<category><![CDATA[merge]]></category>
		<category><![CDATA[Office]]></category>
		<category><![CDATA[Open]]></category>

		<guid isPermaLink="false">http://www.weez.com/2010/04/connecting-open-office-to-mysql-for-mail-merge/</guid>
		<description><![CDATA[This tutorial demonstrates how to connect to a mysql database on a remote server using the mysql connector from the Open Office Extensions site and how to get the data ready to use in a later mail merge video.]]></description>
			<content:encoded><![CDATA[<p>					<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/eiUmOpnfjmg?fs=1"></param><param name="allowFullScreen" value="true"></param>
					<embed src="http://www.youtube.com/v/eiUmOpnfjmg?fs=1" type="application/x-shockwave-flash" width="425" height="355" allowfullscreen="true"></embed></object><br />
This tutorial demonstrates how to connect to a mysql database on a remote server using the mysql connector from the Open Office Extensions site and how to get the data ready to use in a later mail merge video.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weez.com/2010/04/connecting-open-office-to-mysql-for-mail-merge/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connecting Mysql database with Java jdbc Using netbeans</title>
		<link>http://www.weez.com/2010/03/connecting-mysql-database-with-java-jdbc-using-netbeans/</link>
		<comments>http://www.weez.com/2010/03/connecting-mysql-database-with-java-jdbc-using-netbeans/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 09:04:16 +0000</pubDate>
		<dc:creator>Abidoon</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[connecting]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[Netbeans]]></category>
		<category><![CDATA[using]]></category>

		<guid isPermaLink="false">http://www.weez.com/2010/03/connecting-mysql-database-with-java-jdbc-using-netbeans/</guid>
		<description><![CDATA[Connect Mysql database with Java jdbc using netbeans IDE in 10 minutes only.]]></description>
			<content:encoded><![CDATA[<p>					<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/Q6VZIyYUyQg?fs=1"></param><param name="allowFullScreen" value="true"></param>
					<embed src="http://www.youtube.com/v/Q6VZIyYUyQg?fs=1" type="application/x-shockwave-flash" width="425" height="355" allowfullscreen="true"></embed></object><br />
Connect Mysql database with Java jdbc using netbeans IDE in 10 minutes only.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weez.com/2010/03/connecting-mysql-database-with-java-jdbc-using-netbeans/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Connecting to a mysql database from vb.net &#8211; Part 1</title>
		<link>http://www.weez.com/2010/03/connecting-to-a-mysql-database-from-vb-net-part-1/</link>
		<comments>http://www.weez.com/2010/03/connecting-to-a-mysql-database-from-vb-net-part-1/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 14:14:20 +0000</pubDate>
		<dc:creator>Abidoon</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[connecting]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[from]]></category>
		<category><![CDATA[Part]]></category>
		<category><![CDATA[VB.net]]></category>

		<guid isPermaLink="false">http://www.weez.com/2010/03/connecting-to-a-mysql-database-from-vb-net-part-1/</guid>
		<description><![CDATA[Connecting to a mysql database from vb.net, for more about me www.rabihtawil.com]]></description>
			<content:encoded><![CDATA[<p>					<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/uV1xDrJnwLs?fs=1"></param><param name="allowFullScreen" value="true"></param>
					<embed src="http://www.youtube.com/v/uV1xDrJnwLs?fs=1" type="application/x-shockwave-flash" width="425" height="355" allowfullscreen="true"></embed></object><br />
Connecting to a mysql database from vb.net, for more about me www.rabihtawil.com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.weez.com/2010/03/connecting-to-a-mysql-database-from-vb-net-part-1/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux Server Hacks, Volume Two: Tips &amp; Tools for Connecting, Monitoring, and Troubleshooting</title>
		<link>http://www.weez.com/2010/03/linux-server-hacks-volume-two-tips-tools-for-connecting-monitoring-and-troubleshooting/</link>
		<comments>http://www.weez.com/2010/03/linux-server-hacks-volume-two-tips-tools-for-connecting-monitoring-and-troubleshooting/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 14:33:12 +0000</pubDate>
		<dc:creator>Abidoon</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[connecting]]></category>
		<category><![CDATA[Hacks]]></category>
		<category><![CDATA[Monitoring]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<category><![CDATA[Volume]]></category>

		<guid isPermaLink="false">http://www.weez.com/2010/03/linux-server-hacks-volume-two-tips-tools-for-connecting-monitoring-and-troubleshooting/</guid>
		<description><![CDATA[Product DescriptionToday&#8217;s system administrators deal with a vast number of situations, operating systems, software packages, and problems. Those who are in the know have kept their copy of Linux Server Hacks close at hand to ease their burden. And while this helps, it&#8217;s not enough: any sys admin knows there are many more hacks, cool [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.amazon.com/Linux-Server-Hacks-Two-Troubleshooting/dp/0596100825%3FSubscriptionId%3D0C19XXHDAH4R099HQER2%26tag%3Dreaditlcom-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0596100825" rel="nofollow"><img style="float:left;margin: 0 20px 10px 0;" src="http://ecx.images-amazon.com/images/I/513WnTAbEkL._SL160_.jpg" /></a></p>
<p><b>Product Description</b><br />Today&#8217;s system administrators deal with a vast number of situations, operating systems, software packages, and problems. Those who are in the know have kept their copy of Linux Server Hacks close at hand to ease their burden. And while this helps, it&#8217;s not enough: any sys admin knows there are many more hacks, cool tips, and ways of solving problems than can fit in a single volume (one that mere mortals can lift, that is).  Which is why we created Linux Server Hacks&#8230; <a href="http://www.amazon.com/Linux-Server-Hacks-Two-Troubleshooting/dp/0596100825%3FSubscriptionId%3D0C19XXHDAH4R099HQER2%26tag%3Dreaditlcom-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0596100825" rel="nofollow">More >></a></p>
<p><a href="http://www.amazon.com/Linux-Server-Hacks-Two-Troubleshooting/dp/0596100825%3FSubscriptionId%3D0C19XXHDAH4R099HQER2%26tag%3Dreaditlcom-20%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D0596100825" title="Linux Server Hacks, Volume Two: Tips &#038; Tools for Connecting, Monitoring, and Troubleshooting" rel="nofollow"><b>Linux Server Hacks, Volume Two: Tips &#038; Tools for Connecting, Monitoring, and Troubleshooting</b></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.weez.com/2010/03/linux-server-hacks-volume-two-tips-tools-for-connecting-monitoring-and-troubleshooting/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PHP PDO MySQL:Simple Example Connecting to MySQL with PDO Class</title>
		<link>http://www.weez.com/2010/03/php-pdo-mysqlsimple-example-connecting-to-mysql-with-pdo-class/</link>
		<comments>http://www.weez.com/2010/03/php-pdo-mysqlsimple-example-connecting-to-mysql-with-pdo-class/#comments</comments>
		<pubDate>Fri, 19 Mar 2010 09:14:01 +0000</pubDate>
		<dc:creator>Abidoon</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[connecting]]></category>
		<category><![CDATA[Example]]></category>
		<category><![CDATA[MySQLSimple]]></category>

		<guid isPermaLink="false">http://www.weez.com/2010/03/php-pdo-mysqlsimple-example-connecting-to-mysql-with-pdo-class/</guid>
		<description><![CDATA[&#13; I&#8217;ll demonstrate a simple example on how to connect to mysql using PHP&#8217;s PDO class. Just some of the benefits of PDO is that it&#8217;s fast and if you use the PDO::prepare() method it will prevent SQL injection attacks by calling the PDO::quote() method. The other pros is that there are several databases it [...]]]></description>
			<content:encoded><![CDATA[<p>&#13;</p>
<p>I&#8217;ll demonstrate a simple example on how to connect to mysql using PHP&#8217;s PDO class. Just some of the benefits of PDO is that it&#8217;s fast and if you use the PDO::prepare() method it will prevent SQL injection attacks by calling the PDO::quote() method. The other pros is that there are several databases it will support. So let&#8217;s dive right into the code:</p>
<p>$hostname = &#8216;localhost&#8217;;<br />$username = &#8216;your_username&#8217;;<br />$password = &#8216;your_password&#8217;;</p>
<p>try {<br /> $db = new PDO(&#8220;mysql:host=$hostname;dbname=mysql&#8221;, $username, $password);<br /> echo &#8216;Connected to database&#8217;;<br />}<br />catch(PDOException $e) {<br /> echo $e-&gt;getMessage();<br />}</p>
<p>Fatal Error new PDO Instance</p>
<p>Just an important note that if you receive the following type of fatal error in your development environment:</p>
<p>Fatal error: Uncaught exception &#8216;PDOException&#8217; with message &#8216;SQLSTATE[42000] [1049] Unknown database &#8221;user&#8221;&#8217; in C:Program FilesApache Software FoundationApache2.2htdocstesttrunkcodelogin1classesstd.pdo_singleton.class.inc:30 Stack trace: #0 C:Program FilesApache Software FoundationApache2.2htdocstesttrunkcodelogin1classesstd.pdo_singleton.class.inc(30): PDO-&gt;__construct(&#8216;mysql:host=loca&#8230;&#8217;, &#8216;username&#8217;, &#8216;password&#8217;) #1 C:Program FilesApache Software FoundationApache2.2htdocstesttrunkcodelogin1classesstd.mysql.class_test.inc(43): db::getConnect() #2 C:Program FilesApache Software FoundationApache2.2htdocstesttrunkcodelogin1connect.php(6): MySqlDb-&gt;confirmUserPass(&#8216;usertest&#8217;, &#8216;passtest&#8217;) #3 {main} thrown in C:Program FilesApache Software FoundationApache2.2htdocstesttrunkcodelogin1classesstd.pdo_singleton.class.inc on line 30</p>
<p>Looks pretty messy and hard to decipher. When trying to decipher error code I usually look at the first error which led me to see why it was reporting an &#8220;Unknown database&#8221; when it was existing. The extra quotes also gave me a hint as to the problem. So I concluded the problem resulted in the placement of extra quotes around the values of host and/or dbname. The following will generate the previous error:</p>
<p>$db = new PDO(&#8220;mysql:host=&#8217;localhost&#8217;;dbname=&#8217;mysql&#8217;&#8221;, $username, $password);</p>
<p>So if you do not use variables then do not add the single quotes for the values of host and dbname. In other words, use the following code instead:</p>
<p>$db = new PDO(&#8220;mysql:host=localhost;dbname=mysql&#8221;, $username, $password);</p>
<p>This is a simple test to connect to your mysql database or any other support database. Just for your information if you wish to connect to PostgreSQL which is another popular and robust database use the following code in place of the line of instantiation:</p>
<p>$db = new PDO(&#8220;pgsql:dbname=pdo;host=localhost&#8221;, &#8220;username&#8221;, &#8220;password&#8221; );</p>
<p>If you&#8217;re in a development environment and wish to display your errors directly to the screen you can specify the errors displayed. You need to set your display_errors settings to &#8216;on&#8217; in your php.ini file. So set your error attributes after instantiating the PDO class like so:</p>
<p>$db-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);</p>
<p>There are three types of error report settings for PDO::ATTR_ERRMODE:<br />PDO::ERRMODE_SILENT = error codes<br />PDO::ERRMODE_WARNING = E_WARNING<br />PDO::ERRMODE_EXCEPTION = Throw exceptions</p>
<p>Here&#8217;s an example of implementing PDO::ATR_ERRMODE:</p>
<p>$hostname = &#8216;localhost&#8217;;<br />$username = &#8216;your_username&#8217;;<br />$password = &#8216;your_password&#8217;;</p>
<p>try {<br /> $db = new PDO(&#8220;mysql:host=$hostname;dbname=articles&#8221;, $username, $password);</p>
<p> echo &#8216;Connected to database&#8217;; // check for connection</p>
<p> $db-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);</p>
<p> $sql = &#8216;Select * from tutorialref where id=1&#8242;;<br /> $result = $db-&gt;query($sql);<br /> foreach ($result as $row) {<br /> echo $row['id'] .&#8217; &#8211; &#8216;. $row['author'] . &#8216;<br />&#8216;;<br /> }</p>
<p> $db = null; // close the database connection</p>
<p>}<br />catch(PDOException $e) {<br /> echo $e-&gt;getMessage();<br />}</p>
<p>Don&#8217;t confuse this with the errors generated from the php setting of error_reporting. The errors from PDO::ATTR_ERRMODE apply to the sql query and its results. I&#8217;ll dive into the error settings and the different outputs of the php.ini error_reporting settings and PDO::ATTR_ERRMODE report settings in a future article.</p>
<div style="margin:5px;padding:5px;border:1px solid #c1c1c1;font-size: 10px;">
<p>PHP Tutorial, tips, guides. Learn PHP programming. Victor Kimura<br /><a target="_new" rel="nofollow" onclick="javascript:pageTracker._trackPageview('/outgoing/article_exit_link');" href="http://php.tutorialref.com">PHP Tutorial</a> Please view the original article to properly view the code and step-by-step snapshots:<a target="_new" rel="nofollow" onclick="javascript:pageTracker._trackPageview('/outgoing/article_exit_link');" href="http://php.tutorialref.com/pdo-mysql-connect-example.html">PHP PDO MySQL Connect Example</a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.weez.com/2010/03/php-pdo-mysqlsimple-example-connecting-to-mysql-with-pdo-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

