wood burning stoves 2.0*
The moose likes Struts and the fly likes Cannot Connect  Struts web app to remote sql database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Cannot Connect  Struts web app to remote sql database" Watch "Cannot Connect  Struts web app to remote sql database" New topic

Cannot Connect Struts web app to remote sql database

Carla carmona

Joined: Oct 14, 2004
Posts: 14
I there everyone !

I am working in a struts project using MVC, Tomcat and MS SQL 2000.

When a connect the web application to the local host using MYSql database this Datasource works fine :

<data-source type="org.apache.commons.dbcp.BasicDataSource">

<set-property property="driverClassName" value="com.mysql.jdbc.Driver"/>
<set-property property="username" value="root"/>
<set-property property="password" value="tininha"/>
<set-property property="url" value="jdbc:mysql://localhost/newasb" />


But when I am trying to connect the same application to a remote SQL 2000 database using the bellow datasource Tomcat gives me the following error:

type Status report
message Servlet action is not available
description The requested resource (Servlet action is not available) is not available.

Here is the troublesome datasource:

<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"/>
<set-property property="username" value="svc"/>
<set-property property="password" value="cvs1"/>
<set-property property="url" value="jdbc:microsoft:sqlserver://" />


Can anyone help ??? I have all the .jar for the JDBC for SQL 2000 set in both the project and the classpath.

Jose Cardoso Jr

Martin Thorpe
Ranch Hand

Joined: May 25, 2004
Posts: 45

I just had the exact same problem connecting to Oracle. I am running JBoss 4.0.4 and in the server statup it shows that it is setting the servlet to not available because the connection to the database was refused.

Now the main problem with me was connecting remotley and my Oracle TNS not configured correctly, it is corrupt locally so having real problems with that.

The way it was sorted in the end was using a connection string to directly connect to Oracle (I am sure you can do something similar in MySQL or MSSQL)

This is my struts-config datasource, the URL property is where all the action is:

Also make sure you have these classes visible to the server; I have mine in the WEB-INF/lib directory:

The last 2 are Oracle specific I think.

[ June 23, 2006: Message edited by: Martin Thorpe ]
Carla carmona

Joined: Oct 14, 2004
Posts: 14
Thanks Martin, I will give it a try and let you know the results

I agree. Here's the link: http://aspose.com/file-tools
subject: Cannot Connect Struts web app to remote sql database
Similar Threads
Struts and MS SQL 2000
Struts, DBCP weird problem
Connect to MSSQL Server
Struts datasource
connection to database with struts