首 页       用户登录  |  用户注册
设为首页
加入收藏
联系我们
按字母检索 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
按声母检索 A B C D E F G H J K L M N O P Q R S T W X Y Z 数字 符号
您的位置: 5VAR论文频道论文中心计算机论文计算机应用
   用JAVA制作ICQ      ★★★ 【字体: 】  
用JAVA制作ICQ
收集整理:佚名    来源:本站整理  时间:2009-01-10 11:56:20   点击数:[]    

ection(/jdbc:odbc:javaicq/,/ /,/ /); //以下连接好友表,返回用户的好友名单 String friend=/select friend from friend where icqno=?/; PreparedStatement prepare4=c4.prepareCall(friend); prepare4.clearParameters(); int icqno=Integer.parseInt(in.readLine()); System.out.println(icqno); prepare4.setInt(1,icqno); ResultSet r4=prepare4.executeQuery(); Vector friendno=new Vector();//该矢量保存好友号码 while(r4.next()){ friendno.add(new Integer(r4.getInt(1))); } //read friend info //以下告诉客户其好友的呢称,号码,ip地址,状态,头像,个人资料等信息 out.println(friendno.size()); for(int i=0;i<friendno.size();i++){ String friendinfo=/select nickname,icqno,ip,status,pic,email,info from icq where icqno=?/; PreparedStatement prepare5=c4.prepareCall(friendinfo); prepare5.clearParameters(); prepare5.setObject(1,friendno.get(i)); ResultSet r5=prepare5.executeQuery(); boolean status; while(r5.next()){ out.println(r5.getString(/nickname/)); out.println(r5.getInt(/icqno/)); out.println(r5.getString(/ip/)); status=r5.getBoolean(/status/); if (status)out.println(/1/); else {out.println(/0/);} out.println(r5.getInt(/pic/)); out.println(r5.getString(/email/)); out.println(r5.getString(/info/)); } //while r5.close();}//for//发送完毕 out.println(/over/); System.out.println(/over/); c4.close();r4.close(); }catch (Exception e){e.printStackTrace();System.out.println(/false/);} //socket.close(); }//end friend //读取好友信息完毕 //以下处理用户添加好友 else if(str.equals(/addfriend/)){ System.out.println(/add/); try{ Class.forName(/sun.jdbc.odbc.JdbcOdbcDriver/); Connection c6=DriverManager.getConnection(/jdbc:odbc:javaicq/,/ /,/ /); //连接数据库,根据接受的用户号码及好友号码向好友表添加记录 int friendicqno=Integer.parseInt(in.readLine()); System.out.println(friendicqno); int myicqno=Integer.parseInt(in.readLine()); System.out.println(myicqno); String addfriend=/insert into friend values(?,?)/; PreparedStatement prepare6=c6.prepareCall(addfriend); prepare6.clearParameters(); prepare6.setInt(1,myicqno); prepare6.setInt(2,friendicqno); int r6=0; r6=prepare6.executeUpdate(); if(r6==1) System.out.println(/ok addfrien/); else System.out.println(/false addfriend/); }catch (Exception e){e.printStackTrace();System.out.println(/false/);} //socket.close(); System.out.println(/over addfriend/); }//end addfriend //用户添加好友结束 //add new friend who add me //以下处理其他用户如果加我,我就加他 else if(str.equals(/addnewfriend/)){ System.out.println(/add/); try{ Class.forName(/sun.jdbc.odbc.JdbcOdbcDriver/); Connection c6=DriverManager.getConnection(/jdbc:odbc:javaicq/,/ /,/ /); //连接数据库,根据接受的用户号码及好友号码向好友表添加记录 int friendicqno=Integer.parseInt(in.readLine()); System.out.println(friendicqno); int myicqno=Integer.parseInt(in.readLine()); System.out.println(myicqno); String addfriend=/insert into friend values(?,?)/; PreparedStatement prepare6=c6.prepareCall(addfriend); prepare6.clearParameters(); prepare6.setInt(1,myicqno); prepare6.setInt(2,friendicqno); int r6=0; r6=prepare6.executeUpdate(); if(r6==1) System.out.println(/ok addfrien/); else System.out.println(/false addfriend/); String friendinfo=/select nickname,icqno,ip,status,pic,email,info from icq where icqno=?/; //如果成功,就向用户传递好友的基本信息,比如呢称等 PreparedStatement prepare5=c6.prepareCall(friendinfo); prepare5.clearParameters(); prepare5.setInt(1,friendicqno); ResultSet r5=prepare5.executeQuery(); boolean status; while(r5.next()){ System.out.println(/dsf/); out.println(r5.getString(/nickname/)); out.println(r5.getInt(/icqno/)); out.println(r5.getString(/ip/)); status=r5.getBoolean(/status/); if (status)out.println(/1/); else {out.println(/0/);} out.println(r5.getInt(/pic/)); out.println(r5.getString(/email/)); out.println(r5.getString(/info/)); } //while out.println(/over/); r5.close(); c6.close(); }catch (Exception e){e.printStackTrace();System.out.

上一页  [1] [2] [3] [4] [5] [6]  下一页


Tags:


文章转载请注明来源于:5VAR论文频道 http://paper.5var.com。本站内容整理自互联网,如有问题或合作请Email至:support@5var.com
或联系QQ37750965
提供人:佚名
  • 上一篇文章:Developer/2000中的Forms参数及应用

  • 下一篇文章:基于GP算法的知识发现系统
  • 返回上一页】【打 印】【关闭窗口
    中查找“用JAVA制作ICQ”更多相关内容 5VAR论文频道
    中查找“用JAVA制作ICQ”更多相关内容 5VAR论文频道
    最新热点 最新推荐 相关新闻
  • ››Delphi 5 数据库应用中ODBC数据源的...
  • ››用Visual Basic 6.0实现自动化测试...
  • ››用JAVA制作ICQ
  • ››在IIS 4.0上配置虚拟主机实现虚拟I...
  • ››利用VB开发CAI课件
  • ››基于GP算法的知识发现系统
  • ››基于Client/Server 的课件系统的设...
  • ››WWW对大量数据查询的一种实现
  • ››基于PHP的Web数据库访问
  • ››Developer/2000中的Forms参数及应用...
  • ››用JAVA制作ICQ
  •   文章-网友评论:(评论内容只代表网友观点,与本站立场无关!)
    关于本站 - 网站帮助 - 广告合作 - 下载声明 - 网站地图
    Copyright © 2006-2033 5Var.Com. All Rights Reserved .