Forums Register Login

I have a question for sql server2000 JDBC

+Pie Number of slices to send: Send
Error message:

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory ([Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.)

Tomcat5.5.9+sql server2000+jdk1.5



$Tomcat_home$\conf\server.xml:
<GlobalNamingResources>
...
<Resource name="jdbc/sa"
type="javax.sql.DataSource"
password="123456"
driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
maxIdle="2"
maxWait="5000"
username="sa"
url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=eshop"
maxActive="4"
/>
...
</GlobalNamingResources>

//eshop is my web application catalog.

$Tomcat_home%\conf\Catalina\localhost\eshop.xml
<Context>
<Resource name="jdbc/sa"
type="javax.sql.DataSource"
password="123456"
driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver"
maxIdle="2"
maxWait="5000"
username="sa"
url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=eshop" maxActive="4"
/>
</Context>


$Tomcat_home\webapps\eshop\WEB-INF\web.xml
<web-app>
...
<resource-ref>
  <description>sqlserverDB Connection</description>
  <res-ref-name>jdbc/sa</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
</resource-ref>
...
</web-app>

$Tomcat_home\webapps\eshop\dataSource.jsp
<%
DataSource ds=null;
Context ctx=null;

try{
ctx=new InitialContext();
ds=(DataSource)ctx.lookup("java:comp/env/jdbc/sa");
out.print(ds+"<br>");
Connection conn=ds.getConnection();
}catch(Exception ex){
out.print(ex+"<br>");
}
if(conn!=null)
conn.close();
%>

please help me.

Thanks.

[ September 26, 2006: Message edited by: wang deyu ]
[ September 26, 2006: Message edited by: wang deyu ]
+Pie Number of slices to send: Send
You are using Microsoft's own JDBC driver for SQL Server 2000? First off you probably want to change to jTDS or the newer 2005 driver. Next you need to verify that you can actually connect to a database on your local server called eshop - is it running? Does it allow TCP/IP connections? Is it using SQL Server authentication, rather than Windows Integrated security (not an issue if you use jTDS)? Is there any port blocking software runing that might stop you connecting?
+Pie Number of slices to send: Send
Thanks!
May be I should change the Sql Server JDBc!
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1285 times.
Similar Threads
Cannot create JDBC driver of class SQLServerDriver
configure SQL Server 2000 DataSource in Tomcat 5.0.28
Cannot create PoolableConnectionFactory
Problem Using Tomcat+JNDI+SQL Server
Using DriverManager.getConnection() to configure a DataSource
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 01:38:33.