File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JBoss/WildFly and the fly likes Jboss- Mssql configuration porblem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Jboss- Mssql configuration porblem" Watch "Jboss- Mssql configuration porblem" New topic
Author

Jboss- Mssql configuration porblem

mehul savalia
Greenhorn

Joined: Apr 21, 2004
Posts: 6
I am configuring our application on joss-3.2.5.
We are using Ms Sql database.
I have done up to following steps for configuration of Jdbc.

1)msbase.jar,msutil.jar,mssqlserver.jar jar C:\jboss-3.2.5\jboss-3.2.5\server\default\lib dir.
2)Enter following detail in mssql-ds.xml file and copy it in C:\jboss-3.2.5\jboss-3.2.5\server\default\deploy dir.

<datasources>
<local-tx-datasource>
<jndi-name>dmsdb</jndi-name>
<connection-url>jdbc:microsoft:sqlserver://databaseserv:1433;DatabaseName=dmsdb</connection-url>
<driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
<user-name>sa</user-name>
<password>5q154</password>
<!-- sql to call when connection is created -->
<new-connection-sql>SELECT COUNT(*) FROM sysusers WHERE 1 = -1</new-connection-sql>
<max-pool-size>2147483647</max-pool-size>
<idle-timeout-minutes>20</idle-timeout-minutes>

</local-tx-datasource>

</datasources>
3. I have modified the files from \jboss\server\default\config directory

a) standardjaws.xml
<jaws>
<datasource>java:/dmsdb</datasource>

<type-mapping>MS SQLSERVER2000</type-mapping>
<debug>false</debug>

b) standardjbosscmp-jdbc.xml

<defaults>
<datasource>java:/dmsdb</datasource>
<datasource-mapping>MS SQLSERVER2000</datasource-mapping>

4. I have added the following xml info in login-config.xml file from \jboss\server\default\config

<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">sa</module-option>
<module-option name = "managedConnectionFactoryName">jboss.jca:service=XaTxCM,name=dmsdb</module-option>
</login-module>
</authentication>
</application-policy>

5. now i am gettin connection by lookup in jndi tree

ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("dmsdb");
now i am getting error message like this

An error was encountered whilst connecting to the database. Please try again later..An
error was encountered whilst connecting to the database. Please try again later.
.dmsdb not bound


SCJP,SCBCD
cb poo
Ranch Hand

Joined: Oct 02, 2002
Posts: 67
I get solution from this forum as below, forgot what is the url:-

try put following code in between <datasources> tab.

<mbean code="org.jboss.naming.NamingAlias" name="jboss.jmx:alias=dmsdb">
<attribute name="FromName">dmsdb</attribute>
<attribute name="ToName">java:/dmsdb</attribute>
</mbean>
mehul savalia
Greenhorn

Joined: Apr 21, 2004
Posts: 6
Thanks for your Reply.

I have added
<mbean code="org.jboss.naming.NamingAlias" name="jboss.jmx:alias=dmsdb">
<attribute name="FromName">dmsdb</attribute>
<attribute name="ToName">java:/dmsdb</attribute>
</mbean>

in my mssql-ds.xml under <datasource> tag.
But its not working its still gives me an error
10:59:24,392 ERROR [LogInterceptor] Unexpected Error:
java.lang.OutOfMemoryError
10:59:24,392 ERROR [LoginServlet] LoginRemoteException caught...Unexpected Error; nested exception is:
java.lang.OutOfMemoryError

Now my mssql-ds is lilke this


<datasources>
<local-tx-datasource>
<jndi-name>dmsdb</jndi-name>
<connection-url>jdbc:microsoft:sqlserver://INDIADEV01:1433;DatabaseName=dmsdb</connection-url>



<driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
<user-name>sa</user-name>
<password>5q154</password>
<!-- sql to call when connection is created -->
<new-connection-sql>SELECT COUNT(*) FROM sysusers WHERE 1 = -1</new-connection-sql>


<!-- sql to call on an existing pooled connection when it is obtained from pool
<check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
-->
<max-pool-size>2147483647</max-pool-size>
<idle-timeout-minutes>20</idle-timeout-minutes>

</local-tx-datasource>
<mbean code="org.jboss.naming.NamingAlias" name="jboss.jmx:alias=dmsdb">
<attribute name="FromName">dmsdb</attribute>
<attribute name="ToName">java:/dmsdb</attribute>
</mbean>

</datasources>
Vilpesh Mistry
Ranch Hand

Joined: May 27, 2003
Posts: 62
hi mehul,
u are making small mistake

why do use 'sa' as the password in login-config.xml file
when u have used <password>5q154</password>
in mssql-ds.xml file

please use '5q154' as the password in login-config.xml file.
mostly this should solve the problem

best of luck



Thanks.
mehul savalia
Greenhorn

Joined: Apr 21, 2004
Posts: 6
Ya Thanks that was mistake I change it, but it doesnt resovle the problem .
Problem is still there.
[ August 20, 2004: Message edited by: mehul savalia ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Jboss- Mssql configuration porblem
 
Similar Threads
setting up MS SQL Server as a data source with JBoss
JBoss 4.0 and MSSQL Server 2000
DeploymentException: Error cant find datasource:
Urgent help needed : MS-SQL 2K DataSource Configuration
Struts 1.1 issue (myEclipse+Jboss 3.2.5+SQL Server 2000)