JSP中读文件和写文件的例子(转帖)

转自:(http://www.programfan.com/article/showarticle.asp?id=2495


 <%@ page import="java.io.*" %>

<html>

  <head>

    <title>Lion互动网络==》JSP中读文件和写文件的例子</title>

  </head>

  <body>

   <%

//写文件

String str = "WWW.LIONSKY.NET";

String filename = request.getRealPath("lionsky.txt");

java.io.File f = new java.io.File(filename);

if(!f.exists())//如果文件不存,则建立

{

  f.createNewFile();

}

try

{

  PrintWriter pw = new PrintWriter(new FileOutputStream(filename));

  pw.println(str);//写内容

  pw.close();

}

catch(IOException e)

{

  out.println(e.getMessage());

}

//读文件

java.io.FileReader fr = new java.io.FileReader(f);

char[] buffer = new char[10];

int length; //读出的字符数(一个中文为一个字符)

//读文件内容

out.write(filename+"<br>");

while((length=fr.read(buffer))!=-1)

{

  //输出

  out.write(buffer,0,length);

}

fr.close();

%>

  </body>

</html>

本栏文章均来自于互联网,版权归原作者和各发布网站所有,本站收集这些文章仅供学习参考之用。任何人都不能将这些文章用于商业或者其他目的。( ProgramFan.Com )

在Struts Action对象中得到类似jsp页面application的ServletContext

今天需要把数据存在网站程序全局范围,需要在struts Aciton对象中得到 ServletContext对象,与jsp页面的application一样。在google中搜索到如下帖子。转帖于此:

How to get 'application' in Struts Action class? (转自:http://forum.java.sun.com/thread.jspa?threadID=609998&messageID=3346689

×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××

How to get 'application' in Struts Action class?  

Mar 23, 2005 7:45 PM

Click to email this message

 

Hello,

I have a question on how to get 'application' in Struts Action class.

In the jsp file, i have set an application attribute:

<%

applicaiton.setAttribute("userId", "testUser");

%>

But how to get this application attribute in Struts Action class?

So far I only know how to get session in Struts Action class by using:

(HttpServletRequest)request.getSession();

 

[Dukes Earned 1425] evnafets

Posts:7,577

Registered: 29/04/03

Re: How to get 'application' in Struts Action class?  

Mar 23, 2005 8:08 PM (reply 1 of 2)

Click to email this message

 

The "application" in a JSP page is the ServletContext object.

In a standard servlet you can use

ServletContext application = getServletConfig().getServletContext();

In a Struts Action class, just have to get hold of the servlet first

ServletContext application = getServlet().getServletConfig().getServletContext();

Cheers,

evnafets

 

[Dukes Earned 0] nonameisname

Posts:24

Registered: 8/13/03

Re: How to get 'application' in Struts Action class?  

Mar 23, 2005 8:33 PM (reply 2 of 2)

Click to email this message

 

Hi evnafets,

Thanks a lot for your help. It works.

By the way, i found that it is possible to get ServletContext in Struts in two ways:

ServletContext application = getServlet().getServletConfig().getServletContext();

or

ServletContext application = getServlet().getServletContext();

Both work fine. Any concern about the 2nd way? It does not getServletConfig() but instead it straight away getServletContext().

*********************************************************************************************************

                       转帖完毕

一个实现将JSP动态页面转为静态的方案(转帖)

最近早上的时候发现首页很难完整打开(其它页正常),搞不懂为什么白天网络繁忙的时候才有可能出现问题在早上出现。我看了网络当前用户只有我一个人,但是数据库当前又只有两个连接(加上我查询连接数据的一个共3个)。不知道是不是这时是搜索引擎们勤奋工作的结果。但老是这样下去也不是办法。

解决的办法有两个:1、缓存数据;2、页面静态化;

暂时想只把首页的数据进行尽量简单的缓存,也许根本就不叫真正意义的缓存,把首页的数据存在程序全局变量中,只有帖子提交后才更新其中的数据。

这样,当首页要取数据时就不用读数据库了。如果这样还不行的话就试试先把首页静态化。再不行的话只有问问空间提供商了。

下面是转帖的一个JSP动态页面静态化的一个方案,贴在这里备用。

***********************************************************************************************************

一个实现将动态页面转为静态的方案(转自:http://java.ccidnet.com/art/3741/20061008/915263_1.html

 

正文

************************************************************************************************************

 

1.前言

为了能深入浅出的理解这个框架的由来,我们首先来了解一下JSP解析器将我们写的JSP代码转换成的JAVA文件的内容。

下面是一个JSP文件test.jsp

<%@ page language=java contentType=text/html;charset=GB2312 %>

<%

out.write();

%>

<%= 输出%>

经过TOMCAT转换出的JAVA文件test$jsp.java内容如下:

package org.apache.jsp;

import javax.servlet.*;

import javax.servlet.http.*;

import javax.servlet.jsp.*;

import org.apache.jasper.runtime.*;

 

public class test$jsp extends HttpJspBase {

 

    static {

    }

    public testOutRedir$jsp( ) {

    }

 

    private static boolean _jspx_inited = false;

 

    public final void _jspx_init() throws org.apache.jasper.runtime.JspException {

    }

 

    public void _jspService(HttpServletRequest request, HttpServletResponse  response)

        throws java.io.IOException, ServletException {

 

        JspFactory _jspxFactory = null;

        PageContext pageContext = null;

        HttpSession session = null;

        ServletContext application = null;

        ServletConfig config = null;

        JspWriter out = null;

        Object page = this;

        String  _value = null;

        try {

 

            if (_jspx_inited == false) {

                synchronized (this) {

                    if (_jspx_inited == false) {

                        _jspx_init();

                        _jspx_inited = true;

                    }

                }

            }

            _jspxFactory = JspFactory.getDefaultFactory();

            response.setContentType(text/html;charset=GB2312);

            pageContext = _jspxFactory.getPageContext(this, request, response,

                            , true, 8192, true);

 

            application = pageContext.getServletContext();

            config = pageContext.getServletConfig();

            session = pageContext.getSession();

            out = pageContext.getOut();

                //为了节省篇幅,我删除了解释器添加的注释

                out.write(\r\n);

//上一句是由于<%@ page language=java  contentType=text/html;charset=GB2312 %>后面的换行产生的

                out.write();

                out.write(\r\n\r\n\r\n\r\n);

                out.print( 输出 );

                out.write(\r\n\r\n\r\n\r\n);

        } catch (Throwable t) {

            if (out != null && out.getBufferSize() != 0)

                out.clearBuffer();

            if (pageContext != null) pageContext.handlePageException(t);

        } finally {

            if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);

        }

    }

}

从上面的代码中可以清晰的看到JSP内建的几个对象(out、request、response、session、pageContext、application、config、page)是怎么产生的,懂servlet的朋友一看就能明白。

下面重点理解一下out对象,它被声明为JspWriter类型,JspWriter是一个抽象类,在包javax.servlet.jsp中可以找到它的定义。

abstract public class javax.servlet.jsp.JspWriter extends java.io.Writer{

       final public static int NO_BUFFER = 0;

       final public static int DEFAULT_BUFFER = -1;

       final public static int UNBOUNDED_BUFFER = -2;

       protected int bufferSize;

       protected Boolean autoFlush;

       protected javax.servlet.jsp.JspWriter(int arg1, boolean arg2);

     

    abstract public void newLine() throws IOException ;

    abstract public void print(boolean arg0) throws IOException ;

    abstract public void print(char arg0) throws IOException ;

    abstract public void print(int arg0) throws IOException ;

    abstract public void print(long arg0) throws IOException ;

    abstract public void print(float arg0) throws IOException ;

    abstract public void print(double arg0) throws IOException ;

    abstract public void print(char[] arg0) throws IOException ;

    abstract public void print(String arg0) throws IOException ;

    abstract public void print(Object arg0) throws IOException ;

    abstract public void println() throws IOException ;

    abstract public void println(boolean arg0) throws IOException ;

    abstract public void println(char arg0) throws IOException ;

    abstract public void println(int arg0) throws IOException ;

    abstract public void println(long arg0) throws IOException ;

    abstract public void println(float arg0) throws IOException ;

    abstract public void println(double arg0) throws IOException ;

    abstract public void println(char[] arg0) throws IOException ;

    abstract public void println(String arg0) throws IOException ;

    abtract public void println(Object arg0) throws IOException ;

    abstract public void clear() throws IOException ;

    abstract public void clearBuffer() throws IOException ;

    abstract public void flush() throws IOException ;

    abstract public void close() throws IOException ;

    public int getBufferSize() ;

    abstract public int getRemaining() ;

    public boolean isAutoFlush() ;

}

我相信当我写到这里你可能已经知道我想怎么做了。是的,来个偷天换日,继承JspWriter类,然后实现其定义的虚函数,然后把out变量替换成你自己实现的类的实例就ok了。

2.实现替换

假设

<%@ page language=java  contentType=text/html;charset=GB2312 import=jwb.util.HtmlIntoFile,jwb.util.TempSinglet,java.io.File%><%

JspWriter out_bak = out;String arg1=argument1;String filePath = /cache/根据参数生成文件名_ + arg1 + .html;//首先判断文件是否已经存在,如果不存在则执行本页面,否则跳转到静态页面就OK了File f = new File(pageContext.getServletContext().getRealPath(filePath));if(f.exists()) { out_bak.clear(); pageContext.forward(filePath); System.out.println(直接转到静态页面); return;}out = new HtmlIntoFile(pageContext.getServletContext().getRealPath(filePath));out.write();

%><%= 看吧,这就是输出被重定向到文件的实现,很简单吧^_^%><%out.close();//关闭生成的静态文件out_bak.clear();pageContext.forward(filePath);

System.out.println(执行本页面后再转到静态页面);return;%>

3.更新问题

下面就讨论一下如何更新生成静态文件,其实从上面实现中你可以看到,很简单的就是将生成的静态文件删除即可,至于什么时候删除,要看你的需求了。我能想到的几种情况如下

    *

      当用来生成页面的数据更新时

    *

      如果不需要很提供时时的数据可以定时更新

    *

      永远不更新

*********************************************************************************************************

                                                        转帖完毕

跳来跳去的adsense广告和在文章中广告文字绕排

  网站需要运行,google广告是一个途径,我认为不应绝对的排斥广告

  前一段时间我发现广告的点击率由1~1.5%下降为0.5~0.8%,就想是不是一成不变的广告对朋友已经失去吸引力,于是用代码让广告随机的变位置和种类。结果经过3天的试验效果,点击率更是下降到了0.1%。

  看来,还是固定位置的广告要好点呀。聊胜于无吧。

  现在的广告形式是页面头尾是大横幅,文章开头绕排一个200×200的正方形广告。

  另外,我申请了google广告的自定义渠道报告分析,从今天的效果来看,还是菜单顶部的效果好于中部和底部。

  可见,网页广告成功的要素还是醒目为主,那种像我那样不断变种类和位置的跳来跳去的广告是不行的。

附:一、jsp页面的元素随机跳动代码

 下面附上我的jsp页面的元素随机跳动代码,使用的是Struts+JSTL+JSP。很简单:

  1、随机数发生器:


package com.learndiary.website.util;

import java.util.Random;

import com.learndiary.website.Constants;

/**

 * generate random int between 0 (inclusive) and the specified value: Constants.MAX_RANDOM (exclusive),

 */

public class Randomer {

  private int i;

  public int getI() {

    return new Random().nextInt(Constants.MAX_RANDOM);

  }

}

  2、在用户进入页面后在session中保留一个 Randomer的对象。

  3、在页面和JSTL调用事先在google帐户中复制下来的代码:


 <c:set var="j" value="2"/>

 <c:set var="k" value="5"/>

 

 

 <c:if test="false">

  <div align="left">

 </c:if>

 <c:if test="false">

  <div align="center">

 </c:if>

 <c:if test="false">

  <div align="right">

 </c:if>

 

  <c:if test="false">

  <%@ include file="/guanggao/234.jsp" %>

  </c:if>

 

  <c:if test="false">

  <%@ include file="/guanggao/468.jsp" %>

  </c:if>

 

  <c:if test="false">

  <%@ include file="/guanggao/728.jsp" %>

  </c:if>

 

  <c:if test="false">

  <%@ include file="/guanggao/link_728.jsp" %>

  </c:if>

 

  <c:if test="false">

  <%@ include file="/guanggao/ref_firefox.jsp" %>

  </c:if>

 

  <c:if test="false">

  <%@ include file="/guanggao/ref_firefox_en.jsp" %>

  </c:if>

 

  <c:if test="false">

  <%@ include file="/guanggao/ref_pic.jsp" %>

  </c:if>

 

  <c:if test="false">

  <%@ include file="/guanggao/ref_pic_en.jsp" %>

  </c:if>

 

 </div>

  总觉得这样写可以让页面简洁一点,也许效率比直接写在jsp页面的要差一点?不知道。

 二、google adsense被文字绕排的效果 (相关代码来自google上的论坛,好像是:http://groups.google.com/group/adsense-help-zhs,具体位置忘了)

1、

 


     <table cellSpacing=0 cellPadding=10 align=left border=0>

      <tr>

       <td style="border-style: dotted; border-width: 0">

        <%@ include file="/guanggao/200_200.jsp" %>

       </td>

      </tr>

     </table>

     <p style="text-indent: 3">

     <bean:write name="aGoal" property="articleText" scope="request" filter="false"/><!--文章内容-->

 

但是我发现google广告在文章头部的加载时间太长严重影响了文章的显示,于是,根据原来学到的让del.icio.us不影响页面的加载(转帖),改进了代码如下:

内容部分:


     <font face="Ms Song"><font face="宋体">

     <table cellSpacing=0 cellPadding=10 align=left border=0>

      <tr>

       <td style="border-style: dotted; border-width: 0">

        <div id="daily_loading">loading...</div>

        <div id="daily_show" style="display:none;"></div>

       </td>

      </tr>

     </table>

     <p style="text-indent: 3">

     <bean:write name="aGoal" property="articleText" scope="request" filter="false"/><!--文章内容-->

     </font></font>

在</body>和</html>之间的部分:

<script type="text/javascript">

 

   function daily() {

 

       document.getElementById("daily_loading").style.display = 'none';

       document.getElementById("daily_loaded").style.display = 'none';

       document.getElementById("daily_show").innerHTML=document.getElementById("daily_loaded").innerHTML;

       document.getElementById("daily_show").style.display = 'block';    

   };

 

   window.onload = daily;

 

</script>

<div id="daily_loaded" style="display:none">

<%@ include file="/guanggao/200_200.jsp" %>

</div>

以上代码供对有同样需求的朋友参考,热切的希望您的任何意见和建议,谢谢。

大家好(转帖jjj的留言)

这是网友jjj的留言,因为本站留言不公开。故按jjj的本来意愿将其复制在此。

×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××

 标题: 大家好  作者: jjj  创建时间: 2006-11-27 21:08:45

内容

好长时间没有来这里了,从04年学习日记开发开始到现在。快2年了。非常想念大家。

我在业余时间开发了一个网站。希望大家有空过去看看。

http://www.xiansky.com

是一个软件开发论坛。目前都是一些西安软件园的开发者,也欢迎大家过去讨论问题。

关于开源项目的看法(转自jjj留言)

注:这篇帖子是朋友jjj在2004年在本站的留言。因本站留言不公开,所以按jjj的本来意思把这篇帖子复制在此。

××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××

 标题: 关于开源项目的看法(转自jjj留言)  作者: littlebat  创建时间: 2004-12-24 15:16:38  最近更新: 2005-10-25 01:19:28  编辑   删除

内容

学习日记小组的各位大家好:

我使一个新加入的新手,请多关照,以下是我的一些拙见,望别见笑,不妥之处请指正!谢谢~

       

Java之所以可以在今天如火如荼,不是因为它是最优秀的语言!说实话,我喜欢c++更甚于java(大学和刚毕业时我一直用vc)。但是有一点必须重视,java有许多开源的东西。众所周知,java的IDE:Eclipse!

并且java的开放并不仅仅局限这些东东。他有好多开放的源码让我们参考并且可以说是拷贝,世界上的众多高手们都在为java做努力,创造了很多好的工具和包。

         就具体的项目开发来说,我们离不开这些工具和包(那Eclipse举例吧)

1.     

IDE开发环境:网上直接下载!这个集成开发环境自我感觉很不错,除了耗点内存,其他的优点的却很多。

2.       版本控制:CVS插件,把它嵌入到Eclipse中很方便,只需要

CheckOut,Update,Commit,Rep.........etc一切都很方便。为团队开发创造了很多方便,纵然我们都相隔千里之外。

3.       打包:Maven插件,

有了它,Eclipse发挥的作用就更明显了。以前很多包都要手工生成,但只要给Eclipse里装了这个插件。我们的工作就减轻了很多,只需要对相应文件打包,就可以轻松的发布了!

具体打法如下:Action和Form文件: jar:install-snapshot

                            jsp  page文件和struts-config文件:

war:install-snapshot

                            ejb文件:ejb:install-snapshot

                            开发库: (我的是develop)  : ear

                            实体(Entity)  :jar:install-snapshot

                            Configfiles:  jar:install-snapshot

   

比如说你修改了你的Ejb,给里面加了几个方法,想在Action中调用,只需要对Action的project.xml执行Eclipse就可以导入相应的包。

4.        日志管理:    log4j      

开发中的输出日志是很重要的,如果在项目中大量的使用System.println();输出错误信息,无疑对一个项目是有害的。调试的时候觉得还可以,可到了后期就成了一种负担,所以使用Log4j,它的使用方法很简单,并且对异常的捕获处理的很好,几种不同优先级输出方式。对各种 Exception处理的很好。log.info();log.debug();log.error();

等等。。

5。       Hibernate

,别说Ejb有多么优秀,但是hibernate有许多Ejb无法处理的。比如说事务吧,当出现无法预料的环境时,事务的回滚操作。在平时看起来不是很严重,但如果牵扯一笔很大的交易,损失不言而喻,并且他

的Po操作很方便! 也很安全!其中的Hql语句到现在我还很佩服!  在写jsp

页面时很好用!不用每次都用什么formbean 的,直接name="po"  "PO as po"

页面直接写就可以了!!  

继承一个公用的QueryAction,不同页面写不同的实体即可!

6.         运行环境: 就不说了,我开发时用的是Weblogic

8.1,软件发布以后在WebSphere上跑!

好了,就说这么多吧,该回家陪我们家咪咪了!88,住学习日记的所有人好运,圣诞快乐!

注册用户公告信息发布区

因为看到有朋友在本站发布留言想公告自己的一些技术信息和网站信息,但是本站的留言是不公开的。所以,就无法满足朋友的愿望。

所以我们特别设置一个“注册用户公告信息发布区”供朋友发布技术相关的、合法和文明的公告(和广告)信息。

你必须以注册用户身份登录,在这个目标下提交的日记即为您的公告。

恳请在这里发布公告的朋友也能帮助宣传一下本站。请记住我们的网址:http://java.learndiary.com/,JAVA学习日记,分享目标,分享快乐。感谢您的来访和留言。

谢谢。

Thinking in Patterns Chapter 11: Flexible structure

Thinking in Patterns with Java V0.9: Chapter 11: Flexible structure: TIPatterns.htm#_Toc41169735

1, Sections:

  Composite

2, The main content and feeling:

  At first, the meaning of "Composite" has confused me a little. There is a

"Composition" and "Aggregation" terms in UML. And, I thought "Composite" in

GoF's design patterns as the "Composition" in UML. At last, I have known these

two terms are all totally different.

Here, I don't give the explaination of "Composition" term in UML, you can get

it at our site:

http://java.learndiary.com/disDiaryContentAction.do?goalID=1345

I understood the meaning of "Compostion" after reading the example://:

composite:CompositeStructure.java. The key is: The node and its child node has

the same operations, "and that performing an operation on a node/composite

also performs that operation on any children of that node/composite."

Just like an orgernization, there are some partions under this orgernization,

and alse maybe there are lower partions under the orgernization's partion.

When the leader of orgernization say: do(it), the entire orgernization start a

mission just "do(it)". Then, every partions of

orgernization and the lower partions of the orgernization's partion will also

perform this "do(it)" mission. But, the detail of "do(it)" in all these level

isn't same.

And, there is a point about "passing parameter to a java method" need be

noted.

See the code part below:


    Node c2 = new Node("Node1"); //Step 1

    //some code omited

    root.add(c2); //Step 2

    c2 = new Node("Node2"); //Step 3

    //some code omited

 

   root.add(c2); //Step 4

At Step 2, a duplicated copy of the address of object created at Step 1 passed

into method add(); and, the reference "c2" point to a new object, again,

another object's address be duplicated into the method add() at Step 4. Note,

the object pointed by "c2" at Step 2 will can't be changed by a new object to be

pointed by "c2".  

If you are confused with the "passing parameter into a java method" like

above, maybe, an article of mine titled with "Understanding Assignment and

Passing Parameters in Java with Term 'Stack Date Copy'" posted at:

http://java.learndiary.com/disDiaryContentAction.do?goalID=2716 can help you to understand it.

3, Questions about programming:

4, Questions about english language:

1), Strange words:

part-whole, containment, visitation,

2), Difficult sentences:

1>, The important thing here is that all elements in the part-whole have

operations, and that performing an operation on a node/composite also performs

that operation on any children of that node/composite.

                                     incomplete

开源数据库mysql免费使用和商业使用的区别(转载)

今天,看到matrix的文章回复中有朋友问有什么开源付费的软件,我在网上找到这篇帖子,觉得很有代表性,特地转载于此。

转自:http://www.chinaunix.net/jh/17/814671.html 

转帖正文:

××××××××××××××××××××××××××××××××××××××××××××××××××××××××××

[保留] 【疑惑】mysql在商业上到底怎么用?需要付费么?别人告怎么办?

http://www.chinaunix.net 作者:jglxgz  发表于:2006-10-25 20:48:02

【发表评论】【查看原文】【MySQL讨论区】【关闭】

mysql到底怎么用了,需要付费么?包括服务器和客户端,windows和linux下的使用?在商业上怎么用了?别人告侵权咋办?

我现在打算用postgresql,但它缺乏windows下的双机热备

------------------------------------

下面的文章是转载(不好意思,找不到原始出处)

 ----------------------

很多人都不理解MySQL的授权方式,主要原因是没有中文资料别无其他!

我不想嘲笑谁,但是我认为有必要搞清楚这一重要的因素。国际官司我

们已经吃亏太多了,我不想这变成笑柄。

当前,MySQL采用双重授权(Dual Licensed),他们是GPL和MySQL AB

制定的商业许可协议。如果你在一个遵循GPL的自由(开源)项目中使

用MySQL,那么你可以遵循GPL协议使用MySQL。否则,你需要购买MySQL

AB制定的那个商业许可协议。这里最重要的一点就是要想免费使用MySQL,

你所开发的软件必须是遵循GPL的自由(开源)软件,虽然被批准的自由

(开源)许可协议有很多个。

理清授权管辖的范围

MySQL是一套客户端/服务器(C/S)结构的系统。双重许可机制对两大块

同时进行约束,但是并不绝对。MySQL AB(MySQL的出品公司)考虑到便

于人们使用,客户端是完全遵循GPL许可。也就是说,在事实上MySQL的

双重许可机制这一双重的特点是对服务器端而言的。我想,我恐怕会把

一些人搞糊涂,这里所说的客户端指的是MySQL AB开发的那个命令行下

的客户端工具(mysql.exe)。

不同操作系统下是否有特殊的限制?

在当前可以说没有,如果有只是MySQL具体代码实现上的功能差异,许

可协议本身是没有特定区分的。在早期MySQL确实对微软/非微软操作系

统进行过特定的区分,在那时如果要获得Windows平台最新的MySQL,

你必须付费购买,现在已经不同了。

Windows版本是否受到限制?

刚才已经说过了,现在没有这种区分,唯一的差异是不同操作系统下的

具体实现造成的。当前,你可以随意获得最新的Windows版本分发。他

们是没有功能、时间限制的。当然,你应该遵循许可协议。

以教育为目的是否需要付费?

其实没有这个区分,主要的取决还是软件是否遵循GPL进行发布。当然,

如果只是用来做课堂教学是不用购买商业许可协议,这种情况下MySQL

遵循GPL许可协议。

我该买几个许可证?

MySQL的许可证按照计算机台数计算,一台机器一个。至于一台机器多个

操作系统的情况下该购买几个许可证这种龌鹾问题别问我,我不知道!

许可证和技术支持的关系?!

技术支持和许可证是不同的东西。虽然很多的软件会把它们搭配销售,

但是实际上应该有单独签署一份技术支持保障协议。具体的时限和价格

我不清楚。

MySQL API的授权

MySQL客户端API遵循GPL协议,其中所包含的GNU getopt 遵循LGPL,并

且一些地方用到的regexp库则遵循BSD许可协议。

更多的信息

强烈建议去看看手册中MySQL许可协议的相关授权章节,里边写的非常详

细。

----------------------------------

欢迎释疑,谢谢!

 jglxgz 回复于:2006-08-20 21:16:41

http://www.mysql.com/company/legal/licensing/faq.html

 jglxgz 回复于:2006-08-20 21:17:48

http://www.mysql.com/company/legal/licensing/faq.html

-------------------------------------------------------------------------------

What is MySQL's software licensing model?

MySQL uses a "dual licensing" business model. Under this model, users may choose to use MySQL products under the free software/open source GNU General Public License (commonly known as the "GPL") or under a commercial license.

With the GPL license, MySQL is available free of charge. Users may download the software for free and modify, integrate and distribute it. However, GPL users must abide by the rules of the GPL, which stipulate that if a MySQL-based application is redistributed, the complete source code for this application must also be open and available for redistribution.

MySQL AB offers a commercial license for organizations that do not want to release the source code for their application. Commercial license customers get a commercially supported product with a level of assurance from MySQL AB, without the requirement that their MySQL-based software must be "open sourced". MySQL is able to provide a commercial license because it has full ownership of the MySQL code.

MySQL's dual licensing increases freedom in two ways: first, it encourages the growth of free software by licensing MySQL under the GPL; second, it makes it possible to use our software in situations where the GPL is not applicable.

Why does MySQL offer two licenses?

MySQL's dual license model supports the company's mission: to make superior database software available and affordable to all.

The dual licensing creates a circle that sustains both innovation and growth: MySQL channels the revenue from this viable open source business model back into support for its open source user community that, in turn, supports MySQL AB's commercial business.

Today, MySQL AB has over 4 thousand paying customers who have chosen the commercial license and over 4 million who have chosen the open source GPL license. The dual licensing business model is a "win-win" for all parties:

    * MySQL's open source community gets superior software for no cost;

    * MySQL's commercial customers have the option of using reliable, community "battle tested" MySQL software for a relatively low cost;

    * MySQL's business is healthy and viable, which also strengthens the open source movement.

How do I know which license to use?

The overall guiding business principle of MySQL's dual licensing is one of fair exchange or "Quid pro Quo" which means "something for something."

So if you use MySQL with GPL-licensed software (or a license that is GPL-compatible) we encourage you to use the GPL license. For all other users of MySQL, we recommend that you purchase a MySQL commercial license

For more complete guidelines on the GPL and commercial license from MySQL, please read our licensing overview or contact a MySQL representative online.

Do I get the same MySQL software under either license?

Yes. The MySQL product is essentially identical under either the GPL license or the commercial license. In some cases there are minor differences in the support libraries due to incompatibilities between the licenses of the libraries and MySQL.

How much does a commercial MySQL license cost?

As a result of its open source community and licensing model, MySQL AB is able to produce and offer its software at a much lower cost than what is typical in the industry. Current pricing for the server and other products can be found on our online store.

With a commercial license option, is MySQL still an "open source" company?

Yes, MySQL is still an open source company and is completely committed to the open source values and philosophy. We believe the open source model of development and distribution is the most efficient way to produce high-quality software. All MySQL software is offered under both open source and commercial license terms.

Are other companies using the dual licensing business model?

Yes, the dual licensing business model is becoming increasingly popular among open source companies as it paves the way for long-term financial viability. Other companies that offer dual licensing include Digium, OSAF, MandrakeSoft, Sleepycat Software, Technical Pursuit, Trolltech, and others.

Previously, the MySQL client libraries were licensed under the LGPL (the Lesser General Public License) and now they use the GPL (the General Public License). What prompted this change?

MySQL's goal is to provide all its software under a free software/open source license. The change from the LGPL to the GPL for the client libraries was made in 2001 during the development of MySQL 4.0 to help MySQL AB more easily differentiate between a proprietary user who should buy a commercial license and a free software user who should use the GPL license. Previously there were people that were misusing the GPL by distributing the MySQL server tightly coupled with their applications and claiming that the GPL doesn't affect them because the client libraries were free to use.

This change has allowed MySQL to support its dual licensing model by better identifying when someone is using MySQL software in a closed source fashion without commitment to the open source philosophy. While MySQL supports the open source ideals, we also believe in the notion of "Quid Pro Quo" or fair exchange. For developers building open source applications using MySQL, the change in the client licensing policy has no effect.

Based on feedback from our users, MySQL has introduced an exception that makes it possible to combine the MySQL client libraries with software that uses various Free and Open Source software ("FOSS") licenses. This is known as the FOSS License Exception.

What is the GPL License Exception for PHP?

Because PHP and MySQL use different incompatible open source licenses, we have created a special exception to encourage and promote the use of MySQL in the PHP community. MySQL AB gives permission to distribute derivative works that are formed with GPL-licensed MySQL software and with software licensed under version 3.0 of the PHP license. You must obey the GNU General Public License in all respects for all of the code used other than code licensed under version 3.0 of the PHP license.

There is also a more general exception which enables developers releasing software under other Free and Open Source software ("FOSS") licenses to include the MySQL client libraries. This is known as the FOSS License Exception.

What is the FOSS License Exception to the GPL?

The FOSS License Exception enables open source developers who are using Free and Open Source software ("FOSS") licenses other than the GPL to include the MySQL client libraries. Since some licenses are incompatible with the GPL this exception provides flexibility for open source developers. We want to support the open source community in their desire to use the MySQL client libraries in a broad range of open source projects.

Why has MySQL created the FOSS License Exception?

We created the FOSS License Exception to give developers greater flexibility in using MySQL with software that is under other Free and Open Source Software ("FOSS") licenses. Some open source licenses are not fully compatible with the GPL and so this exception makes it possible for developers to chose their preferred open source license and still have the ability to include the MySQL client libraries.

How did MySQL select the licenses for inclusion in the FOSS exception?

We have reviewed the most popular open source licenses to make sure that they can be used with the MySQL client libraries. If you are using a different open source license that follows the Open Source Definition by the Open Source Initiative and it is not on our list of approved licenses please contact us at license-feedback@mysql.com.

What is MySQL's policy on software patents?

We do not think that software patents are a useful way to protect software IP. Instead, we believe that copyright protection is sufficient. We have concluded that software patents are harmful to the software industry at large. This is why we support those who work for an abolishment of software patents. We also work with other companies and groups to build a joint defense against software patents. More information is available on our patent policy page.

How do I send MySQL AB comments on licensing or other issues?

The open source community is very important to MySQL and we want to hear all feedback! We have previously asked the community for specific feedback on licensing and will continue to do so to create an ongoing dialogue. You can send us your feedback using our feedback form. You can also fill out our survey on licensing and view the results.

Version 4.1, 12 March 2004

 michael75 回复于:2006-08-21 10:57:24

1、如果你是来开发一些应用软件,数据库用MYSQL,你所开发的应用软件销售,则需要付费license.如果你开发的软件不用于销售,但是你必须开放你的源码。如果你不开放源码,那么MYSQL公司就可以起诉你。

2、现在MYSQL的具体分类如下:pro版本分为windows、LINUX、UNIX操作系统, 其中windows、LINUX操作系统的MYSQL价格是一样的,UNIX操作系统的MYSQL贵一些。cluster版本的按照CPU来计算的。

3、如果你是用于商业,捆绑你公司产品销售,那么你必须购买MYSQL的license.根据你的需要的功能和操作系统,价格都会不一样。但是WINDOWS操作系统的价格都一样。

具体情况可以向我咨询:

**************************************************************  

             MYSQL AB中国研发中心

             拓林思(中国)软件有限公司(turboliunx.inc.

         北京万里开源有限公司      (greatlinux.inc)

                 

             宋桂平   MYSQL行业经理

            

地址:北京市朝阳区建国门外大街甲12号新华保险大厦5层503室

手机:13911253265

电话:010-65054020-315

传真:010-65054017

邮编:100022

邮件:michael.song@turbolinux.com.cn

网址:www.turbolinux.com.cn

**************************************************************

 ua 回复于:2006-08-21 12:14:39

如果用mysql作为数据库服务器开发了一些应用软件,仅供公司内部使用,如公司内部的一些小系统,应该是不收钱的,对吧?

 michael75 回复于:2006-08-21 14:27:05

这样的话是不收钱,但是你要开放你的应用软件的源码哦@!

 jglxgz 回复于:2006-08-21 15:15:12

引用:原帖由 michael75 于 2006-8-21 10:57 发表

1、如果你是来开发一些应用软件,数据库用MYSQL,你所开发的应用软件销售,则需要付费license.如果你开发的软件不用于销售,但是你必须开放你的源码。如果你不开放源码,那么MYSQL公司就可以起诉你。

2、现在MYS ...

-------------------

非常谢谢你的解答,你为何不在此贴一下一般的价格和服务支持情况了?很多人可能都有这方面的疑惑,他们即使想购买,可能都不知道怎么办。

也就是说mysql是一个基本商业化的软件,除了GPL用途外,但听说针对PHP有一个专门的许可,能否解释一下,谢谢!

 yejr 回复于:2006-08-21 16:06:55

嗯,解释解释

 jglxgz 回复于:2006-08-21 18:26:18

引用:原帖由 michael75 于 2006-8-21 10:57 发表

1、如果你是来开发一些应用软件,数据库用MYSQL,你所开发的应用软件销售,则需要付费license.如果你开发的软件不用于销售,但是你必须开放你的源码。如果你不开放源码,那么MYSQL公司就可以起诉你。

2、现在MYS ...

----------------------

网上找的,不知出处

开放源代码数据库公司MySQL已采取行动,避免MySQL数据库软件和好搭档PHP软件因授权问题硬生生被拆散。

  PHP全名是HypertextPreprocessor(超文件预处理器),昔日称作PersonalHomepage(个人首页),是一种开放源代码软件,其功能是让计算机快速建构特制的网页。Linux操作系统、Apache网页服务器、MySQL和PHP软件经常搭配使用,于是有开放源代码LAMP的称呼,代表这四种软件英文名起首字母的缩写。

  MySQL营销副总裁ZackUrlocker说,该公司上周四(11日)晚间已推出一项授权特例,允许PHP恢复昔日的做法,也就是与MySQL的组件──即所谓链接库(libraries)──绑在一起。

  PHP程序语言工具制造商Zend公司技术部副总裁AndiGutmans说,MySQL的举动“朝正确方向迈出的一步”,有助于解决开放源代码社区内部日益浮出台面的授权问题。

  和Sleepycat、Trolltech这些开放源代码软件公司一样,MySQL也采取一种策略,让自家的软件以双重管道散布,也就是一方面按开放源代码授权方式提供程序供开放源代码软件使用,同时也根据商业授权允许自制程式纳入专属软件之中。这种双重授权的做法──只适用于同一家公司握有全部源代码著作权的情况──据称有让营收加倍的效果。

  以MySQL为例,这家瑞典公司的数据库软件及支持的链接库现在采用公众通用证书(GPL)授权方式。但这些链接库先前是受次级公众通用证书(LGPL)的授权规范。

  两种授权方式之间的主要差异,在于专属软件或其它非GPL软件可能与LGPL软件有密切的关联。

  在去年6月以前,PHP软件一直纳入MySQL的链接库,让PHP程序设计师在构建网站时能够轻松利用数据库。但后来MySQL以某些专属软件开发商不当使用MySQL软件为由,改变了授权方式,让商业软件商必须付费取得MySQL商业授权,却也连带迫使PHP制造商移除MySQL组件,并且在后来推出的新PHP测试版中改搭配另一种数据库软件,称为SQLite,连红帽(RedHat)等公司也被迫必须更新软件。

  这些问题现在必须解决,Urlocker说。因为MySQL源代码全为MySQL公司所有,所以该公司可在自家软件中纳入额外的授权条款,新条款称为“免费和开放源代码的软件授权特例”,“让人们依循GPL以外的其它开放源代码授权许可,把MySQL客户端链接库与其它开放源代码计划搭配使用”。

  此特例条款“令人振奋”,Gutmans说。但他指出,MySQL还必须解决别的争议性问题,比方说另外再实施一个授权条款,允许专属软件链接库与MySQL的链接库并用。

--------------------------------------

这是另外一个:http://www.wzdjg.com/bbs/simple/index.php?t75.html

早前Zend给出了一些站不住叫的说法,早前就意识到是许可证的问题,这不,有人捅出来了:

  一直以来, MySQL公司采用的都是“双重”的授权方式,顾客可以在2种授权方式间任意选择。一种是在GPL (GNU General Public License)授权协议下可以免费使用,另一种是商用授权。但不久之后MySQL就表示有不少私有版权软件公司不恰当的使用了GLP授权许可证,因此对许可证的发放方式进行了修改并相应的更改了库文件的一些代码。

  MySQL公司此举遭到开源社区的强烈抗议之后,程序员们普遍认为这将会破坏MySQL数据库与其它软件包之间原有的紧密联系,世界著名的开放源代码数据库软件公司MySQL终于开始采取措施来弥补这个过失。

  在目前,LAMP(Linux、Apache、MySQL、PHP)Web服务应用构筑环境在业内得到了最广泛的应用。因此任何破坏这个应用架构的行为都将引起业界的反对。MySQL公司也是从善如流,在本周四又公布了一个特别许可证,允许PHP重新集成MySQL数据库的一些组件。

  专门从事PHP编程工具销售的技术公司Zend的副主席Andi Gutmans对记者表示,MySQL公司发布这个特别许可证是在正确的方向上前进了一步,而且残存的一些相关的问题也将在不久的将来得到解决。

  在MySQL公司公布新的许可证政策并对其软件的库文件进行修改之前,PHP程序员们可以很容易的利用MySQL数据库来构建网站。 Gutmans如是说,库文件的改变并不意味着PHP不能与MySQL数据库协同工作,不过确实没有以前那么方便了,现在使用MySQL与使用 Oracle或 PostgreSQL公司的数据库已经没有什么不一样了。

 业内人士则称这件事反映了开源软件在向主流迈进的过程中不可避免的阵痛。如果说此前闹得满城风雨的SCO所谓的版权官司是开源社区的软件共享哲学与私有版权软件世界的摩擦的升级的话,那么这次的MySQL许可证事件则表明在开源社区内部也产生了不和谐的声音。

  据记者最新得到的消息,在稍后时间将会公布的一个最新的PHP版本中,将不会集成MySQL的数据库,而是一个名为SQLite的数据库。开源软件巨头 Red Hat公司的发言人Leigh Day在早些时候也已经表示在将来的Linux系统中将不会有MySQL的位置,但其强调这与许可证问题无关。

  相对于共享软件与私有软件的冲突,开源社区内部的矛盾则要更加的复杂。一些分析家认为在下周于旧金山举行的开源社区商业大会上将会有更多的内部矛盾露出水面,预期届时MySQL公司将会大力吹捧它的新型许可证政策并对PHP进行攻击。

--------------------

怎么解释了,现在用mysql的确存在一些疑问

 michael75 回复于:2006-08-22 13:51:58

一、|关于商业MYSQL的购买价格指南:

Material Description                       License Type                          User Number         List Price         Support

MySQL  PRO Version

(for Linux和windows)                                     Server                                1           21,000.00               12

MySQL  PRO Version

(for   Unix)                                                      Server                                1           42,000.00              12

MY SQL   Classic Version

(for Linux和windows)                                      Server                                1           11,000.00               12

MY SQL  Cluster Version                                     Cpu                                 1           180,000.00               12

备注:1、以上价格为人民币;具体购买报价根据用户需求数量的多少享受不同级别的折扣. 2、服务期限为:12个月。3、版本之间的区别: Classic Version不带事务处理功能,PRO Version带事务处理功能,Cluster Version是做集群用的。

二、|MYSQL的支持与服务:

1、对社区下载的产品不提供任何服务与支持,出现问题可以向社区论坛寻求解决办法,但是响应速度慢,而且无法得到有力的支持,无可靠保障.

2、商业版MySQL服务与支持:

服务方式:远程支持,通过电话、WEB、邮件等方式来提供5*8小时的技术服务与支持;

服务期限:12个月。

服务内容::解决运行中出现的问题、提供解决方案、安装,数据库环境搭建、性能调优、协助应用程序迁移等。

 反映速度快,能够及时解决问题,服务与技术支持有保障.

如用户有特殊需要,还可提供现场技术支持,费用另计!

三、社区版与商业版的区别:

1、 社区版:

可以自由从网上下载,不提供没有任何技术支持服务。而且源码无规律, 出现问题后不容易查找。相当于一个大众测试版本。许多新的未经严格测试的特性都会很快加到社区版中让大家下载测试,类似于“试验田”,可靠性、稳定性不高。

 2、商业版 :

    软件经过严格认证,更加稳定、安全,性能比社区版好;平台优化,支持产权保护;包含企业级软件、服务和支持;出现问题后根据源码编排规律能够及时查找。

 

三、关于MYSQL的licenses使用问题:

1、商业用户购买的licenses后,在12个月的有效期内可以免费升级.超出有效期需要升级服务的,则需要另行购买产品,.(购买产品比购买服务便宜).

2、如果不需要进行安全更新服务升级的话,原有的licenses一直有效,可以继续使用。

***********************************************************

             MYSQL AB中国研发中心

        拓林思(中国)软件有限公司(turboliunx.inc.)

            北京万里开源有限公司       (greatlinux.inc)

                 

             宋桂平   MYSQL行业销售经理

            

地址:北京市朝阳区建国门外大街甲12号新华保险大厦5层503室

手机:13911253265

电话:010-65054020-315

传真:010-65054017

邮编:100022

邮件:michael.song@turbolinux.com.cn

网址:www.turbolinux.com.cn;

**************************************************************

 ua 回复于:2006-08-22 14:09:58

是不是我用ava访问mysql,没有买mysql的授权,java的源代码也要开源?似乎有点不合理吧!

 michael75 回复于:2006-08-22 14:21:16

是的,这就是GPL协议的精髓所在.

你必须要公开,除非你有MYSQL的授权.

 ua 回复于:2006-08-22 15:14:14

:em16:

 ua 回复于:2006-08-22 15:20:12

看来要学习postgresql了,据说那个是bsd协议,没有那么严格

 hobowang 回复于:2006-09-18 15:16:39

请问如果是用JSP,PHP之类的程序开发的WEB程序,用于自己运作,需要付钱吗

 michael75 回复于:2006-09-18 15:47:51

呵呵,只要你不卖给客户,不向客户收钱,可以用免费的.

 mynix 回复于:2006-10-03 11:01:48

“三、社区版与商业版的区别:

1、        社区版:

可以自由从网上下载,不提供没有任何技术支持服务。而且源码无规律, 出现问题后不容易查找。相当于一个大众测试版本。许多新的未经严格测试的特性都会很快加到社区版中让大家下载测试,类似于“试验田”,可靠性、稳定性不高。

2、商业版 :

    软件经过严格认证,更加稳定、安全,性能比社区版好;平台优化,支持产权保护;包含企业级软件、服务和支持;出现问题后根据源码编排规律能够及时查找。



问题:我们能从网上方便得到的是社区版,大多数lamp网站用的也是这个版本吧,稳定吗?可靠吗?本站也是用的这个版本吧?应该没问题吧?这在实际应用中应该是个问题吧。还有没有人关注这个问题?

 lsstarboy 回复于:2006-10-24 21:12:02

唉!没办法!

连PHP都不集成了,那Mysql还有什么吸引人的地方呢?

商业应用还要收钱,那么和其它的商业数据库还有什么区别呢,Mysql有什么优势和甲骨文比?商业应用会用Mysql?还搞什么商业版和社区版!严重的岐视穷人!

难道说要一个人只能在学习时用Mysql,商业应用要用别的数据库?

原来学习Mysql,只为它是开源的,想不到竟然有这样的协议!真让人伤心。

决定明天开始扔掉mysql,改postsql。由此,我也看到Mysql的灰暗的未来。

 lsstarboy 回复于:2006-10-24 21:22:20

顺便说一句,我个人理解,GPL并没有要求使用开源软件的软件开源。

举个例子:在linux中,ping这个工具是开源的,也许有个软件,还是商业软件,用到了这个工具的结果,比如说是测试一个主机是不是在线。那么这个软件也是违反GPL的吗?

同样的问题,为什么我们只是用mysql,而mysql强制我们必须开源?

还有,zend是借助于PHP的,而zend也没有开源!

最好的理由,如果要求使用开源软件的软件也开源,那么在linux之下,就不应该有商业软件!因为linux本身就是在GPL下的开源软件!

所以,我感觉,Mysql没有按照GPL规定去做,而是强加了一些“霸王条款”,强烈鄙视这种行为。

 jiazhengw 回复于:2006-10-24 22:30:46

呀,我不想学mysql了,我原来还以为是真正开源的呢!

 ashchen 回复于:2006-10-24 22:56:20

引用:原帖由 michael75 于 2006-8-22 14:21 发表

是的,这就是GPL协议的精髓所在.

你必须要公开,除非你有MYSQL的授权.

精髓?别吓唬人了

修改基于GPL源码而成的软件对外分发受GPL控制,如果只是调用一下MYSQL的数据库功能,付什么费?

GPL拉的屎是否还受GPL控制?

 ashchen 回复于:2006-10-25 00:05:24

支持MySQL的发展无可厚非,对于有一定经济实力的个人或企业也应该那么做,但是如果通过恐吓来到达目的就为人所不耻,那和敲诈勒索有什么区别?

这篇访谈可以增加对GPL协议的理解

http://www.zdnet.com.cn/developer/code/story/0,3800066897,39376955,00.htm

问:企业需要开放哪些源代码?

答:它们使用的GPL 代码以及衍生产品,没有使用GPL 源代码的部分则无须开放。

问:是什么使你有权追究违反GPL 的企业?

答:它们使用了Linux 内核,而我拥有部分Linux 内核的版权。在起诉时,我是作为个人版权所有者起诉的。

问:你认为GPL 与其它许可协议相比有什么不同之处?

答:这是一个哲学问题。BSD 许可协议允许使用源代码,并进行修改,而无需反馈给开发人员社区,但GPL 则要求将自己的修改反馈回社区。这是二种不同的软件开发哲学,选择哪种许可协议与具体的项目有关。例如,如果开发了一个新标准,并希望它迅速地普及,那么最好的方法是使用BSD 而不是 GPL

如果你通过修改基于mysql社区版的源码来增强或优化某些功能,并且发布了,你就有义务而且必须向mysql开发社区公布你修改了什么,不能把这种修改占为自己所有,否则拥有mysql版权的人有权力起诉你

开发者开发的java或者php程序,本身只是调用mysql的api,而mysql的api是GPL协议下的,如果你没有修改这些api源码而重新发布,mysql有什么权力要求公开java或者php的源码呢?

国内开发者大多没有直接修改mysql源码的能力和习惯,而只是使用基于mysql官方源码生成的可执行码

对于可执行码GPL的规定是第三条:

3.你可以以目标码或可执行形式复制或发布程序(或符合第2款的基于程序的作品),只要你遵守前面的第 l,2款,并同时满足下列3条中的1条。

  a)在通常用作软件交换的媒体上,和目标码一起附有机器可读的完整的源码。这些源码的发布应符合上面第1,2款的要求。或者

  b)在通常用作软件交换的媒体上,和目标码一起,附有给第三方提供相应的机器可读的源码的书面报价。有效期不少于3年,费用不超过实际完成源程序发布的实际成本。源码的发布应符合上面的第1,2款的要求。或者

  c)和目标码一起,附有你收到的发布源码的报价信息。(这一条款只适用于非商业性发布,而且你只收到程序的目标码或可执行代码和按 b)款要求提供的报价)。

GPL协议的目的是当你接收下载了一份GPL软件,你有获取,修改和查看源代码的权力,前提是你要把这种权力告诉你修改后软件的接受者使他们也拥有和你一样的权力,如果你不履行后者,将违反协议

[ 本帖最后由 ashchen 于 2006-10-25 11:01 编辑 ]

 UIRL 回复于:2006-10-25 09:00:31

支持ashchen

 lsstarboy 回复于:2006-10-25 14:25:20

支持ashchen的发言,这才是我的理解的GPL。

GPL只限制了修改,并没有限制使用。

 ashchen 回复于:2006-10-25 16:54:49

目前大家用到的软件可以大概分2种,商业软件和开源软件(遵循GPL,apache,BSD等协议的软件)

开发商业软件的公司只给用户使用权,并以此收费,其他权力保留,原因是开发公司投入了人力财力要收回成本并获利

开源软件大多是社区程序员无私的风险,其中GPL协议的软件保留版权,用户有查看原码和修改的权力;由于是社区开发,并没有明确的受益人,所以这类软件大多不向使用者收取费用,只要你有回报社区的想法或心存感激即可,也有软件作者希望使用者给与一定的资助或仅给他发一封感谢信,具体要看授权使用协议;从GPL文本可以看出GPL的对象是开发者或有开发能力的公司,对于那些想通过修改GPL原码发布并获利的人或公司是允许的,前提是要遵循GPL:即向接受者公开原码并告诉他们:“你有修改这些代码的权力,前提是要...”这是一个递归!

国内有的公司修改GPL软件后占为己有或不公开他的修改或者删除GPL协议也不告知他的客户拥有的权力,这是一种违反法律的行文,如果你想违反GPL协议可以向此软件版权所有者申请其他的许可协议

计算机软件和文字作品一样,通过人的智慧把一些元素组合起来能完成一定功能或表达思想,所有者拥有它的版权 所有权等一切权力,当然还能申请专利,拥有专利权,而一般用户需要得到的权力是使用权或得到服务,高级用户希望得到查看源码或修改的权力。软件所有者通过协议的方式授予用户一定的权力,如果你同意这份协议就达成了共识,这就是合同,各国对合同一般都有相关法律条文

以上为本人对协议的理解,若有不同意见请批评指正。系ashchen原创,查看不收费,引用请保留作者名,引用者无需公开身份住址信仰,银行帐号密码等信息,呵呵

[ 本帖最后由 ashchen 于 2006-10-25 21:17 编辑 ]

 ashchen 回复于:2006-10-25 20:48:02

看了一下MySQL.com商业许可和法律文本,MySQL是双许可协议的,并不只是GPL。

http://www.mysql.com/company/legal/licensing/commercial-license.html

The Commercial License is an agreement with MySQL AB for organizations that do not want to release their application source code. Commercially licensed customers get a commercially supported product with assurances from MySQL. Commercially licensed users are also free from the requirement of making their own application open source.

When your application is not licensed under either the GPL-compatible Free Software License as defined by the Free Software Foundation or approved by OSI, and you intend to or you may distribute MySQL software, you must first obtain a commercial license to the MySQL product.

Typical examples of MySQL distribution include:

Selling software that includes MySQL to customers who install the software on their own machines.

Selling software that requires customers to install MySQL themselves on their own machines.

Building a hardware system that includes MySQL and selling that hardware system to customers for installation at their own locations.

Specifically:

If you include the MySQL server with an application that is not licensed under the GPL or GPL-compatible license, you need a commercial license for the MySQL server.

If you develop and distribute a commercial application and as part of utilizing your application, the end-user must download a copy of MySQL; for each derivative work, you (or, in some cases, your end-user) need a commercial license for the MySQL server and/or MySQL client libraries.

If you include one or more of the MySQL drivers in your non-GPL application (so that your application can run with MySQL), you need a commercial license for the driver(s) in question. The MySQL drivers currently include an ODBC driver, a JDBC driver and the C language library.

GPL users have no direct legal relationship with MySQL AB. The commercial license, on the other hand, is MySQL AB's private license, and provides a direct legal relationship with MySQL AB.

With a commercial non-GPL MySQL server license, one license is required per database server (single installed MySQL binary). There are no restrictions on the number of connections, number of CPUs, memory or disks to that one MySQL database server. The MaxDB server is licensed per CPU or named user.

这份商业许可引发不少争议,大体就是你出售的非GPL软件如果用到MySQL,就需要购买MySQL商业许可。

[ 本帖最后由 ashchen 于 2006-10-25 20:50 编辑 ]

原文链接:http://bbs.chinaunix.net/viewthread.php?tid=814671

转载请注明作者名及原文出处

×××××××××××××××××××××××××××××××××××××××××××××××××××××××××××××

                                                            转帖完毕

这几天关于其他一些孩子的新闻让人沉重

这两天听到下面3个关于孩子的新闻:

1、昨天,一个7岁智障女童走失。今天在下班路过一面墙看到上面的寻人启示。我自己用手机记下了上面的联系电话,万一我碰到了那个孩子可以跟她的家人联系呢。

2、一个读小学一、二年级的男孩被人贩子拐走。听人讲可能是人用吃的东西骗走的;现在各个幼儿园、小学上学放学时家长接送的人数骤增。

今天回到家再次教育孩子碰到陌生人不能跟着走,不能走给的东西,要大声呼喊。以前也记录过本地类似的事件,见:真是无奈,这么小的孩子就必须教她怎么防避坏人

3、一个高一的男生同人打架把人杀死了。听说这个孩子家挺有钱。平时奍成了小霸王脾气。现在的有不少孩子很任性,脾气大,以自我为中心。我发觉我们自己的孩子才3岁半,在家里脾气也很大。(见:孩子急躁时怎么办?孩子有时不听话是想得到大人的呵护和关怀吧对孩子的任性也宽容点吧?对待孩子的错误行为有时应该可以适当使用体罚孩子的脾气太坏了;孩子还算勇敢,等等)可在外面还算乖巧,甚至显得有点怯弱(见:孩子受其他小朋友欺负怎么办?)。尽管如此,我已经在考虑怎样把我们这棵小树苗押一押了,不能让她东倒西歪的生长。成人是成才的前提。