Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java Open Source > Apache Tomcat
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Apache Tomcat General discussion of the Apache Tomcat servlet container. For discussions specific to the Professional Apache Tomcat book, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 19th, 2014, 07:39 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2014
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default JNDI connection not working

Hi all,

I maintain a Java servlet running on Tomcat 7 on Windows. One of the database interrogations handled by the servlet was a SQL Server 2005 database and we used a JNDI connection and had SSL certificated encryption. This all worked fine but recently we had to migrate the SQL Server database to a new server running SQL Server 2008 R2. After receiving the server details and port number etc I was able to make a successful connection through SQL Server Management Studio Express as well as setting up a datasource in the Eclipse IDE we use for development. However, I cannot get the JNDI connection to work. When I change the JNDI to use the relevant connection credentials the relevant Web Service request in SoapUI just hangs and times out. My initial investigation indicated upgrading the jdbc driver from sqljdbc1.2 to sqljdbc4 which I downloaded and follwoed all instructions but it still does not work. What am I doing wrong? Can anyone help? Here is the JNDI entry but with certain details such as password amended.

<Resource auth="Container" driverClassName="com.microsoft.sqlserver.jdbc.SQLS erverDriver" factory="org.moss.jdj.dbcp.EncryptedDataSourceFact ory" maxActive="100" maxIdle="30" maxWait="-1" name="jdbc/edrms" password="*******" type="javax.sql.DataSource" url="jdbc:sqlserver://edmssql\ngedm:2369;databaseName=********" username="********" />

Thanks in advance

ajfarroll
Reply With Quote
  #2 (permalink)  
Old December 2nd, 2014, 07:31 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2014
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Successful Connection

I managed to find a solution and managed to create a successful connection. It appears that when attempting to connect to SQL Server 2008 R2 using the Microsoft sqljdbc driver can cause huge problems as outlined in this link I finally found below and they also suggest an alternative third party driver named jtds;

http://stackoverflow.com/questions/1...with-sql-serve

The driver is available from this URL;

http://jtds.sourceforge.net/

I downloaded the driver but required an earlier version so downloaded version 1.2.7 and simply placed the jar file in tomcat/lib directory. Then changed the Tomcat context.xml's JNDI entry to be the following and it is connecting;

<Resource auth="Container" driverClassName="net.sourceforge.jtds.jdbc.Driver" factory="org.moss.jdj.dbcp.EncryptedDataSourceFact ory" maxActive="100" maxIdle="30" maxWait="10000" name="jdbc/edrms" password="password" type="javax.sql.DataSource"
url="jdbc:jtds:sqlserver://myservername:2369:\mySQLdatabaseinstance;databaseN ame=mydatabasename" username="username" />

Thanks to all who viewed

Ajfarroll
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Working process of connection pooling mohd naim ASP.NET 2.0 Basics 0 August 12th, 2011 08:50 AM
Not binding factory to JNDI, no JNDI name configur 4java EJB 0 August 13th, 2007 11:20 AM
ASP connection string not working codehappy Classic ASP Basics 2 May 18th, 2005 08:43 AM
MSDE Connection not working Phil Williams MySQL 3 March 18th, 2004 04:11 AM
DB Connection not working XP costrega Classic ASP Databases 7 November 11th, 2003 06:18 AM



All times are GMT -4. The time now is 03:31 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.