Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

can't connect to DB

  Asked By: Hisham    Date: Dec 25    Category: Java    Views: 641

I have a connection to DB in my J2EE program and work it properly,I
used hibernate2.0 and Jboss-3.2.3,
Now I install Desktop sql server in my computer,but I can't connect
to database, when run Jboss and read the JNDI file raised an
exception :

"13:13:09,906 INFO [TransactionManagerLookupFactory] instantiated
13:13:10,984 WARN [JBossManagedConnectionPool] Throwable while
attempting to get a new connection:
org.jboss.resource.JBossResourceException: Could not create
connection; - nested throwable: (java.sql.SQLExcep
tion: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing
nagedConnectionFactory.java:160) ....."

please help me ,how connect to database



3 Answers Found

Answer #1    Answered By: Vicki Fields     Answered On: Dec 25

If you prefer to use jboss connection  pool,
1- define your datasource in jboss, ( you can find sample data source definitions in jboss.org)
2- change your hibernate.cfg to use the defined datasource.

Then you have to decide whether you like to use CMT or BMT transaction management ( in normal scenarios it's better to use CMT - because everything is handled by the container ), so you have to add the following entries to your hibernate.cfg as well ( in CMT ):

<property name="hibernate.transaction.factory_class">org.hibernate.transaction.CMTTransactionFactory</property>
<property name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>

Answer #2    Answered By: Isra Demir     Answered On: Dec 25

your error information doesn't provide enough info, but
it seems your connection  properties are wrong !? like connection URL
(port, ...) If you're using Microsoft's JDBC Driver for SQLServer
change it to someother available ones (just google search, I'd used
some other SQL Server JDBC driver called jta-[something].jar )
and make sure your SQLServer is configured properly at the right port.

Answer #3    Answered By: Abrianna Rossi     Answered On: Dec 25

Could you provide us with the full stack trace of the exception you're getting
as well as some
information regarding your data source settings?

Didn't find what you were looking for? Find more on can't connect to DB Or get search suggestion and latest updates.