Topic: 数据源配置出错!

  Print this page

1.数据源配置出错! Copy to clipboard
Posted by: tianningsi
Posted on: 2006-06-07 05:35

JSP程序入下
<%
Context ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/mouBBS"); //java:comp/env/jdbc/openadmin
Connection conn = ds.getConnection();

web.xml配置如下
<resource-ref>
<res-ref-name>jdbc/mouBBS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <init-param driver-name="net.sourceforge.jtds.jdbc.Driver"/>
    <!--init-param url="jdbc:jtds:sqlserver://192.168.2.102:1433/uestc;user=sa;password=dataserver"/-->
    <init-param url="jdbc:jtds:sqlserver://127.0.0.1:1433/mouBBS;user=sa;password=111111"/>
。。。。(驱动已载入)

遇到问题:如果 配置为
<init-param driver-name="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<init-param url="jdbc:microsoft:sqlserver://127.0.0.1:1433/mouBBS;user=sa;password=111111"/>(驱动已载入)
则会抛出无法连接的异常,为什么???

2.Re:数据源配置出错! [Re: tianningsi] Copy to clipboard
Posted by: why
Posted on: 2006-06-07 06:04

jdbc:microsoft:sqlserver://127.0.0.1:1433/mouBBS;
==>
jdbc:microsoft:sqlserver://127.0.0.1:1433;databasename=mouBBS;

3.Re:数据源配置出错! [Re: tianningsi] Copy to clipboard
Posted by: tianningsi
Posted on: 2006-06-12 06:57

好,谢谢


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923