Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

New JDBC in servlet

 
A Farroll
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am maintaining a Java servlet developed using Eclipse helios running on windows via Tomcat 7. The servlet connects to a SQL Server database using JNDI and this workied fine until the SQL server database was migrated to a new server. The SQL server version went from SQL Server 2005 SP2 to SQL Server 2008 R2 SP2 and the new JNDI connection wont work. It appears I had to upgrade from sqljdbc-1.2.0.jar to sqljdbc4-3.0.jar, which I downloaded and placed in the tomcat\lib folder. I added the new jdbc to the Windows classpath and the Eclipse classpath. However, it is still not working and just seems to hang when I process the relevant web service request using SoapUI.

As I said before migrating to the new server the SoapUI call to the relevant web serice used to work fine. What am I doing wrong here?

Thanks in advance

Regards

AJF
 
K. Tsang
Bartender
Posts: 3585
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just keep the sqljdbc4 jar file.

If both jdbc jar files are present, there may be conflict.

Try writing a simple jdbc program to verify the connection. If that worked, check the tomcat jndi connection setting.
 
A Farroll
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks K Tsang.

Yes. I have removed the old sqljdbc-1.2.0.jar and the outcome is still the same where the relevant web service call simply hangs.
 
K. Tsang
Bartender
Posts: 3585
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you determine if it hangs in the DB side (eg store procedure if any) or java program side?
 
A Farroll
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks K TSang for your response. I have done a lot of investigation and I am convinced it is stalling on the DB side and not the Java servlet side. Reason being, after trying to change several configurations to get this working, I found one post on stackoverflow that said between two versions the driver chnaged from;

com.microsoft.sqlserver.jdbc.SQLServerDriver
to
com.microsoft.jdbc.sqlserver.SQLServerDriver

I decided to try this and on runnin SoapUI web request I received a response immediately but no data and on examination of the Tomcat logs it stated could not connect to database. Which leads me to think that the connection from the servlet through JNDI on Tomcat is working and somthing towards the DB end is not allowing it through.

Any suggestions?
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic