Topic: Win2000+Tomcat 5.5+SQL2000+j2sdk1.4.2_05 数据库连接问题???

  Print this page

1.Win2000+Tomcat 5.5+SQL2000+j2sdk1.4.2_05 数据库连接问题??? Copy to clipboard
Posted by: xlwh123
Posted on: 2005-04-03 08:47

我的机子安装了上述的四个环境。分别安装在:E:\Program Files\Apache Software Foundation\Tomcat 5.5 E:\j2sdk1.4.2_05 E:\Program Files\Microsoft SQL Server\MSSQL 同时我的JDBC驱动安装在:C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC 我的系统环境变量设置如下:classpath: .;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib.;e:\j2sdk1.4.2_05\lib.;E:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\msbase.jar.;E:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\mssqlserver.jar.;E:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\msutil.jar Tomcat_HOME: E:\Program Files\Apache Software Foundation\Tomcat 5.5\bin 可是我的测试程序怎么也和数据库连接不上,我的程序 是没有问题的。请帮忙啊。

2.Re:Win2000+Tomcat 5.5+SQL2000+j2sdk1.4.2_05 数据库连接问题??? [Re: xlwh123] Copy to clipboard
Posted by: why
Posted on: 2005-04-06 23:32

incorrect:
Tomcat_HOME: E:\Program Files\Apache Software Foundation\Tomcat 5.5\bin

unnecessary and the periods at the end seems like typos
classpath: .;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib.;e:\j2sdk1.4.2_05\lib.;E:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\msbase.jar.;E:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\mssqlserver.jar.;E:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\msutil.jar

As usual, I'm against installation of java software under \Program Files or any folder with spaces in its path

3.Re:Win2000+Tomcat 5.5+SQL2000+j2sdk1.4.2_05 数据库连接问题??? [Re: xlwh123] Copy to clipboard
Posted by: InnocentBoy
Posted on: 2005-04-07 17:39

tomcat_home的那个bin去掉。

4.Re:Win2000+Tomcat 5.5+SQL2000+j2sdk1.4.2_05 数据库连接问题??? [Re: xlwh123] Copy to clipboard
Posted by: 九佰
Posted on: 2005-04-07 18:12

怎么这么不小心,处处跟自己过不去

5.Re:Win2000+Tomcat 5.5+SQL2000+j2sdk1.4.2_05 数据库连接问题??? [Re: 九佰] Copy to clipboard
Posted by: why
Posted on: 2005-04-07 20:26

九佰 wrote:
怎么这么不小心,处处跟自己过不去

也跟老眼昏花的糟老頭子如區區在下的眼睛過不去Smile

6.Re:Win2000+Tomcat 5.5+SQL2000+j2sdk1.4.2_05 数据库连接问题??? [Re: xlwh123] Copy to clipboard
Posted by: 九佰
Posted on: 2005-04-08 09:01

why总是那么勤勉,是我们学习的榜样啊!

Thumbs upThumbs upThumbs up

7.Re:Win2000+Tomcat 5.5+SQL2000+j2sdk1.4.2_05 数据库连接问题??? [Re: xlwh123] Copy to clipboard
Posted by: xlwh123
Posted on: 2005-04-10 22:39

我把classpath改成了:
.;%JDBC_LIB%\msbase.jar;%JDBC_LIB%\mssqlserver.jar;%JDBC_LIB%\msutil.jar;e:\j2sdk1.4.2_05\lib;E:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\msbase.jar;E:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\mssqlserver.jar;E:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\msutil.jar
可是我的数据库连不上 而且我的jsp测试程序也出错了,tomcat配置也出了问题输入http://localhost:8080也没有反应了 怎么办啊

8.Re:Win2000+Tomcat 5.5+SQL2000+j2sdk1.4.2_05 数据库连接问题??? [Re: xlwh123] Copy to clipboard
Posted by: why
Posted on: 2005-04-11 07:20

重裝 Tomcat 吧

弄淸楚
為甚麼要把那三個 M$ 的 jar 放在 classpath 上
classpath 怎様影響 Tomcat
為甚麼要或不要把那三個 M$ 的 jar 放在 Tomcat 的 \common\lib 裡

當問題出現時, 如何簡化環境, 好讓焦點集中 (例如用一個簡單的程式先測試 数据库和 M$ 的 jdbc driver)

否則閣下只是一直盲衝直撞
不會進步的

甚至不能淸楚提問, 讓他人易於明瞭 .

9.Re:Win2000+Tomcat 5.5+SQL2000+j2sdk1.4.2_05 数据库连接问题??? [Re: xlwh123] Copy to clipboard
Posted by: xlwh123
Posted on: 2005-04-11 10:53

斑竹我是一个初学JAVA的菜鸟,基本可以说什么也不懂。想问一下如何学习JAVA呢。比如说是学J2SE\JSEE\J2ME 哪一个更适合一个初学者呢。
就上面的问题我重装了Tomcat还是不行啊。我这段时间一直在配置Tomcat\JDBC驱动\JESDK这几个的环境变量,可它总是与数据库连接不上啊。
现在我都没有信心学习JAVA了。希望斑竹能给小弟讲解一下。

10.Re:Win2000+Tomcat 5.5+SQL2000+j2sdk1.4.2_05 数据库连接问题??? [Re: xlwh123] Copy to clipboard
Posted by: why
Posted on: 2005-04-11 19:47

找本書好好讀讀試試吧

敝人大概只會進一步打撃他人學習的信心Embaressed

11.Re:Win2000+Tomcat 5.5+SQL2000+j2sdk1.4.2_05 数据库连接问题??? [Re: xlwh123] Copy to clipboard
Posted by: xlwh123
Posted on: 2005-05-01 02:04

斑竹好久没有进来了,现在我还在努力的学习JAVA呢。多谢斑竹一直以来的帮助啊。想问个问题是关于菜单的,如何定义热键?

12.Re:Win2000+Tomcat 5.5+SQL2000+j2sdk1.4.2_05 数据库连接问题??? [Re: xlwh123] Copy to clipboard
Posted by: im_is
Posted on: 2005-05-15 14:23

问一下,Tomcat5.5中的数据源和连接池配置的XML格式是不是和Tomcat5.0以前的版本不一样了,看很多人介绍数据原配置是这样的:
<Context path="/test" docBase="test" debug="0" reloadable="true" crossContext="true">
<Resource name="jdbc/connectDB" auth="Container" type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/connectDB">
<parameter>
<name>maxActive</name>
<!-- Maximum number of DB connections in pool.Set to 0 for no limit. -->
<value>100</value>
</parameter>
<parameter>
<name>maxIdle</name>
<!-- Maximum number of idle DB connections to retain in pool.Set to 0 for no limit. -->
<value>30</value>
</parameter>
<parameter>
<name>maxWait</name>
<!-- Maximum time to wait for a DB connection to become available in ms.An exception is thrown if this timeout is exceeded.Set to -1 to wait indefinitely. -->
<value>10000</value>
</parameter>
<parameter>
<name>removeAbandoned</name>
<!-- Abandoned DB connections are removed and recycled -->
<value>true</value>
</parameter>
<parameter>
<name>removeAbandonedTimeout</name>
<!-- Use the removeAbandonedTimeout parameter to set the number of seconds a DB connection has been idle before it is considered abandoned. -->
<value>60</value>
</parameter>
<parameter>
<name>logAbandoned</name>
<!-- Log a stack trace of the code which abandoned -->
<value>false</value>
</parameter>
<parameter>
<name>factory</name>
<!-DBCP Basic Datasource Factory -->
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>username</name>
<!-- Database User Name -->
<value>root</value>
</parameter>
<parameter>
<name>password</name>
<!-- User Password -->
<value></value>
</parameter>
<parameter>
<name>driverClassName</name>
<!-- Database Driver Class Name -->
<value>com.mysql.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<!-- Database Address -->
<value>jdbc:mysql://localhost/test</value>
</parameter>
</ResourceParams>
</Context>

今天按这个方法在Tomcat5.5中配置的一上午老是不行。后来看了Tomcat5.5的文档,按如下配置:
<Context path="/test" docBase="test"
debug="0" reloadable="true" crossContext="true">

<Resource name="jdbc/connectionDB" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="root" password="root" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/test?autoReconnect=true"/>

</Context>

是不是Tomcat5.5一定要用后面这种配置了?


   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