connection problems

This could well be a very simple problem, but I am stumped.

I am working on a servlet that connects to a database to grab some data (I am developing it in BEA weblogic 9.0 for whatever that's worth). When I was testing the program I had no problems at all and everything worked great. However, when I set up the program on the server running Tomcat I could no longer get a connection.

The line that is throwing the error is simply:

Connection connection= DriverManager.getConnection(URL, UserName, Password);

The exception I get is:

java.sql.SQLException: [Microsoft] [ODBC SQL Server Driver] [SQL Server] Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

The URL is of the form : jdbc:odbc:serverName, and an ODBC datasource has been created on the server(I have also double checked the URL, username and password more times than I can count!)

Does anyone have any ideas as to what could be causing these problems?

[1010 byte] By [matt233aa] at [2007-11-26 22:20:06]
# 1
Solution tu ur problem: 1. install ur SQL Server in mixed mode.2. Create account in SQL Server.3. Assign proper previlages to account user. i hope its works
shera@ahmad@khana at 2007-7-10 11:16:47 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

Those things have already been done...Any other suggestions from anyone?

I tried writing just a short program to connect to the database exactly how this servlet is supposed to and it worked fine. However, when the code is run from Tomcat I start getting this error. Do I need to import the JDBC files into Tomcat or anything like that? Any help would be great!

matt233aa at 2007-7-10 11:16:47 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
> Login failed for user '(null)'.So where is it getting "null" from? Perhaps your UserName variable is a null reference?
DrClapa at 2007-7-10 11:16:47 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4

No, I have tried doing it by explicitly defining the values and this doesn't seem to work eaither...I have also done it with just one connection string:

Connection connection = DriverManger.getConnection("jdbc:odbc:database; UID=user; PWD=password");

The values for database, user and password are all actually set in the program and are definitely correct...once again, no dice on it working

matt233aa at 2007-7-10 11:16:47 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5
Hi Matt,did you solve this problem?I also get it.I'm using jtds driver with jstl.When i try application in eclipse it's ok,but when i deploy it on tomcat i get the same exception.Please,answer me if you solved it.Bye
Ratataplana at 2007-7-10 11:16:47 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...