<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>efransiscus personal blog &#187; MySQL</title>
	<atom:link href="http://efransiscus.wordpress.com/category/computer/software/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://efransiscus.wordpress.com</link>
	<description>blog telling things around me</description>
	<lastBuildDate>Mon, 24 Aug 2009 15:47:54 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='efransiscus.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/3111c2b585e3a4ed91e144d350e3c56e?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>efransiscus personal blog &#187; MySQL</title>
		<link>http://efransiscus.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://efransiscus.wordpress.com/osd.xml" title="efransiscus personal blog" />
		<item>
		<title>Tutorial : Using MySQL ODBC Connector with Foxpro 9 and MySQL</title>
		<link>http://efransiscus.wordpress.com/2009/03/15/tutorial-using-mysql-odbc-connector-with-foxpro-9-and-mysql/</link>
		<comments>http://efransiscus.wordpress.com/2009/03/15/tutorial-using-mysql-odbc-connector-with-foxpro-9-and-mysql/#comments</comments>
		<pubDate>Sun, 15 Mar 2009 17:43:13 +0000</pubDate>
		<dc:creator>Erwin Fransiscus</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Foxpro]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[connect]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[odbc]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://efransiscus.wordpress.com/?p=147</guid>
		<description><![CDATA[Yesterday, I got a project to handle with MySQL and Visual Foxpro. I&#8217;m used to MySQL, and so does with Visual Foxpro. The trouble is that I&#8217;ve never work on both of them in the same time. Usually I&#8217;m using Foxpro integrated DBMS when using Visual Foxpro, and MySQL used to be a DBMS when [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=efransiscus.wordpress.com&blog=3967919&post=147&subd=efransiscus&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Yesterday, I got a project to handle with MySQL and Visual Foxpro. I&#8217;m used to MySQL, and so does with Visual Foxpro. The trouble is that I&#8217;ve never work on both of them in the same time. Usually I&#8217;m using Foxpro integrated DBMS when using Visual Foxpro, and MySQL used to be a DBMS when I&#8217;m using PHP, C#, or ASP.Net.<br />
I got a little problem on connecting those software, but after multiple tries, it did works.<br />
How that happen? here&#8217;s the simple tutorial:</p>
<p>Note : I&#8217;m using Microsoft Windows XP SP 3, Visual Foxpro 9, and WAMP server 1.7.3, I&#8217;m working on a single desktop pc. I&#8217;m sorry i didn&#8217;t include the images example on doing this, hope with just the texts you would understand how it works.</p>
<p>First, create a database on MySQL. The database is quite important, because when you install and configure ODBC, there&#8217;s an option of which databases you want to use.  I&#8217;m also using PHPmyadmin for the GUI of the database application.  here&#8217;s for example.</p>
<blockquote><p>&gt; CREATE DATABASE dbfarmasi<br />
&gt; CREATE TABLE  `dbfarmasi`.`tb_brg` (`kdbrg` CHAR( 6 ) NOT NULL ,`nmbrg` VARCHAR( 50 ) NOT NULL , PRIMARY KEY (  `kdbrg` )) ENGINE = INNODB<br />
&gt; INSERT INTO  `dbfarmasi`.`tb_brg` (`kdbrg` ,`nmbrg`) VALUES ( &#8216;00001&#8242;,  &#8216;First item&#8217; );<br />
&gt; INSERT INTO  `dbfarmasi`.`tb_brg` (`kdbrg` ,`nmbrg`) VALUES ( &#8216;00002&#8242;,  &#8216;Second item&#8217; );</p></blockquote>
<p>i&#8217;m named the database &#8220;dbfarmasi&#8221; and the table &#8220;tb_brg&#8221;. So here, we got a database and a table, rock!</p>
<p>Then you download a software called MySQL ODBC Connector. I&#8217;m using mysql-connector-odbc-3.51.25-win32.exe, which is free, and can be downloaded by visit mysql site. You can try to google it.</p>
<p>Install. After installation has done, you should go to &#8220;Control Panel&#8221; &gt; &#8220;Administrative Tools&#8221; &gt; &#8220;Data Sources (ODBC)&#8221;. And then there&#8217;s pop-up window of ODBC. In &#8220;User DSN&#8221; tab, right side, press &#8220;Add&#8221; button&#8221;,  and select &#8220;MySQL ODBC 3.51 Driver&#8221; as the data source, and &#8220;Finish&#8221;.</p>
<p>Another windows will appear, it is a configuration window for ODBC. Try this :</p>
<blockquote><p>Data source name : <strong>koneksi</strong><br />
Description : connect foxpro and mysql<br />
Server : <strong>localhost</strong><br />
User : <strong>root</strong><br />
Database : <strong>dbfarmasi</strong></p></blockquote>
<p>The DSN name is up to you, so does the description.<br />
The default Server is localhost, &#8217;cause I&#8217;m not using remote database.<br />
Default user name is root, as the first super user name in mysql.<br />
I&#8217;m using no password on mysql (it is set to none by default when you&#8217;re install WAMP)<br />
and the database I&#8217;m using is dbfarmasi, as i&#8217;ve created before.</p>
<p>Ta-da. The connection has been made.</p>
<p>Now, for the visual foxpro. here is a simple one :<br />
Create a project, whatever the name is, save it. on &#8220;Project Manager&#8221; window, choose &#8220;Code&#8221; tab.<br />
Press &#8220;New&#8221; on Program.<br />
Here is the code:</p>
<blockquote><p>PUBLIC P1<br />
STORE SQLCONNECT(&#8216;koneksi&#8217;, &#8216;root&#8217;) TO P1</p></blockquote>
<p>close and save it to name :  &#8221;<strong>setdatabase</strong>&#8220;</p>
<p>now, back to &#8220;Project Manager&#8221; window, choose &#8220;Document&#8221; tab, press &#8220;New&#8221; button to create a new form, and pick the &#8220;New Form&#8221;, not the &#8220;Form Wizard&#8221; thing.<br />
After that, an empty form will appear. create a two Textboxs.<br />
named the first textbox to : <strong>txtkdbrg</strong> and the second textbox to : <strong>txtnmbrg.</strong><br />
Add a grid to form. named it as <strong>gridContainer. </strong></p>
<p>Now double-click the form,  select the object <strong>form1 </strong>and the procedure <strong>init</strong>, and add this code:</p>
<blockquote><p><strong>DO setdatabase</strong><br />
thisform.gridContainer.RecordSource=&#8221;"<br />
<strong>SQLEXEC(P1,&#8221;select * from tb_brg&#8221;,&#8221;tb_brg&#8221;)</strong><br />
IF NOT USED(&#8220;tb_brg&#8221;)<span> </span><br />
<span> </span>USE tb_brg ALIAS tb_brg<br />
ENDIF <br />
SELECT tb_brg<br />
thisform.gridContainer.RecordSource=&#8221;tb_brg&#8221;</p></blockquote>
<p>Save the form and run it. TA-DA. It works, its connected. The content of table &#8220;tb_brg&#8221; is showed by the form by the gridContainer.</p>
<p>It means that the ODBC works. Here the connection thing :<br />
<em>do setdatabase</em><br />
<em>SQLEXEC(P1,&#8221;select * from tb_brg&#8221;,&#8221;tb_brg&#8221;)</em><br />
means :<br />
run program code &#8220;setdatabase&#8221; (which we&#8217;ve created before, for connection)<br />
select <strong>P1</strong> as ODBC connection DNS, (connection name variable in setdatabase (replace SQLCONNECT(bla bla bla))<br />
&#8220;select * from tb_brg&#8221;, the sql query, select all from table tb_brg<br />
&#8220;tb_brg&#8221;, is a cursor in visual foxpro, that used for alias.</p>
<p>So, with SQLEXEC([connection name],&#8221;[sql query]&#8220;,[cursor name]), you can do sql command: <strong>SELECT</strong>. Don&#8217;t forget to add cursorname/alias when you&#8217;re using <strong>SELECT</strong>.</p>
<p>You don&#8217;t have to add cursorname if you&#8217;re using INSERT or DELETE query.<br />
example :</p>
<blockquote><p>SQLEXEC(P1,&#8221;insert into tb_brg (kdbrg,nmbrg) values 	(&#8216;&#8221;+thisform.txtkdbrg.value+&#8221;&#8216;,&#8217;&#8221;+thisform.txtnmbrg.value+&#8221;&#8216;)&#8221;)</p></blockquote>
<p>means you insert value from textbox (txtkdbrg and txtnmbrg).<br />
for delete command example : </p>
<blockquote><p>SQLEXEC(P1,&#8221;delete from tb_brg where kdbrg =&#8217;&#8221;+thisform.txtkdbrg.Value+&#8221;&#8216;&#8221;)</p></blockquote>
<p>Once again, i&#8217;m sorry i&#8217;m not using images for this tutorial.<br />
Hope you understand what i meant in this simple tutorial, and hope it help you.</p>
 Tagged: connect, example, Foxpro, MySQL, odbc, tutorial <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/efransiscus.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/efransiscus.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/efransiscus.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/efransiscus.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/efransiscus.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/efransiscus.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/efransiscus.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/efransiscus.wordpress.com/147/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/efransiscus.wordpress.com/147/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/efransiscus.wordpress.com/147/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=efransiscus.wordpress.com&blog=3967919&post=147&subd=efransiscus&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://efransiscus.wordpress.com/2009/03/15/tutorial-using-mysql-odbc-connector-with-foxpro-9-and-mysql/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/bf39f19395e3651ea33bc7dab0cd09fd?s=96&#38;d=" medium="image">
			<media:title type="html">Efransiscus</media:title>
		</media:content>
	</item>
	</channel>
</rss>