当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 我写了一个修改记录的jsp页面,在<form></form>中有<input type="button" name="submit" value="提交" onclick=checkvalues()>,响应onclick事件的是javascript中写的checkvalues(),通过字段有效性......
 ·关于session类型问题    »显示摘要«
    摘要: 在做电子商城的网页时,如何能记录用户信息(购买商品、数量、价格、用户信息等)?而且要在用户关闭网页时清空这些信息。   我试过用cookies对象,但在客户端关闭些功能时就不可用了。我也试想过用session对象,但不知如何使用。希望哪位高手能告诉我,或是给我更好的提议。 ......


weblogic7的sqlserver的jdbc连接池,应该怎么配置

weblogic7的sqlserver的jdbc连接池,应该怎么配置?

NO.1   作者: JavaZheng

启动WebLogic7    
   
   
   
  2.   打开IE6,在地址栏中输入:http://localhost:7001/console    
   
   
   
  3.   输入用户名和密码    
   
   
   
  4.   在左边的目录树中选中Services->JDBC->Connection   Pools,单击右侧的Configure   a   new   JDBC   Connection   Pool.,输入以下信息:    
   
   
   
  Configuration->General页:    
   
   
   
  Name   =   SQL   Server   Connection   Pool    
   
   
   
  URL   =   jdbc:weblogic:mssqlserver4:northwind@localhost    
   
   
   
  Driver   classname   =   weblogic.jdbc.mssqlserver4.Driver    
   
   
   
  Properties   :   user   =   sa    
   
   
   
  Password   =   “”   <-   sa的密码    
   
   
   
  单击Create建立连接池。    
   
   
   
  Targets->Server页:    
   
   
   
  将myserver(服务器名称)移至右侧的列表中,但击单击Apply    
   
   
   
  5.   在左边的目录树中选中Services->JDBC->Data   Sources,单击右侧的Configure   a   new   JDBC   Connection   Pool.,输入以下信息:    
   
   
   
  Configuration->General页:    
   
   
   
  Name   =   SQLServer   Tx   Data   Source    
   
   
   
  JNDI   Name   =   SQLServer    
   
   
   
  Pool   Name   =   SQL   Server   Connection   Pool    
   
   
   
  选中Emulate   Two-Phase   Commit   for   non-XA   Driver和Row   Prefetch   Enabled    
   
   
   
  单击Create建立数据源。    
   
   
   
  Targets->Server页:    
   
   
   
  将myserver(服务器名称)移至右侧的列表中,但击单击Apply,配置完毕。    
   
   
   
  实战1:连接SQLServer2000    
   
  1.   打开JBuilder7选择File->New   project    
   
   
   
  在Name栏中输入SQLServerDemo,Directory栏中输入存放路径,其他不变,单击Finish。    
   
   
   
  2.   选择File->New,选择General->Application,单击OK。    
   
   
   
  第一步,第二步和第三步都不用更改,直接Finish即可。    
   
   
   
  3.   回到JBuilder7的集成开发环境中,单击右侧的Designer页设计窗体,在窗体中放入一个JscrollPane   和JtextArea   及三个按钮,双击第一个按钮输入以下代码:    
   
   
   
  try    
   
   
   
  {    
   
   
   
  Class.forName("weblogic.jdbc.mssqlserver4.Driver");    
   
   
   
  Connection   con   =   DriverManager.getConnection("jdbc:weblogic:mssqlserver4:northwind@localhost","sa","");//此处根据你的SQLServer帐户而定。    
   
   
   
  Statement   st   =   con.createStatement();    
   
   
   
  ResultSet   res   =   st.executeQuery("select   *   from   employees");    
   
   
   
  String   line   =   "";    
   
   
   
  while   (res.next())    
   
   
   
  line   =   line   +   res.getString("title")+"\n";    
   
   
   
  jTextArea1.setText(line);    
   
   
   
  con.close();    
   
   
   
  }    
   
   
   
  catch   (Exception   ex)    
   
   
   
  {    
   
   
   
  jTextArea1.setText("error   :   "+ex.getMessage());    
   
   
   
  }    
   
   
   
  双击第二个按钮输入以下代码    
   
   
   
  Hashtable   ht   =   new   Hashtable();    
   
   
   
  ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");    
   
   
   
  ht.put(Context.PROVIDER_URL,"t3://localhost:7001");    
   
   
   
   
   
   
   
  try    
   
   
   
  {    
   
   
   
  Context   ctx   =   new   InitialContext(ht);    
   
   
   
  DataSource   ds   =   (DataSource)ctx.lookup("SQLServer");    
   
   
   
  Connection   con   =   ds.getConnection("system","12345678");//此处是WebLogic7    
   
   
   
  的域用户和密码    
   
   
   
  Statement   st   =   con.createStatement();    
   
   
   
  ResultSet   res   =   st.executeQuery("select   *   from   employees");    
   
   
   
  String   line   =   "";    
   
   
   
  while   (res.next())    
   
   
   
  line   =   line   +   res.getString("notes")+"\n";    
   
   
   
  jTextArea1.setText(line);    
   
   
   
  con.close();    
   
   
   
  }    
   
   
   
  catch   (Exception   ex)    
   
   
   
  {    
   
   
   
  jTextArea1.setText("error   :   "+ex.getMessage());    
   
   
   
  }    
   
   
   
  运行WebLogic7,运行程序单击第一个按钮使用JDBC直接连接SQLServer并获取数据,单击第二个按钮使用DataSource连接SQLServer并获取数据。    
 


 ·哪里有lotus note r5的软件下载    »显示摘要«
    摘要: 请问哪里有lotus note r5的软件下载? ......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE