java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Can't start a
cloned connection while in manual transaction mode.
at com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source
)
at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.getImplConnection(Unknown Sour
ce)
at com.microsoft.jdbc.base.BaseStatement.setupImplConnection(Unknown Sou
rce)
at com.microsoft.jdbc.base.BaseStatement.<init>(Unknown Source)
at com.microsoft.jdbc.base.BasePreparedStatement.<init>(Unknown Source)
at com.microsoft.jdbc.base.BaseConnection.prepareStatement(Unknown Sourc
e)
at com.microsoft.jdbc.base.BaseConnection.prepareStatement(Unknown Sourc
e)
at com.learndiary.website.dao.LearnDiaryDB.postArticle(LearnDiaryDB.java
:792)
at com.learndiary.website.action.disgoal.PostAdvice0Action.execute(PostA
dvice0Action.java:89)
标签:学习日记
学习日记开发小组文档维护队工作区
用于汇总学习日记开发过程中的一些文档,例如:贡献人员名单,具有阶段性意义的各种信件,项目开发计划书,进度报表等。(另外,不便于在此贴出的文档将另作保存)
使用约定:
这个目标下的评论用于开发小组成员交流;
这个目标下的日记用于分类整理各种文档:例如:所有贡献人员名单填在一个名为贡献人员名单的日记的评论中,所有进度报表填在名为进度报表的这个日记的评论中。
实际上,这个日记已不是通常意义的日记了。它完全是一种文档的目录组织结构了。
疑问:raorao写的EmailAuthenticator.java我不懂
Authenticator ,PasswordAuthentication这两个类没有用过,没有见过,学习中。。。
反馈了raorao和zhl提交的程序
收到并反馈了两人提交的程序。raorao的增加邮件系统的预定目标已经完成,给他提了一点小的增加。把raorao的工作成果发给了开发小组成员内部参考。zhl的程序还有待进一步努力。回复了jw的几点建议。
解决learndiaryV0.9的重复提交问题
关于我做改动的说明
1 在common文件夹中增加了一个文件jslib.js 此文件中写公用脚本。
//when form submit chanage the submit button disable
//f form object
//author zhanghongliang
//date 2004-11-30
function checkSubmit(f){
f.submit.disabled = true;
f.reset.disabled = true;
return true;
}
2 在需要验证重复提交的文件头部包含此脚本
<script language="javascript" src="common/jslib.js"></script>
在form 中添加 onsubmit="return checkSubmit(this)"
修改按钮的属性增加name属性 代码是 property="submit" reset 也要写
此修改完成。
我把所有修改过的文件按目录结构放置好了,只要把整个文件夹拷贝覆盖原来的文件即可。
有问题请mail to me!!
zhanghonliang@yoee.com
2004-11-30
今天收到raorao发来的增加邮件系统的程序并且
近期内我将把它集成入现有的www.learndiary.com中。并在基本的功能集成完毕后包装发布。
文档是这样写的吗?
我还没写过文档,请问大家,是这样写的吗?
这就是我写发送邮件的那个程序的文档
位置:package com.learndiary.website.action.sendmail
整体描述:实现Runnable接口,运行在后台发送邮件的线程
成员变量:
private ArrayList userInfoList 订阅了此目标的所有用户
private ArticleInfo articleInfo 需发送的日记
private int goalID 目标goalID
private String userNameOfWriteDiary 写日记用户的用户名
成员方法:
public String getGoalName() 返回目标的Name
局部变量:
goalName = myDB.getGoalNameByID(goalID); 通过goalID返回目标的Name
public void run() 线程里的run方法
局部变量:
EmailAuthenticator mailAuthenticator = new EmailAuthenticator(uername,password); 获得SMTP邮件服务器认证.
Properties props = System.getProperties(); 获得系统属性
props.put("mail.smtp.host",host); 设置邮件服务器
props.put("mail.smtp.auth","true"); 设置邮件服务器
Session session = Session.getInstance(props,(Authenticator)mailAuthenticator); 获得会话
String toMail = userInfo.getEmail(); 获得订阅了此目标用户的邮箱(收信地址)
String userName = userInfo.getUserName(); 获得订阅了此目标用户的用户名
Session session = Session.getInstance(props,(Authenticator)mailAuthenticator); 获得会话
MimeMessage message = new MimeMessage(session); 定义消息
message.setFrom(new InternetAddress(from)); 设置发信人
message.addRecipient(Message.RecipientType.TO,new InternetAddress(toMail)); 设置收信人
message.setSubject("学习日记您订阅的目标日记"); 设置消息主题
message.setText("您好!"+userName+bodyText); 设置消息内容
transport.connect(host,uername,password); 链接SMTP邮件服务器
transport.sendMessage(message,message.getAllRecipients()); 发送消息
transport.close(); 关闭连接
增加订阅邮件功能已完成
我把发送邮件的原代码贴出来
public class ToSendMailOfThread implements Runnable{
private ArrayList userInfoList = null;
private ArticleInfo articleInfo=null;
private int goalID ;
private String userNameOfWriteDiary = null;
ToSendMailOfThread(ArrayList userInfoList,ArticleInfo articleInfo,int goalID,String userNameOfWriteDiary){
this.userInfoList = userInfoList;
this.articleInfo = articleInfo;
this.goalID = goalID;
this.userNameOfWriteDiary = userNameOfWriteDiary;
}
public String getGoalName() {
String goalName =null;
try{
LearnDiaryDB myDB = new LearnDiaryDB();
goalName = myDB.getGoalNameByID(goalID);
}catch (Exception e){
e.printStackTrace();
return goalName;
}
return goalName;
}
public void run(){
String host = "smtp.126.com";
String from = "learndiary@126.com";
String uername = "learndiary";
String password = "123456";
UserInfo userInfo = null;
String goalName = getGoalName();
java.sql.Timestamp now = new java.sql.Timestamp(System.currentTimeMillis());
StringBuffer bodyTextBuffer = new StringBuffer() ;
bodyTextBuffer.append("\n");
bodyTextBuffer.append("关于学习目标:");
bodyTextBuffer.append(goalName);
bodyTextBuffer.append("\n");
bodyTextBuffer.append(userNameOfWriteDiary);
bodyTextBuffer.append(" 在 ");
bodyTextBuffer.append(now);
bodyTextBuffer.append(" 写了如下日记: \n");
bodyTextBuffer.append("---------------------------------------------------------------- \n");
bodyTextBuffer.append("标题: ");
bodyTextBuffer.append(articleInfo.getArticleName());
bodyTextBuffer.append("\n");
bodyTextBuffer.append("内容: ");
bodyTextBuffer.append(articleInfo.getArticleText());
bodyTextBuffer.append("\n");
bodyTextBuffer.append("相关资源: ");
bodyTextBuffer.append(articleInfo.getArticleResource());
bodyTextBuffer.append("\n");
bodyTextBuffer.append("---------------------------------------------------------------- \n");
bodyTextBuffer.append("欢迎常来学习日记! http://www.learndiary.com");
bodyTextBuffer.append("\n");
String bodyText = bodyTextBuffer.toString();
EmailAuthenticator mailAuthenticator = new EmailAuthenticator(uername,password);
Properties props = System.getProperties();
props.put("mail.smtp.host",host);
props.put("mail.smtp.auth","true");
Iterator iterator = userInfoList.iterator();
while(iterator.hasNext()){
userInfo=(UserInfo)iterator.next();
String toMail = userInfo.getEmail();
String userName = userInfo.getUserName();
try{
Session session = Session.getInstance(props,(Authenticator)mailAuthenticator);
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO,new InternetAddress(toMail));
message.setSubject("学习日记您订阅的目标日记");
message.setText("您好!"+userName+bodyText);
message.saveChanges();
Transport transport = session.getTransport("smtp");
transport.connect(host,uername,password);
transport.sendMessage(message,message.getAllRecipients());
transport.close();
//System.out.println("已发送一封邮件:"+toMail);
} catch (Exception e){
e.printStackTrace();
}
}//end of while
}//end of run()
}
导航改进未能如期完成--很抱歉
自接到任务以后,我做了认真的分析和设计。
但是迫于能力有限,--我接触jsp还刚刚到jstl,
我曾于前几天和jw和admin联系反映过我的情况,得到admin的热情回复。
虽然这几天我已经尽力了,但是对于没能完成任务,影响到了整个项目的进度,我很遗憾,向各位成员道歉。
如果有好的人选,我愿意让贤。
订阅邮件功能的工作进度
编写代码已经完成,现正在完善文挡和写解决问题的过程的日记.
按大兴的建议,参照大富翁论坛。设计情况大概是这样:进入"显示目标内容"前先判断用户是否订阅了这个目标,没订就显示"订阅邮件",否则显示"取消邮件"。用户提交日记后,日记存入数据库后显示一个页面"订阅这个目标的用户有***",而发送邮件由后台处理,发送邮件的确比较费时间。为了试验申请了N个邮箱....
呵呵,今晚睡觉