﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-jsenter</title><link>http://www.blogjava.net/jsenter/</link><description /><language>zh-cn</language><lastBuildDate>Sun, 12 Apr 2026 14:50:09 GMT</lastBuildDate><pubDate>Sun, 12 Apr 2026 14:50:09 GMT</pubDate><ttl>60</ttl><item><title>JAVA的IO学习全面讲解。</title><link>http://www.blogjava.net/jsenter/archive/2005/04/24/3671.html</link><dc:creator>李贝</dc:creator><author>李贝</author><pubDate>Sat, 23 Apr 2005 19:56:00 GMT</pubDate><guid>http://www.blogjava.net/jsenter/archive/2005/04/24/3671.html</guid><wfw:comment>http://www.blogjava.net/jsenter/comments/3671.html</wfw:comment><comments>http://www.blogjava.net/jsenter/archive/2005/04/24/3671.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jsenter/comments/commentRss/3671.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jsenter/services/trackbacks/3671.html</trackback:ping><description><![CDATA[<P><FONT size=4>IO两大主流,16位和8位<BR>16位对应Writer 和 Reader<BR>根据编程目的不同有<BR>FileWriter和FileWriter&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 对文件进行读写。<BR>StringWriter、StringReader&nbsp;&nbsp;&nbsp; 对内存里的位置进行读写。<BR>PipedWrier、PipedReader&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 两个线程间通讯用</FONT></P>
<P><FONT size=4>&nbsp;8位对应InputStream 和 OutputStream<BR>根据编程目的不同有<BR>FileInputStream、FileOutputStream&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 对文件进行读写<BR>ByteArrayInputStream、ByteArrayOutputStream&nbsp; 对字节数组进行读写<BR>PipedInputStream、PipedOutputStream&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 线程间通讯用<BR>注意：在数据流里不存在字符串的IO操作，那样就要用Reader和Writer类</FONT></P>
<P><FONT size=4>二者的桥梁在InputStreamReader、OutputStreamWriter</FONT></P>
<P><FONT size=4>BufferedWriter、BufferedReader、BufferedInputStream、BufferedOutputStream</FONT></P>
<P><FONT size=4>是用来提高IO速度的，注意包装的时候最好最先包装Buffered，这样效果会好些。</FONT></P>
<P><FONT size=4>包装模式的理解。Package Pattern</FONT></P>
<P><FONT size=4>各种Data Type的长度的记忆.<BR>还要注意对象流的使用.</FONT></P>
<P><FONT size=4>高级IO操作：<BR>信道IO，java.nio.channels包<BR>他的主要特征是可以对内存进行快读写操作,进行内存映射.<BR>同时可以创建各种数据类型的缓冲区,从而提高IO操作效率.</FONT></P><img src ="http://www.blogjava.net/jsenter/aggbug/3671.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jsenter/" target="_blank">李贝</a> 2005-04-24 03:56 <a href="http://www.blogjava.net/jsenter/archive/2005/04/24/3671.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JAVA授权事件模型讲解（原创）</title><link>http://www.blogjava.net/jsenter/archive/2005/03/31/2669.html</link><dc:creator>李贝</dc:creator><author>李贝</author><pubDate>Thu, 31 Mar 2005 14:44:00 GMT</pubDate><guid>http://www.blogjava.net/jsenter/archive/2005/03/31/2669.html</guid><wfw:comment>http://www.blogjava.net/jsenter/comments/2669.html</wfw:comment><comments>http://www.blogjava.net/jsenter/archive/2005/03/31/2669.html#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://www.blogjava.net/jsenter/comments/commentRss/2669.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jsenter/services/trackbacks/2669.html</trackback:ping><description><![CDATA[<FONT size=4>JAVA的授权事件模型包含三个概念：事件源，事件，事件监听器。<BR><BR>一，事件源：一个产生事件的对象。当这个对象的内部状态改变时，事件就会产生。一个事件源必须注册一个事件监听器已使监听器能够可以接受一个特定时间的通知。每一种事件都有它特定的注册方法，通用形式为：addTypeListener(TypeListener e)<BR><BR>二，事件：一个事件是描述了一个事件源的状态改变的对象。他可能通过一个人与图形用户接口的交互产生。如输入文字，点击鼠标。也可能不是由这些产生，如：一个事件可能在定时器中到期而产生。当然用户也可以自由的定义自己的事件。<BR><BR>注意：其中的Type可以是Key, Mouse,等。一个事件源可能允许注册多个事件监听器，也可能只允许注册一个监听器。<BR><BR>事件源也允许注销一个事件监听器，通用方法为：removeTypeListener(TypeListener e);<BR><BR>三，事件监听器：一个当事件发生时的时候被通知的对象。它有两个要求：<BR>1，它必须在事件源中注册。<BR>2，它必须实现接受和处理事件通知的方法。<BR><BR>还是来个比喻吧：你要想成为一个可以接受事件并处理事件的对象(即事件监听器)，必须继承TypeListener类，其中的Type为事件类型。然后去注册你想监听的对象，并自己实现处理事件发生的方法，然后你就坐在等待事件的发生啦，哈哈！</FONT><BR><BR>附源程序研究用：<BR>/*===============DemoEvent.java清单=============*/<BR>import java.awt.*;<BR>import java.awt.event.*;<BR>import java.applet.*;<BR><BR><BR>public class DemoEvent extends Applet implements MouseListener, MouseMotionListener{<BR>&nbsp;&nbsp; &nbsp;public String msg = "";<BR>&nbsp;&nbsp; &nbsp;public int mouseX = 0, mouseY = 0;<BR>&nbsp;&nbsp; &nbsp;<BR>&nbsp;&nbsp; &nbsp;/*<BR>&nbsp;&nbsp; &nbsp;*注册事件监听器<BR>&nbsp;&nbsp; &nbsp;*/<BR>&nbsp;&nbsp; &nbsp;public void init() {<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;addMouseListener(this);<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;addMouseMotionListener(this);<BR>&nbsp;&nbsp; &nbsp;}<BR><BR>&nbsp;&nbsp; &nbsp;/*<BR>&nbsp;&nbsp; &nbsp;*下面为所有处理MouseEvent的方法，当然你可以自定义自己的方法，但不能少了这些。<BR>&nbsp;&nbsp; &nbsp;*/<BR>&nbsp;&nbsp; &nbsp;public void mouseMoved(MouseEvent me) {<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;showStatus("mouse moved at :"+me.getX() +"," + me.getY());&nbsp;&nbsp; &nbsp;<BR>&nbsp;&nbsp; &nbsp;}<BR>&nbsp;&nbsp; &nbsp;public void mouseReleased(MouseEvent me) {<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;mouseX = me.getX();<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;mouseY = me.getY();<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;msg = "UP";<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;repaint();&nbsp;&nbsp; &nbsp;<BR>&nbsp;&nbsp; &nbsp;}<BR>&nbsp;&nbsp; &nbsp;public void mouseClicked(MouseEvent me) {<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;mouseX = 0;<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;mouseY = 10;<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;msg = "Mouse clicked!";<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;repaint();<BR>&nbsp;&nbsp; &nbsp;}<BR>&nbsp;&nbsp; &nbsp;public void mouseEntered(MouseEvent me) {<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;mouseX = 0;<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;mouseY = 10;&nbsp;&nbsp; &nbsp;;<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;msg = "Mouse Entered!";<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;repaint();<BR>&nbsp;&nbsp; &nbsp;}<BR>&nbsp;&nbsp; &nbsp;public void mouseExited(MouseEvent me) {<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;mouseX = 0;<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;mouseY = 0;<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;msg = "Mouse Exited!";<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;repaint();<BR>&nbsp;&nbsp; &nbsp;}<BR>&nbsp;&nbsp; &nbsp;public void mouseDragged(MouseEvent me) {<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;mouseX = me.getX();<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;mouseY = me.getY();<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;msg = "*";<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;repaint();&nbsp;&nbsp; &nbsp;<BR>&nbsp;&nbsp; &nbsp;}<BR>&nbsp;&nbsp; &nbsp;public void mousePressed(MouseEvent me) {<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;mouseX = me.getX();<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;mouseY = me.getY();<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;msg = "Down";<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;repaint();<BR>&nbsp;&nbsp; &nbsp;}<BR>&nbsp;&nbsp; &nbsp;/*===================方法说明结束==================*/&nbsp;&nbsp; &nbsp;<BR>&nbsp;&nbsp; &nbsp;public void paint(Graphics g) {<BR>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;g.drawString(msg, mouseX, mouseY);<BR>&nbsp;&nbsp; &nbsp;}<BR>}<BR>/*<BR>*相关说明：这里的DemoEvent既是事件源也是事件监听器。<BR>*<BR>*/<BR>/*===================DemoEvent.java清单===================*/<img src ="http://www.blogjava.net/jsenter/aggbug/2669.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jsenter/" target="_blank">李贝</a> 2005-03-31 22:44 <a href="http://www.blogjava.net/jsenter/archive/2005/03/31/2669.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JAVA - IO包的学习引导文章（摘抄）</title><link>http://www.blogjava.net/jsenter/archive/2005/03/27/2497.html</link><dc:creator>李贝</dc:creator><author>李贝</author><pubDate>Sun, 27 Mar 2005 02:30:00 GMT</pubDate><guid>http://www.blogjava.net/jsenter/archive/2005/03/27/2497.html</guid><wfw:comment>http://www.blogjava.net/jsenter/comments/2497.html</wfw:comment><comments>http://www.blogjava.net/jsenter/archive/2005/03/27/2497.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jsenter/comments/commentRss/2497.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jsenter/services/trackbacks/2497.html</trackback:ping><description><![CDATA[<!--StartFragment -->&nbsp;<FONT size=4><SPAN class=NewsTitle>什么是IO</SPAN> </FONT>
<HR class=Header>
<FONT size=4>　　IO（Input/Output）是计算机输出/输出的接口。Java的核心库java.io提供了全面的IO接口，包括：文件读写，标准设备输出等等。Java中IO是以流为基础进行输入输出的，所有数据被串行化写入输出流，或者从输入流读入。此外，Java也对块传输提供支持，在核心库 java.nio中采用的便是块IO。关于NIO我们在后面还有专门的讨论。<BR>　　流IO的好处是简单易用，缺点是效率较低。块IO效率很高，但编程比较复杂。<BR><BR><SPAN class=NewsTitle>Java IO模型</SPAN> </FONT>
<HR class=Header>
<FONT size=4>　　Java的IO模型设计非常优秀，它使用Decorator模式，按功能划分Stream，您可以动态装配这些Stream，以便获得您需要的功能。例如，您需要一个具有缓冲的文件输入流，则应当组合使用FileInputStream和BufferedInputStream。<BR>　　Java的IO体系分Input/Output和Reader/Writer两类，区别在于Reader/Writer在读写文本时能自动转换内码。基本上，所有的IO类都是配对的，即有XxxInput就有一个对应的XxxOutput。<BR><BR><SPAN class=NewsTitle>Java IO教程</SPAN> </FONT>
<HR class=Header>
<FONT size=4>　　如果您对</FONT><A href="http://www.javasprite.com/patterns/gof/decorator.htm"><FONT size=4>Decorator模式</FONT></A><FONT size=4>非常了解，就能轻易地看出Java的IO类结构：根接口是InputStream/OutputStream，充当数据源的IO类有 FileInputStream/FileOutputStream， ByteArrayInputStream/ByteArrayOutputStream等，充当装饰功能的IO类有 BufferedInputStream/BufferedOutputStream， DataInputStream/DataOutputStream等，它们都是继承装饰接口 FilterInputStream/FilterOutputStream。使用IO时，首先创建一个数据源IO，然后根据需要的功能创建装饰类IO，其构造函数的参数为已创建的数据源IO。我们以创建一个具有缓冲的文件输入流为例，假定需要从磁盘读取文件“C:\log.txt”：<BR></FONT>
<TABLE class=Code>
<TBODY>
<TR>
<TD><FONT size=4>// 创建一个FileInputStream:<BR>FileInputStream fileInput = new FileInputStream("C:\\log.txt"); <BR>// 创建一个BufferedInputStream:<BR>BufferedInputStream bufferedInput = new BufferedInputStream(fileInput); <BR>// 现在得到的bufferedInput即是具有缓冲的文件输入流</FONT></TD></TR></TBODY></TABLE><FONT size=4>　　或者进一步简写如下：<BR></FONT>
<TABLE class=Code>
<TBODY>
<TR>
<TD><FONT size=4>InputStream input = new BufferedInputStream(<BR>&nbsp;&nbsp;&nbsp;&nbsp;new FileInputStream("C:\\log.txt"));<BR>// 现在得到的input即是具有缓冲的文件输入流</FONT></TD></TR></TBODY></TABLE><FONT size=4>　　在您对Java的IO有了总体了解后，我们推荐您看看教程</FONT><A href="http://www-106.ibm.com/developerworks/edu/j-javaio-i.html" target=_blank><FONT size=4>Introduction to Java I/O</FONT></A><FONT size=4>和</FONT><A href="http://java.sun.com/docs/books/tutorial/essential/io/index.html" target=_blank><FONT size=4>I/O: Reading and Writing</FONT></A><FONT size=4>。</FONT> <img src ="http://www.blogjava.net/jsenter/aggbug/2497.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jsenter/" target="_blank">李贝</a> 2005-03-27 10:30 <a href="http://www.blogjava.net/jsenter/archive/2005/03/27/2497.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JBuilder 9 Enterprise Edition添加加mysql驱动</title><link>http://www.blogjava.net/jsenter/archive/2005/03/27/2496.html</link><dc:creator>李贝</dc:creator><author>李贝</author><pubDate>Sun, 27 Mar 2005 02:29:00 GMT</pubDate><guid>http://www.blogjava.net/jsenter/archive/2005/03/27/2496.html</guid><wfw:comment>http://www.blogjava.net/jsenter/comments/2496.html</wfw:comment><comments>http://www.blogjava.net/jsenter/archive/2005/03/27/2496.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jsenter/comments/commentRss/2496.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jsenter/services/trackbacks/2496.html</trackback:ping><description><![CDATA[<!--StartFragment -->&nbsp; 
<DIV class=resume><FONT size=4>配置环境：<BR>1、Windows XP Pro sp2</FONT></DIV>
<DIV class=resume><FONT size=4>2、JBuilder&nbsp;9Enterprise<BR>3、MySQL 4.0.15<BR>4、MySQL 的JDBC driver 3.0.9 ，下载网址：</FONT><A href="http://www.mysql.com/downloads/api-jdbc-stable.html"><FONT color=#336699 size=4>http://www.mysql.com/downloads/api-jdbc-stable.html</FONT></A><BR><FONT size=4>本文对JBuilder和MySQL的安装不在此累述，重点从MySQL 的JDBC driver谈起。<BR></FONT></DIV>
<DIV id=content>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 首先，解开MySQL 的JDBC driver的压缩包，其实在这个包中真正有用的就是mysql-connector-java-3.0.9-stable-bin.jar，所以我直接把它放到c:systemmysql-jdbc（这个目录可以自己定义）下</FONT></P>
<P><FONT size=4>在JBuilder中，做如下的操作：</FONT></P>
<P><FONT size=4>一、选择Tool -&gt; Configure Libraries，在Configure Libraries窗口中选择左边列表框下的New，弹出New Library Wizard 窗口，在Name中输入mysql（可以自己定义），Location中选择User Home，点击Add，选择mysql jdbc的路径：c:systemmysql-jdbc mysql-connector-java-3.0.9-stable-bin.jar，点击ok（两次）；</FONT></P>
<P><FONT size=4>二、选择Project -&gt; Project Properties -&gt; Paths -&gt; Required Libraries -&gt; 点击Add，选择第一步骤中添加的User Home下的mysql，点击ok（两次）；</FONT></P>
<P><FONT size=4>三、选择Tool -&gt; Enterprise Setup -&gt; Database Drivers -&gt; 点击Add，选择刚添加的User Home下的mysql，点击ok，在列表框中出现mysql.config，点击ok；</FONT></P>
<P><FONT size=4>四、提示重新启动JBuilder，设置才能生效，确定后，重启JBuilder；</FONT></P>
<P><FONT size=4>五、选择Tool -&gt; Database Pilot ，在Database Pilot窗口中选择View -&gt; Options -&gt; Drivers -&gt; 点击Add<BR><BR>Driver class中输入：com.mysql.jdbc.Driver <BR>Sample URL中输入：mysql://localhost/DataBaseName 点击ok；</FONT></P>
<P><FONT size=4>六、在Database Pilot窗口中选择File -&gt; New，在New URL 窗口中，<BR>Driver：从列表中选择第五步骤建立的com.mysql.jdbc.Driver<BR>URL：将DataBaseName改为存在的数据库，本例中的URL如下：jdbc:mysql://localhost/admin，点击ok；</FONT></P>
<P><FONT size=4>七、在Database Pilot窗口中Database URLs列表中双击刚建立的url，输入连接数据库的用户名、密码，连接成功。<BR><BR>附测试程序：<BR><BR>&lt;%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="errorinfo.jsp"%&gt;<BR>&lt;<A href="mailto:%@page">%@page</A> import="java.sql.*"%&gt;<BR>&lt;<A href="mailto:%@page">%@page</A> import="java.util.*"%&gt;</FONT></P>
<P><FONT size=4>&lt;%<BR>//Initialize<BR>java.sql.Connection&nbsp;&nbsp;&nbsp; conn;<BR>java.sql.Statement&nbsp;&nbsp;&nbsp;&nbsp; stmt;<BR>java.sql.ResultSet&nbsp;&nbsp;&nbsp;&nbsp; rst;</FONT></P>
<P><FONT size=4>Class.forName("com.mysql.jdbc.Driver").newInstance();<BR>String strUrl = "jdbc:mysql://localhost/admin";<BR>String strQuery = "select * from test3";<BR>conn= DriverManager.getConnection(strUrl, "root", "");<BR>stmt = conn.createStatement();<BR>rst = stmt.executeQuery(strQuery);<BR>rst.next();<BR>%&gt;<BR>&lt;%=rst.getString("a")%&gt;<BR>&lt;%<BR>rst.absolute();<BR>conn.close();<BR>%&gt;<BR><BR>注：test3为数据库admin里面的一个表。</FONT></P></DIV><img src ="http://www.blogjava.net/jsenter/aggbug/2496.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jsenter/" target="_blank">李贝</a> 2005-03-27 10:29 <a href="http://www.blogjava.net/jsenter/archive/2005/03/27/2496.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>MySQL使用入门篇 - 安装及一些基本操作。</title><link>http://www.blogjava.net/jsenter/archive/2005/03/27/2495.html</link><dc:creator>李贝</dc:creator><author>李贝</author><pubDate>Sun, 27 Mar 2005 02:28:00 GMT</pubDate><guid>http://www.blogjava.net/jsenter/archive/2005/03/27/2495.html</guid><wfw:comment>http://www.blogjava.net/jsenter/comments/2495.html</wfw:comment><comments>http://www.blogjava.net/jsenter/archive/2005/03/27/2495.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jsenter/comments/commentRss/2495.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jsenter/services/trackbacks/2495.html</trackback:ping><description><![CDATA[<!--StartFragment -->&nbsp;1，<FONT size=4>安装使用默认的安装也可以，也可以自定义安装，都较简单。<BR>安装后为了使用方便，最好建立环境变量：path= %path%;你的mysql安装路径\bin 就可以了。</FONT>
<P><FONT size=4>首先要跟MySQL 服务器连接：<BR>mysql -uroot -p&nbsp;&nbsp; //sql用户默认没有密码<BR>会出现提示符: mysql&gt;_</FONT></P>
<P><FONT size=4>然后选择使用的数据库：<BR>use mysql&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //mysql为一个系统的数据库名,还有test，不过是一个空的数据库.</FONT></P>
<P><FONT size=4>然后就可以进行相应的操作：<BR>mysql&gt; 输入相应的操作指令,然后加上 \g就可以执行了。<BR>example:<BR>mysql&gt;select * from user /g&nbsp; 回车<BR></FONT></P>
<P><FONT size=4>以下是摘抄自网上的关于修改密码，新建用户的操作。</FONT></P>
<P><FONT size=4>二、修改密码。 <BR>格式：mysqladmin -u用户名 -p旧密码&nbsp; password 新密码 <BR>1、例1：给root加个密码ab12。首先在DOS下进入目录mysqlbin，然后键入以下命令 <BR>&nbsp;&nbsp; mysqladmin -uroot -password ab12&nbsp; <BR>&nbsp; 注：因为开始时root没有密码，所以-p旧密码一项就可以省略了。 <BR>2、例2：再将root的密码改为djg345。 <BR>&nbsp;&nbsp; mysqladmin -uroot -pab12 password djg345 </FONT></P>
<P><BR><FONT size=4>三、增加新用户。（注意：和上面不同，下面的因为是MYSQL环境中的命令，所以后面都带一个分号作为命令结束符） <BR>格式：grant select on 数据库.* to 用户名@登录主机 identified by "密码" <BR>例1、增加一个用户test1密码为abc，让他可以在任何主机上登录，并对所有数据库有查询、插入、修改、删除的权限。首先用以root用户连入MYSQL，然后键入以下命令： <BR>&nbsp; grant select,insert,update,delete on *.* to </FONT><A href="mailto:test1@%22%"><FONT size=4>test1@"%</FONT></A><FONT size=4>" Identified by "abc"; <BR>但例1增加的用户是十分危险的，你想如某个人知道test1的密码，那么他就可以在internet上的任何一台电脑上登录你的mysql数据库并对你的数据可以为所欲为了，解决办法见例2。 <BR>例2、增加一个用户test2密码为abc,让他只可以在localhost上登录，并可以对数据库mydb进行查询、插入、修改、删除的操作（localhost指本地主机，即MYSQL数据库所在的那台主机），这样用户即使用知道test2的密码，他也无法从internet上直接访问数据库，只能通过MYSQL主机上的web页来访问了。 <BR>&nbsp; grant select,insert,update,delete on mydb.* to </FONT><A href="mailto:test2@localhost"><FONT size=4>test2@localhost</FONT></A><FONT size=4> identified by "abc"; <BR>&nbsp; 如果你不想test2有密码，可以再打一个命令将密码消掉。 <BR>&nbsp; grant select,insert,update,delete on mydb.* to </FONT><A href="mailto:test2@localhost"><FONT size=4>test2@localhost</FONT></A><FONT size=4> identified by "";&nbsp; </FONT></P><B><BR></B><img src ="http://www.blogjava.net/jsenter/aggbug/2495.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jsenter/" target="_blank">李贝</a> 2005-03-27 10:28 <a href="http://www.blogjava.net/jsenter/archive/2005/03/27/2495.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>J2EE学习之-搭建开发平台</title><link>http://www.blogjava.net/jsenter/archive/2005/03/27/2493.html</link><dc:creator>李贝</dc:creator><author>李贝</author><pubDate>Sun, 27 Mar 2005 02:27:00 GMT</pubDate><guid>http://www.blogjava.net/jsenter/archive/2005/03/27/2493.html</guid><wfw:comment>http://www.blogjava.net/jsenter/comments/2493.html</wfw:comment><comments>http://www.blogjava.net/jsenter/archive/2005/03/27/2493.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/jsenter/comments/commentRss/2493.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/jsenter/services/trackbacks/2493.html</trackback:ping><description><![CDATA[<!--StartFragment -->&nbsp; 
<P><FONT size=4>我的开发平台选用了Weblogic Workshop 8.1，服务是用的Weblogic Server， Windows XP Pro&nbsp; SP2平台。</FONT></P>
<P><FONT size=4>相关技术站点： </FONT><A href="http://dev2dev.bea.com.cn/index.jsp"><FONT size=4>http://dev2dev.bea.com.cn/index.jsp</FONT></A></P>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 第一次搭建这样的平台，开始到网上找了很多的技术文章看了看。由于机器的配置不高。所以还找了一些关于配置Weblogic Server的</FONT></P>
<P><FONT size=4>文章。</FONT></P>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 安装BEA产品的目录为D:\bea，这样，Weblogic Wrokshop就在bea目录下面的Weblogic81文件夹里面。</FONT></P>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 下面对BEA目录下的文件及其Weblogic81目录下面的一些文件夹内容作一个介绍：<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BEA_HOME_DIR：<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jdk131_xx&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Sun Java 2 SDK的1.3.1版本,xx指明安装在机器上的Sun SDK版本。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jrockit xxx.&nbsp;&nbsp; Weglogic JRockit SDK. xxx指明了安装在机器上的版本。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 包含安装和卸载BEA主目录的历史文件。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; utils&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 包含支持安装所有BEA Weblogic 品台产品的有用工具。utils.jar包含有支持 UpdateLicense工具的代码。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; user_projects&nbsp; 用户自己再创建的工程文件就保存在这里。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; license.bea&nbsp;&nbsp;&nbsp; 基于XML格式的license文件，含有安装的所有BEA WEBLOGIC产品的LICENSE键值。，增加一个有效（永久 的 </FONT></P>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ）的LICENSE或因附加功能更新LICENSE时，必须使用UPDATELICENSE工具更新LICENSE文件，注意：最好不要 </FONT></P>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 手工编辑这个文件。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; registry.xml&nbsp;&nbsp; 注册文件。包含安装在目标机器上的所有BEA产品的一致性记录，是与产品有关的信息。例如版本号、服务&nbsp; </FONT></P>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 号、和安装目录等。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UpdateLicense(.cmd/.sh)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一个命令文件(windows NT/2000)或shell脚本(UNIX),用与通过新LICENSE文件更新目前的LICENSE文件。结&nbsp; </FONT></P>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 果是一个合并的LICENSE，包含存在的和新的LICENSE两部分。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Weblogic81：<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; common&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Weblogic平台组件共享的文件，包括一个含有jar文件的摸班目录，供配置向导在创建域时使用，配置向导&nbsp; </FONT></P>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 目录内容并显示基于jar文件的模版选项。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; integration&nbsp;&nbsp;&nbsp; Weblogic Integration程序文件。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; javalin&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 100%的纯JAVA编译器，用于Weblogic平台中的组件的编译。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p13n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; weblogic可移植性个性化文件和库。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; portal&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; weblogic portal程序文件。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; samples&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 例子代码，资源和预配置的例子域，被设计来用来帮助用户学习开发自己的应用。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; server&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; weblogic server程序文件。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; uninstall&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 卸载weblogic平台平台所需要的代码。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; workshop&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; weblogic weorkshop平台程序和文件。<BR>&nbsp;<BR>&nbsp;&nbsp;&nbsp;&nbsp; 安装完后新建一个工程，然后按CTRL+F9键来编译JSP和JAVA文件。然后按F9就可以执行了。当然你也可以直接在浏览器里面输入相应地址</FONT></P>
<P><FONT size=4>来执行。假如无误的话浏览器应该正常显示文字。 <BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; weblogic为学习者提供了一些例子。用户执行 bea\weblogic81\samples\domains\workshop 下面的startweblogic.cmd就可以启动</FONT></P>
<P><FONT size=4>weblogiic服务器，然后在浏览器里面输入：</FONT><A href="http://localhost:7001/console/"><FONT size=4>http://localhost:7001/console/</FONT></A><FONT size=4> 就可以进入控制台来管理了。<BR>&nbsp;&nbsp;&nbsp;&nbsp; 控制台用户帐号的建立：开始-》程序-》weblogic Platform -》configuration wizard就可以新建一个帐号。<BR>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; 关于console的配置学习以后将陆续有讲解,请期待......</FONT></P>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp; 附录：新建一个工程后将在%BEA_HOME%\user_projects\applications\下面新建一个文件夹文件夹名字就是新建的Projects的名字。里面</FONT></P>
<P><FONT size=4>一共有5个文件夹和两个文件：</FONT></P>
<P><FONT size=4>&nbsp;Directorys:</FONT></P>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .workshop, APP _INF, Project_nameWeb, MEAT_INF, Schemas</FONT></P>
<P><FONT size=4>&nbsp;Files:</FONT></P>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .beabuild, Project_name.work</FONT></P>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp; 其中的Project_name为你新建的Projects的名字。这样在Project_name下面就是保存的你新建的网站项目的一些文件，如: index.jsp，</FONT></P>
<P><FONT size=4>然后你在Weblogic Workshop里面在直接编辑他们，写入代码。完成你的项目。</FONT></P>
<P><FONT size=4>测试：</FONT></P>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 再在Weblogic Workshop里面启动服务器，当然也可以手动启动服务器， 在浏览器里面输入：</FONT></P>
<P><A href="http://localhost:7001/Projects_nameWeb"><FONT size=4>http://localhost:7001/Projects_nameWeb</FONT></A><FONT size=4> 就可以测试你编写得你的网站项目了。</FONT></P>
<P><FONT size=4>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;以后将陆续推出一系列的数据库编程文章，请关注我的Blog.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</FONT></P><img src ="http://www.blogjava.net/jsenter/aggbug/2493.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/jsenter/" target="_blank">李贝</a> 2005-03-27 10:27 <a href="http://www.blogjava.net/jsenter/archive/2005/03/27/2493.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>