[jboss-user] [EJB 3.0] - [Microsoft][SQLServer 2000 Driver for JDBC]Database changed

ruchi123456 do-not-reply at jboss.com
Mon Jun 25 07:46:13 EDT 2007


I am using SQL Server database. I am trying to connect to database name userscdb

I am using jsf and ejb3 

Everytime my application connects to sqlsever, i get below mentioned warnings
16:52:23,107 INFO  [STDOUT] value of em is org.jboss.ejb3.entity.TransactionScopedEntityManager at 1b6847a
16:52:23,148 WARN  [JDBCExceptionReporter] SQL Warning: 0, SQLState: 
16:52:23,148 WARN  [JDBCExceptionReporter] [Microsoft][SQLServer 2000 Driver for JDBC]Database changed to master
16:52:23,148 WARN  [JDBCExceptionReporter] SQL Warning: 5701, SQLState: 01000
16:52:23,148 WARN  [JDBCExceptionReporter] [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Changed database context to 'master'.
16:52:23,148 WARN  [JDBCExceptionReporter] SQL Warning: 0, SQLState: 
16:52:23,148 WARN  [JDBCExceptionReporter] [Microsoft][SQLServer 2000 Driver for JDBC]Language changed to us_english
16:52:23,148 WARN  [JDBCExceptionReporter] SQL Warning: 5703, SQLState: 01000
16:52:23,148 WARN  [JDBCExceptionReporter] [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Changed language setting to us_english.
16:52:23,148 WARN  [JDBCExceptionReporter] SQL Error: 208, SQLState: 42S02

Thus here my database changes to master everytime, although i want to connect to userscdb

------------------------------------
Below is the configuration of my application

persistence.xml placed in META-INF directory
<?xml version="1.0" encoding="UTF-8"?>

<persistence-unit name="shoestringPU">
<jta-data-source>java:/SCMSSQLDS</jta-data-source>
com.j3ltd.server.entities.Person
com.j3ltd.server.entities.Address


		
</persistence-unit>



mssql-ds.xml

<?xml version="1.0" encoding="UTF-8"?>

<!-- ===================================================================== -->
<!--                                                                       -->
<!--  JBoss Server Configuration                                           -->
<!--                                                                       -->
<!-- ===================================================================== -->

<!-- $Id: mssql-ds.xml 23720 2004-09-15 14:37:40Z loubyansky $ -->

  <!-- 

======================================================================-->
  <!-- New ConnectionManager setup for Microsoft SQL Server 2000  driver     

-->
  <!-- You may download the latest Microsoft JDBC driver from *Microsoft*    

-->
  <!-- 

http://msdn.microsoft.com/downloads/default.asp?url=/downloads/sample.asp?url=/

MSDN-FILES/027/001/779/msdncompositedoc.xml&frame=true -->
  <!-- ===================================================================== 

-->


  <local-tx-datasource>
    <jndi-name>SCMSSQLDS</jndi-name>
   
<connection-url>jdbc:microsoft:sqlserver://dbsqlserver\\devenv:1433;DatabaseName=userscdb</connection-url>
<driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>

   <user-name>kkism</user-name>
    kkism
        <!-- sql to call when connection is created
        <new-connection-sql>some arbitrary sql</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>
        -->

      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml 

(optional) -->
      
         <type-mapping>MS SQLSERVER2000</type-mapping>
      
  </local-tx-datasource>




Below is my class using entity bean
public class EntityFacadeBean implements EntityFacade{
@PersistenceContext(unitName="shoestringPU") EntityManager em ;

public Person getPerson(String email) {
  Person entity = null;
try {
Query query = em.createQuery("SELECT p FROM Person p WHERE p.email = ?1");
query.setParameter(1, email);
entity = (Person) query.getSingleResult();
}
catch (NoResultException noneFound) {
// if not found, just return null
}
return entity;
}

}

Please suggest if i am doing anything wrong.

Regards,
Ruchika

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4057306#4057306

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4057306



More information about the jboss-user mailing list