<?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>Li Guoliang &#187; MySQL</title>
	<atom:link href="http://liguoliang.com/tag/mysql/feed/" rel="self" type="application/rss+xml" />
	<link>http://liguoliang.com</link>
	<description>ActionScript Flex Java JEE PHP...</description>
	<lastBuildDate>Mon, 21 May 2012 17:04:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>MySql: 使用数据库文件恢复</title>
		<link>http://liguoliang.com/2010/restore-mysql-database-form-database-file/</link>
		<comments>http://liguoliang.com/2010/restore-mysql-database-form-database-file/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 13:43:22 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[DB]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[数据恢复]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2010/restore-mysql-database-form-database-file/</guid>
		<description><![CDATA[<p>需求: 在没有.sql备份文件的情况下, 使用mySql文件恢复数据库</p>
<p>解决方法:</p>
<p>1. 安装同版本的MySql &#8211; 查看之前的MySql readme文件获知版本    <br />2. 找到Mysql的数据库文件存放位置.&#160; 有很多名称同数据库名称的文件夹,&#160; <br />&#160;&#160; 2.1复制要恢复的数据库对应的文件夹到新的mySql的数据库文件目录中. (如果找不到, 查阅my.ini中的配置信息). 文件夹内存放了Database的结构.     <br />&#160; 2.2 从旧的Mysql目录中复制 ibdata1文件到新目录中(该文件存储具体数据, 大小随着视数据库内容而变)     <br />4. 启动新安装的MySql, 之前的数据库已完整恢复.</p>
<p> </p><p class='read-more'><a href='http://liguoliang.com/2010/restore-mysql-database-form-database-file/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>需求: 在没有.sql备份文件的情况下, 使用mySql文件恢复数据库</p>
<p>解决方法:</p>
<p>1. 安装同版本的MySql &#8211; 查看之前的MySql readme文件获知版本    <br />2. 找到Mysql的数据库文件存放位置.&#160; 有很多名称同数据库名称的文件夹,&#160; <br />&#160;&#160; 2.1复制要恢复的数据库对应的文件夹到新的mySql的数据库文件目录中. (如果找不到, 查阅my.ini中的配置信息). 文件夹内存放了Database的结构.     <br />&#160; 2.2 从旧的Mysql目录中复制 ibdata1文件到新目录中(该文件存储具体数据, 大小随着视数据库内容而变)     <br />4. 启动新安装的MySql, 之前的数据库已完整恢复.</p>
<p> <span id="more-1540"></span>
<p>参考: <a href="http://shazhifeng.javaeye.com/blog/294840">MySQL数据恢复过程</a></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2010/restore-mysql-database-form-database-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reset Mysql Root Password in XAMPP 在XAMPP中重置MySql密码</title>
		<link>http://liguoliang.com/2010/reset-mysql-root-password-in-xampp-%e5%9c%a8xampp%e4%b8%ad%e9%87%8d%e7%bd%aemysql%e5%af%86%e7%a0%81/</link>
		<comments>http://liguoliang.com/2010/reset-mysql-root-password-in-xampp-%e5%9c%a8xampp%e4%b8%ad%e9%87%8d%e7%bd%aemysql%e5%af%86%e7%a0%81/#comments</comments>
		<pubDate>Wed, 01 Sep 2010 13:15:55 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[DB]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[XAMPP]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2010/09/1482/</guid>
		<description><![CDATA[默认情况下, 通过XAMPP安装的Mysql Root密码为空. 
在XAMPP中重置Mysql密码: 
1. Go to <a href="http://localhost:port/security/">http://localhost:port/security/</a>&#160; 该链接将会对目前的配置进行安全检查
2. 该页面会检查当前安全配置, 并会带有链接: <a href="http://localhost/security/xamppsecurity.php">http://</a><p class='read-more'><a href='http://liguoliang.com/2010/reset-mysql-root-password-in-xampp-%e5%9c%a8xampp%e4%b8%ad%e9%87%8d%e7%bd%aemysql%e5%af%86%e7%a0%81/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>默认情况下, 通过XAMPP安装的Mysql Root密码为空. </p>
<p>在XAMPP中重置Mysql密码: </p>
<p>1. Go to <a href="http://localhost:port/security/">http://localhost:port/security/</a>&#160; 该链接将会对目前的配置进行安全检查</p>
<p>2. 该页面会检查当前安全配置, 并会带有链接: <a href="http://localhost/security/xamppsecurity.php"><b>http://localhost/security/xamppsecurity.php</b></a></p>
<p>3. 该页面中可进行重置密码等操作.</p>
<p>See more : <a title="http://veerasundar.com/blog/2009/01/how-to-change-the-root-password-for-mysql-in-xampp/" href="http://veerasundar.com/blog/2009/01/how-to-change-the-root-password-for-mysql-in-xampp/">http://veerasundar.com/blog/2009/01/how-to-change-the-root-password-for-mysql-in-xampp/</a></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2010/reset-mysql-root-password-in-xampp-%e5%9c%a8xampp%e4%b8%ad%e9%87%8d%e7%bd%aemysql%e5%af%86%e7%a0%81/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mysqldump备份数据库语句</title>
		<link>http://liguoliang.com/2010/mysqldump%e5%a4%87%e4%bb%bd%e6%95%b0%e6%8d%ae%e5%ba%93%e8%af%ad%e5%8f%a5/</link>
		<comments>http://liguoliang.com/2010/mysqldump%e5%a4%87%e4%bb%bd%e6%95%b0%e6%8d%ae%e5%ba%93%e8%af%ad%e5%8f%a5/#comments</comments>
		<pubDate>Sat, 31 Jul 2010 08:21:13 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[DB]]></category>
		<category><![CDATA[CMD]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[MySQLDump]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2010/07/1363/</guid>
		<description><![CDATA[<p>使用以下语句备份Mysql数据库:</p>
<p>mysqldump &#8211;host=192.168.1.*** &#8211;user=root &#8211;password=password &#8211;compact &#8211;result-file    <br />&#34;temp/meta.%time:~0,2%%time:~3,2%.%random%.%random%.sql&#34; dbName    <br />pause</p>
<p>在Windows下课存为bat文件, 执行后将会备份指定服务器上指定的DB到本地文件, 文件名形如: temp/meta.1615.29832.10152.sql.</p>
<p> </p><p class='read-more'><a href='http://liguoliang.com/2010/mysqldump%e5%a4%87%e4%bb%bd%e6%95%b0%e6%8d%ae%e5%ba%93%e8%af%ad%e5%8f%a5/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>使用以下语句备份Mysql数据库:</p>
<p>mysqldump &#8211;host=192.168.1.*** &#8211;user=root &#8211;password=password &#8211;compact &#8211;result-file    <br />&quot;temp/meta.%time:~0,2%%time:~3,2%.%random%.%random%.sql&quot; dbName    <br />pause</p>
<p>在Windows下课存为bat文件, 执行后将会备份指定服务器上指定的DB到本地文件, 文件名形如: temp/meta.1615.29832.10152.sql.</p>
<p> <span id="more-1363"></span>
<p>因为CMD %date%格式依照所在机器的日期格式打印, 搞了半天没找到一个比较通用的解决方案, 索性暂时放弃.   <br />因此只是用了时间+两个%Random%. </p>
<p>CMD的一些参数可见: <a href="http://liguoliang.com/2009/03/822/">http://liguoliang.com/2009/03/822/</a> (Over)</p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2010/mysqldump%e5%a4%87%e4%bb%bd%e6%95%b0%e6%8d%ae%e5%ba%93%e8%af%ad%e5%8f%a5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>MySql:#1467 &#8211; Failed to read auto-increment value from storage engine</title>
		<link>http://liguoliang.com/2010/mysql1467-failed-to-read-auto-increment-value-from-storage-engine/</link>
		<comments>http://liguoliang.com/2010/mysql1467-failed-to-read-auto-increment-value-from-storage-engine/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 15:31:02 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[DB]]></category>
		<category><![CDATA[#1467]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2010/03/1182/</guid>
		<description><![CDATA[某日, mySql(5.1.30-community)如此报错, 用phpMyAdmin强行插入, 亦是如此:
<a href="http://liguoliang.com/wp-content/uploads/2010/03/image7.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="406" alt="image" src="http://liguoliang.com/wp-content/uploads/2010/03/image_thumb5.png" width="618" border="0" /></a> 
但如直接指定Auto-Increment的 Field, 就可顺利插入.
解决: 
修改该自增Filed的属性, 先将其自增属性点掉:
<a href="http://liguoliang.com/wp-content/uploads/2010/03/image8.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="343" alt="image" src="http://liguoliang.com/wp-content/uploads/2010/03/image_thumb6.png" width="442" border="0" /></a> 
保存后, 再点选其自增, 再保存, 问题暂时<p class='read-more'><a href='http://liguoliang.com/2010/mysql1467-failed-to-read-auto-increment-value-from-storage-engine/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>某日, mySql(5.1.30-community)如此报错, 用phpMyAdmin强行插入, 亦是如此:</p>
<p><a href="http://liguoliang.com/wp-content/uploads/2010/03/image7.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="406" alt="image" src="http://liguoliang.com/wp-content/uploads/2010/03/image_thumb5.png" width="618" border="0" /></a> </p>
<p>但如直接指定Auto-Increment的 Field, 就可顺利插入.</p>
<h3>解决: </h3>
<p>修改该自增Filed的属性, 先将其自增属性点掉:</p>
<p><a href="http://liguoliang.com/wp-content/uploads/2010/03/image8.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="343" alt="image" src="http://liguoliang.com/wp-content/uploads/2010/03/image_thumb6.png" width="442" border="0" /></a> </p>
<p>保存后, 再点选其自增, 再保存, 问题暂时解决.</p>
<p>英文水平有限, 暂不深究&#8230;.</p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2010/mysql1467-failed-to-read-auto-increment-value-from-storage-engine/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>使用MysqlWorkbench 生成mysql反向工程</title>
		<link>http://liguoliang.com/2009/%e4%bd%bf%e7%94%a8mysqlworkbench-%e7%94%9f%e6%88%90mysql%e5%8f%8d%e5%90%91%e5%b7%a5%e7%a8%8b/</link>
		<comments>http://liguoliang.com/2009/%e4%bd%bf%e7%94%a8mysqlworkbench-%e7%94%9f%e6%88%90mysql%e5%8f%8d%e5%90%91%e5%b7%a5%e7%a8%8b/#comments</comments>
		<pubDate>Wed, 01 Apr 2009 06:44:04 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[其他技术]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[MySQLWorkBench]]></category>
		<category><![CDATA[MySQL反向工程]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2009/04/897/</guid>
		<description><![CDATA[首先将MySQL数据库导出, 可使用PhpMyAdmin等工具, 
<strong>打开WorkBench, File &#62; import &#62; Reverse Enginner MySQL Create Script…</strong>
选择导出的mysql文件, 确定即可.
<a href="http://liguoliang.com/wp-content/uploads/2009/04/image.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="576" alt="image" src="http://liguoliang.com/wp-content/uploads/2009/04/image-thumb.png" width="666" border="0" /></a>


----------Post fro<p class='read-more'><a href='http://liguoliang.com/2009/%e4%bd%bf%e7%94%a8mysqlworkbench-%e7%94%9f%e6%88%90mysql%e5%8f%8d%e5%90%91%e5%b7%a5%e7%a8%8b/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>首先将MySQL数据库导出, 可使用PhpMyAdmin等工具, </p>
<p><strong>打开WorkBench, File &gt; import &gt; Reverse Enginner MySQL Create Script…</strong></p>
<p>选择导出的mysql文件, 确定即可.</p>
<p><a href="http://liguoliang.com/wp-content/uploads/2009/04/image.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="576" alt="image" src="http://liguoliang.com/wp-content/uploads/2009/04/image-thumb.png" width="666" border="0" /></a></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2009/%e4%bd%bf%e7%94%a8mysqlworkbench-%e7%94%9f%e6%88%90mysql%e5%8f%8d%e5%90%91%e5%b7%a5%e7%a8%8b/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Reserved Words Checker &#8211; SQL保留字查询</title>
		<link>http://liguoliang.com/2009/sql-reserved-words-checker-sql%e4%bf%9d%e7%95%99%e5%ad%97%e6%9f%a5%e8%af%a2/</link>
		<comments>http://liguoliang.com/2009/sql-reserved-words-checker-sql%e4%bf%9d%e7%95%99%e5%ad%97%e6%9f%a5%e8%af%a2/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 03:21:23 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[其他技术]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2009/03/884/</guid>
		<description><![CDATA[支持数据库: 
SQL Server, MySQL, PostgreSQL, Oracle, DB2, ANSI SQL, ODBC 
地址:<a title="http://www.petefreitag.com/tools/sql_reserved_words_checker/" href="http://www.petefreitag.com/tools/sql_reserved_words_checker/">http://www.petefreitag.com/tools/sql_reserved_words_checker/</a>
演示:&#160; 
<a href="http://liguoliang.com/wp-content/uploads/2009/03/image5.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="419" alt="image" src="http://liguoliang.com/wp-content/uploads/2009/03/image-thumb5.png" width="514" border="0" /></a>


--<p class='read-more'><a href='http://liguoliang.com/2009/sql-reserved-words-checker-sql%e4%bf%9d%e7%95%99%e5%ad%97%e6%9f%a5%e8%af%a2/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>支持数据库: </p>
<p>SQL Server, MySQL, PostgreSQL, Oracle, DB2, ANSI SQL, ODBC </p>
<p>地址:<a title="http://www.petefreitag.com/tools/sql_reserved_words_checker/" href="http://www.petefreitag.com/tools/sql_reserved_words_checker/">http://www.petefreitag.com/tools/sql_reserved_words_checker/</a></p>
<p>演示:&#160; </p>
<p><a href="http://liguoliang.com/wp-content/uploads/2009/03/image5.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="419" alt="image" src="http://liguoliang.com/wp-content/uploads/2009/03/image-thumb5.png" width="514" border="0" /></a></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2009/sql-reserved-words-checker-sql%e4%bf%9d%e7%95%99%e5%ad%97%e6%9f%a5%e8%af%a2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex BlazeDS Java JDBC MySql 快速配置</title>
		<link>http://liguoliang.com/2009/flex-blazeds-java-jdbc-mysql-%e9%80%9f%e9%85%8d%e5%bf%ab%e9%80%9f%e9%85%8d%e7%bd%ae/</link>
		<comments>http://liguoliang.com/2009/flex-blazeds-java-jdbc-mysql-%e9%80%9f%e9%85%8d%e5%bf%ab%e9%80%9f%e9%85%8d%e7%bd%ae/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 08:48:27 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[BlazeDS]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2009/02/793/</guid>
		<description><![CDATA[从下往上:<a href="http://liguoliang.com/wp-content/uploads/2009/02/image9.png"><img style="display: inline; margin-left: 0px; margin-right: 0px; border-width: 0px;" title="image" src="http://liguoliang.com/wp-content/uploads/2009/02/image-thumb9.png" border="0" alt="image" width="330" height="540" align="right" /></a>
<strong>1. Java – JDBC – MySql</strong>
1. 装好MySql, 启动服务.
2. 将mysql-connector-java-5.1.7-bin.jar 拖入WEB-INF/lib下.
搞定.
<a href="http://liguoliang.com/wp-content/uploads/2009/02/image10.png"></a>
<strong>2. Java端BlazeDS配置</strong>
1. Java端:
将BlazeDS压缩包内的WE<p class='read-more'><a href='http://liguoliang.com/2009/flex-blazeds-java-jdbc-mysql-%e9%80%9f%e9%85%8d%e5%bf%ab%e9%80%9f%e9%85%8d%e7%bd%ae/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>从下往上:<a href="http://liguoliang.com/wp-content/uploads/2009/02/image9.png"><img style="display: inline; margin-left: 0px; margin-right: 0px; border-width: 0px;" title="image" src="http://liguoliang.com/wp-content/uploads/2009/02/image-thumb9.png" border="0" alt="image" width="330" height="540" align="right" /></a></p>
<p><strong>1. Java – JDBC – MySql</strong></p>
<p>1. 装好MySql, 启动服务.</p>
<p>2. 将mysql-connector-java-5.1.7-bin.jar 拖入WEB-INF/lib下.</p>
<p>搞定.</p>
<p><a href="http://liguoliang.com/wp-content/uploads/2009/02/image10.png"></a></p>
<p><strong>2. Java端BlazeDS配置</strong></p>
<p>1. Java端:</p>
<p>将BlazeDS压缩包内的WEB-INF里面的东西拷贝工程内的WEB-INF下的相应位置中.[ Flex目录下有四个xml配置文件, lib下是需要使用的jar] 包括web.xm</p>
<p>2. 配置services-config.xml中channels标签中的内容:</p>
<pre class="xml">

                false

true
4
</pre>
<p>其中, http://localhost:8080/DepartmentManagement/ 是该Web工程的地址 [可在web-content下建立一空index.html, 运行后查看地址便可]</p>
<p>3. 编写Java类, 并配置remoting-config.xml文件的&lt;service&gt;标签下, 增加服务, 如下:</p>
<pre class="xml">

         com.insprise.guoliang.DepartmentManagement
</pre>
<p><strong>3. Flex端建立工程</strong></p>
<p>1. 建立 Flex与Java通信载体RemoteObject</p>
<p>为方便在整个工程中使用, 可建立一个Singleton &#8211; 关于AS中的Singleton可见: <a title="http://liguoliang.com/2008/10/128/" href="http://liguoliang.com/2008/10/128/">http://liguoliang.com/2008/10/128/</a></p>
<p>在该类中建立RemoteObject.</p>
<p>首先需要确定RemoteObject的destination, 在本例中 为&#8221;DepartmentManagement&#8221;; &#8211; 在<strong>remoting-config.xml中已配置.</strong></p>
<p>其次需要确定ro的channel &#8211; 本例中为:&#8221;http://localhost:8080/DepartmentManagement/messagebroker/amf＂； － 在<strong>services-config.xml中已配置</strong></p>
<p>代码:</p>
<pre class="java">	public static const DEFAULT_DEST:String = "DepartmentManagement";
	public static const DEFAULT_CHANNEL_URL:String = "http://localhost:8080/DepartmentManagement/messagebroker/amf";
	private static var _ro:RemoteObject;

	/**
	 * Constractor - Singleton
	 */
	 public function AppContext():void {
	 	throw new Error("AppContext is Singleton!");
	 }

	/**
	 * Get RemoteObject
	 */
	public static function getRemoteObject():RemoteObject {
		if(_ro == null) {
			_ro = createRemoteObject(DEFAULT_DEST, DEFAULT_CHANNEL_URL);
		}
		return _ro;
	}

	/**
	 * Constructs a new remote object with new channel.
	 * @param roDestination Destination of the RemoteObject; should match a destination name in the services-config.xml file.
	 * @param channelURI the URI used to create the whole endpoint URI for this channel; this uri can be relative uri (to the folder containing the SWF).
	 * @param channelId the id of the channel, if set to null, a random Id will be assigned.
	 */
	protected static function createRemoteObject(roDestination:String, channelURI:String, channelId:String = null):RemoteObject {
		var channelSet:ChannelSet = new ChannelSet();
		var channel:AMFChannel = new AMFChannel(channelId == null ? "channel-" : channelId, channelURI);	//Create new Channel
		channelSet.addChannel(channel);	

		var ro:RemoteObject = new RemoteObject(roDestination);
		ro.channelSet = channelSet;

		return ro;
	}</pre>
<p><strong>4 配置完成,.</strong></p>
<p>在Java端建立相关的Class,</p>
<p>启动服务器.</p>
<p>在Flex端通过 Appcontext.getRemoteObject.getOperation(“方法名称”)来调用服务器端方法.</p>
<p>具体实例:</p>
<p><strong>Java端的Class &#8211; 通过JDBC 读取 MySql中数据:</strong></p>
<pre class="java">	/**
	 * Load all Department and return an ArrayList
	 * @return
	 */
	public ArrayList loadDepartments() {
		ArrayList departmentsAL = new ArrayList();
		log.info("Loading Departments...");
		try {
			//Get Connection
			Connection conn = JdbcUtilities.getConnection();
			//Create statement
			String sql = " SELECT * FROM Department d ORDER BY d.Department_ID";
			PreparedStatement ps = conn.prepareStatement(sql);

			ResultSet res = ps.executeQuery();
			log.debug("Exectuing: " + sql);
			while (res.next()) {
				int id = res.getInt("Department_ID");
				String name = res.getString("name");

				Department dp = new Department();
				dp.setId(id);
				dp.setName(name);
				departmentsAL.add(dp);
				log.debug("从数据库获得部门:  " + dp);
			}
			JdbcUtilities.closeConn(res, ps, conn);
			log.info("加载部门信息结束, 共加载部门: " + departmentsAL.size());
		} catch (Exception e) {
			log.error("SQL Error", e);
			throw new Error(e);
		}
		return departmentsAL;

	}</pre>
<p>Flex端的代码:</p>
<pre class="java">		/**
	 * Load the Department's Employee
	 */

	private var op:AbstractOperation;
	public function loadEmployees():void {
		op = AppContext.getRemoteObject().getOperation("loadEmployees");	//获得Operation
		 op.arguments = [id];	//设定参数
		 var at:AsyncToken = op.send();	//Send
		 at.addResponder(this);	//为本实例增加responder

      }</pre>
<p>Flex端responder剩余代码见:http://liguoliang.com/2009/02/777/</p>
<p>运行Flex工程, Flex取得RemoteObject, 然后通过channel建立到destination的连接,由Java读取数据库中信息, 并返回给Flex.</p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2009/flex-blazeds-java-jdbc-mysql-%e9%80%9f%e9%85%8d%e5%bf%ab%e9%80%9f%e9%85%8d%e7%bd%ae/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>JDBC中Preparedstatement使用小结 及JDBC插入数据后获得Last insert ID</title>
		<link>http://liguoliang.com/2009/jdbc%e4%b8%adpreparedstatement%e4%bd%bf%e7%94%a8%e5%b0%8f%e7%bb%93-%e5%8f%8ajdbc%e6%8f%92%e5%85%a5%e6%95%b0%e6%8d%ae%e5%90%8e%e8%8e%b7%e5%be%97last-insert-id/</link>
		<comments>http://liguoliang.com/2009/jdbc%e4%b8%adpreparedstatement%e4%bd%bf%e7%94%a8%e5%b0%8f%e7%bb%93-%e5%8f%8ajdbc%e6%8f%92%e5%85%a5%e6%95%b0%e6%8d%ae%e5%90%8e%e8%8e%b7%e5%be%97last-insert-id/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 02:20:46 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[JDBC]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PreparedStatement]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2009/02/773/</guid>
		<description><![CDATA[编写SQL语句, 尤其是要插入多个Filed时, 是一件非常BT的事情, 至少让我很不爽, 使用preparedstatement可以使代码变得更优雅一些, 虽然会有些长, 但会更条理, 而且preparedstatement更高于SQL语句 &#8211; 相对来说不太容易随着数据库版本改变而变动<p class='read-more'><a href='http://liguoliang.com/2009/jdbc%e4%b8%adpreparedstatement%e4%bd%bf%e7%94%a8%e5%b0%8f%e7%bb%93-%e5%8f%8ajdbc%e6%8f%92%e5%85%a5%e6%95%b0%e6%8d%ae%e5%90%8e%e8%8e%b7%e5%be%97last-insert-id/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>编写SQL语句, 尤其是要插入多个Filed时, 是一件非常BT的事情, 至少让我很不爽, 使用preparedstatement可以使代码变得更优雅一些, 虽然会有些长, 但会更条理, 而且preparedstatement更高于SQL语句 &#8211; 相对来说不太容易随着数据库版本改变而变动. 另外preparedstatement效率更高, 安全性更好</p>
<p>下面是恐怖的SQL:</p>
<pre class="java" name="code">			Statement statement = (Statement) conn.createStatement();
			String sql = "INSERT INTO `DEP`.`employee` " +
					"( `name` , `age` , `address` , `isMale` , `level` , `Department_ID` ) " +
					"VALUES (" +
					"'" + emp.getName() + "', " +
					emp.getAge()  + ", " +
					 JdbcUtilities.getSqlForString(emp.getAddress()) + ", " +
					emp.getIsMale() + ", "  +
					emp.getLevel() + ", " +
					emp.getDepartment_ID() + ");"
					;

			log.debug("Executing sql :" + sql);
			statement.executeUpdate(sql);

			ResultSet rs = statement.executeQuery("SELECT last_insert_id();");// .execute("SELECT last_insert_id();");
			if(rs.next()) {
				System.out.println(rs.getInt("1"));
			}</pre>
<p>这里是使用PreparedStatement后的语句:</p>
<pre class="java" name="code">			String psql = "INSERT INTO Employee (name, age, address, isMale, level, Department_ID) VALUES (?, ?, ?, ?, ?, ?)";
			PreparedStatement ps  = conn.prepareStatement(psql,Statement.RETURN_GENERATED_KEYS);

			ps.setString(1, emp.getName());
			ps.setInt(2, emp.getAge());
			ps.setString(3, emp.getAddress());
			ps.setInt(4, emp.getIsMale());
			ps.setInt(5, emp.getLevel());
			ps.setInt(6, emp.getDepartment_ID());

			ps.executeUpdate();

			ResultSet keys = ps.getGeneratedKeys(); // equivalent to "SELECT last_insert_id();"

			if(keys.next()) {
				System.out.println(keys.getInt(1));
			}</pre>
<p>PreparedStatement的使用步骤:</p>
<ol>
<li>
<p class="list">声明 PreparedStatement。</p>
<pre>PreparedStatement prepStmt;</pre>
</li>
<li>
<p class="list">将一条 SQL 语句指派给 PreparedStatement 对象。</p>
<pre>prepStmt = conn.prepareStatement(
   "INSERT INTO MyTable(MyColumn) values (?)");</pre>
</li>
<li>
<p class="list">为该语句指派输入参数值。</p>
<p class="list">以下代码显示一个字符串参数。</p>
<pre>String newValue;
// assign value
prepStmt.setStringParameter(1, newValue);</pre>
</li>
<li>
<p class="list">执行该语句。</p>
<p class="list">返回值表示受该语句影响的行数。</p>
<pre>long rowsInserted = prepStmt.executeStatement();</pre>
</li>
<li>
<p class="list">如果禁用了 [自动提交]，请提交更改。</p>
<pre>conn.commit();</pre>
</li>
</ol>
<p><a href="http://www.ianywhere.com/developer/product_manuals/sqlanywhere/0902/zh/html/uljvzh9/00000034.htm" target="_blank">参考地址</a></p>
<p>获得组后插入的ID, 在上面代码中已经包括.</p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2009/jdbc%e4%b8%adpreparedstatement%e4%bd%bf%e7%94%a8%e5%b0%8f%e7%bb%93-%e5%8f%8ajdbc%e6%8f%92%e5%85%a5%e6%95%b0%e6%8d%ae%e5%90%8e%e8%8e%b7%e5%be%97last-insert-id/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL中使用外键[FOREIGN KEY]</title>
		<link>http://liguoliang.com/2008/mysql%e4%b8%ad%e4%bd%bf%e7%94%a8%e5%a4%96%e9%94%ae-use-foreign-key-in-mysql/</link>
		<comments>http://liguoliang.com/2008/mysql%e4%b8%ad%e4%bd%bf%e7%94%a8%e5%a4%96%e9%94%ae-use-foreign-key-in-mysql/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 15:25:15 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[其他技术]]></category>
		<category><![CDATA[ERwin]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2008/11/349/</guid>
		<description><![CDATA[在MySQL中使用外键的小总结...<p class='read-more'><a href='http://liguoliang.com/2008/mysql%e4%b8%ad%e4%bd%bf%e7%94%a8%e5%a4%96%e9%94%ae-use-foreign-key-in-mysql/'></a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>SQL语言:</p>
<p>CREATE TABLE Class (<br />
Class_ID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,<br />
Name VARCHAR(255)<br />
) type=innodb;</p>
<p>CREATE TABLE Student(<br />
Student_ID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,<br />
Name VARCHAR(255),<br />
c_ID INT UNSIGNED NOT NULL,<br />
FOREIGN KEY(c_ID) REFERENCES Class(Class_ID)<br />
ON DELETE CASCADE<br />
ON UPDATE CASCADE<br />
);</p>
<p>逻辑图:<br />
<a href="http://liguoliang.com/wp-content/uploads/2008/11/image7.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://liguoliang.com/wp-content/uploads/2008/11/image-thumb7.png" border="0" alt="image" width="244" height="205" /></a></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2008/mysql%e4%b8%ad%e4%bd%bf%e7%94%a8%e5%a4%96%e9%94%ae-use-foreign-key-in-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使用ERwin反向工程生成MySQL数据库的Physical Modal[物理数据模型]</title>
		<link>http://liguoliang.com/2008/%e4%bd%bf%e7%94%a8erwin%e5%8f%8d%e5%90%91%e5%b7%a5%e7%a8%8b%e7%94%9f%e6%88%90mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e7%9a%84physical-modal%e7%89%a9%e7%90%86%e6%95%b0%e6%8d%ae%e6%a8%a1%e5%9e%8b/</link>
		<comments>http://liguoliang.com/2008/%e4%bd%bf%e7%94%a8erwin%e5%8f%8d%e5%90%91%e5%b7%a5%e7%a8%8b%e7%94%9f%e6%88%90mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e7%9a%84physical-modal%e7%89%a9%e7%90%86%e6%95%b0%e6%8d%ae%e6%a8%a1%e5%9e%8b/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 14:15:31 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[其他技术]]></category>
		<category><![CDATA[ERwin]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2008/11/346/</guid>
		<description><![CDATA[ ERWin Data Modeler是CA公司的数据库建模工具，目前在关系数据库的设计中，有着比较广泛的应用.
数据库设计错误将会导致在很长一段时间内不断听到各种抱怨,因此,选择 一个适合的数据库开发工具对数据环境进行规范将非常重要 . <p class='read-more'><a href='http://liguoliang.com/2008/%e4%bd%bf%e7%94%a8erwin%e5%8f%8d%e5%90%91%e5%b7%a5%e7%a8%8b%e7%94%9f%e6%88%90mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e7%9a%84physical-modal%e7%89%a9%e7%90%86%e6%95%b0%e6%8d%ae%e6%a8%a1%e5%9e%8b/'></a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<h4>1.ERwin简介:</h4>
<p>ERWin Data Modeler是CA公司的数据库建模工具，目前在关系数据库的设计中，有着比较广泛的应用.</p>
<p>数据库设计错误将会导致在很长一段时间内不断听到各种抱怨,因此,选择 一个适合的数据库开发工具对数据环境进行规范将非常重要 .<br />
Erwin在物理数据库的生成和反向生成、双向同步和比较功能方面居领先地位 ,可以进行逆向工程、能够自动生成文档、支持与数据库同步、支持 团队式 开发,所支持的数据库多达20多种。</p>
<p>Erwin数据库设计工具可以用于设 计生成客户机/ 服务器、Web、Intranet和数据仓库等应用程序数据库。</p>
<h4>2. 使用ERwin反向工程生成MySQL数据库的物理数据模型</h4>
<p>1.ERwin并不支持与MySQL的直接连接,一般情况下,我们使用ODBC进行连接, 因此在此之前需要保证机器上已安装有MySQL ODBC Driver. [MySQL网站上有安装包提供]<br />
2.打开ERwin. Tools&gt;Reverse Engineer. 弹出如下对话框:<br />
<a href="http://liguoliang.com/wp-content/uploads/2008/11/image3.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://liguoliang.com/wp-content/uploads/2008/11/image-thumb3.png" border="0" alt="image" width="226" height="244" /></a></p>
<p>选择好对应的数据库版本.</p>
<p>Next, 几乎不太需要更改,[太懒的, 一点也不想多看一个英语单词...]  继续Next..</p>
<p><a href="http://liguoliang.com/wp-content/uploads/2008/11/image4.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://liguoliang.com/wp-content/uploads/2008/11/image-thumb4.png" border="0" alt="image" width="225" height="244" /></a></p>
<p>选定那个复选框&#8230;. 点击连接&#8230;. [ 下面列放的是曾经连接成功的记录,也可以直接使用列表中的, 不过第一次用的话应该时没有的]<br />
弹出对话框,提示选择数据源:<br />
<a href="http://liguoliang.com/wp-content/uploads/2008/11/image5.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://liguoliang.com/wp-content/uploads/2008/11/image-thumb5.png" border="0" alt="image" width="244" height="211" /></a><br />
选定machine Data Source ,建立一个ODBC连接,一路确定之后, 稍等片刻,便可生成.</p>
<h4>3. 效果</h4>
<p><a href="http://liguoliang.com/wp-content/uploads/2008/11/image6.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://liguoliang.com/wp-content/uploads/2008/11/image-thumb6.png" border="0" alt="image" width="244" height="137" /></a></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2008/%e4%bd%bf%e7%94%a8erwin%e5%8f%8d%e5%90%91%e5%b7%a5%e7%a8%8b%e7%94%9f%e6%88%90mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e7%9a%84physical-modal%e7%89%a9%e7%90%86%e6%95%b0%e6%8d%ae%e6%a8%a1%e5%9e%8b/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

