File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts 1.1 issue (myEclipse+Jboss 3.2.5+SQL Server 2000) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 1.1 issue (myEclipse+Jboss 3.2.5+SQL Server 2000) " Watch "Struts 1.1 issue (myEclipse+Jboss 3.2.5+SQL Server 2000) " New topic
Author

Struts 1.1 issue (myEclipse+Jboss 3.2.5+SQL Server 2000)

Jitendra Kumar
Greenhorn

Joined: Oct 24, 2005
Posts: 14
I am writing this topic after spending a lot of time struggling with the stuff mentioned in subject line.

My Setup

1. myEclipse IDE
2. Struts Version 1.1
3. JDK 1.5
4. Jboss 3.2.5 (Moderator - Please don�t shift this to Jboss forum :-( )
5. SQL Server 2000 (This server is running on a remote win 2000 server)


I am developing this application on a win 2K prof environ.

The Requirement:

Using the above I simply want to print the records of any table in my SQL Server 2K DB.

The problem:
I am not able to do the above. I have tried changing some files in Jboss. I have copied some jars of DB Drivers in WEB-INF/lib folder etc.

If any of you are using the above environment or have knowledge about the same then please tell me the procedure in steps to achieve the above mentioned target.

Thanks in advance


Regards,
Jitendra Kumar
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Jitendra,

It's good that you've given us a thorough description of your development environment, but unfortunately you haven't given us enough information to help solve your problem.

Check out this link for a description of the type of information we need.

In addition to this:

1-Show us how you've defined the datasource (In Struts? in JBoss?) and include snippets of the xml file.
2-Show us how you're trying to access the datasource in your code.
3-It's essential to know specifically what's going wrong and what error messages you're getting.


Merrill
Consultant, Sima Solutions
Jitendra Kumar
Greenhorn

Joined: Oct 24, 2005
Posts: 14
Merrill Higginson,

Thanks for the response.

I was basically interested in knowing all the steps that are required to connect to a remote SQL server 2000 using Struts on JBoss.

After a night of trial and errors, I have finally established the connection.

I am listing the steps to perform this task. It may be helpful to few people.

**********************************************************************

Steps to configure JBoss for MS SQL Server database and Struts

1)MS SQL Server driver classes are required in the Classpath. Copy MS SQL Server JDBC driver class; jar files mssqlserver.jar, msbase.jar, msutil.jar to the server/default/lib directory.


2)To configure with non-XA MS SQL Server datasource-copy /docs/examples/jca/mssql-ds.xml to /server/default/deploy directory.

3)To configure with MS SQL Server XA datasource copy /docs/examples/jca/mssql-xa-ds.xml to /server/default/deploy dir. Modify mssql-ds.xml configuration file. Driver Class and Connection URL settings for MS SQL Server JDBC Drivers are as follows:
3.1) <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver </driver-class>
3.2) <connection-url> jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=MyDatabase
</connection-url>

4) To configure with XA JDBC driver for MS SQL Server modify the mssql-xa-ds.xml configuration file.
4.1) <driver-class>com.microsoft.jdbcx.sqlserver.SQLServerDataSource</driver-class>

5)The standardjbosscmp-jdbc.xml configuration file is configured with Hypersonic database. To configure JBoss server with MS SQL Server modify /server/default/conf/standardjbosscmp-jdbc.xml configuration file.

6)Make the changes as:
<jbosscmp-jdbc>
<defaults>
<datasource>java:/MSSQLDS</datasource>
<datasource-mapping>MS SQLSERVER2000</datasource-mapping>
</defaults>
</jbosscmp-jdbc>

7) Modify login-config.xml configuration file with MS SQL Server database settings. Add the following <application-policy/> element to login-config.xml.

<application-policy name = "MSSQLDbRealm">
<authentication>
<login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
<module-option name = "principal">sa</module-option>
<module-option name = "userName">sa</module-option>
<module-option name = "password">password</module-option>
<module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=MSSQLDS>
</module-option>
</login-module>
</authentication>
</application-policy>

By modifying the mssql-ds.xml, standardjbosscmp-jdbc.xml and login-config.xml the JBoss 4.0 server is configured to be used with a MS SQL Server database.


8)Download these two files to use data connection using Struts and copy them to the server/default/lib directory.
1. Commons-pool-1.2.jar
2. Commons-dbcp-1.2.1.jar

Regards,
Jitendra

**********************************************************************
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I am new to this forum. Is the JBoss forum not very helpful, because this sure does not look like a Struts question? Maybe you should post this info over there if other JBoss users would find it helpful. Are you using EJBs or are you connecting to the database in your Action classes?

- Brent
Jitendra Kumar
Greenhorn

Joined: Oct 24, 2005
Posts: 14
Brent

Welcome to the forum !!

I thought its better to learn complete set up for the combo in one go - Jboss, Struts and SQL Server 2000.

I am not using EJB, i am connecting to DataBase through Action Servlets.

Jitendra
 
wood burning stoves
 
subject: Struts 1.1 issue (myEclipse+Jboss 3.2.5+SQL Server 2000)