jtds

Hi,i'm trying jtds library.

My problem is that the application is ok when i try it on eclipse,but when i deploy it on my tomcat server ,i get an exception:user xxxxx non associated with a trusted sql connection.In jtds readme.sso i red that placing ntlmauth.dll (shipped with jtds) in the system path ,i can do automatically trusted sql connections(obviously i've already done it).

Why this trouble ?

Can somebody help me ?

bye

Message was edited by:

Ratataplan

[507 byte] By [Ratataplana] at [2007-11-27 2:09:40]
# 1
It helps if you post the actual error message.As a guess this is a user problem. So it isn't something you are going to solve with java. As one possibility the user/auth you are using is not correct (not setup) under windows.
jschella at 2007-7-12 2:00:22 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
surely not,it's ok when i try it on eclipse.I read i jtds doc that i have only to put a dll file(ntlmauth.dll) in the system path,but this doesn't solve my problem on tomcat.Thanks
Ratataplana at 2007-7-12 2:00:22 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

> surely not,it's ok when i try it on eclipse.

And is your J2EE server running as a service/task on the target machine or you you (logged in as you) start it each time?

If the first then it is still running as a user.

> I read i

> jtds doc that i have only to put a dll

> file(ntlmauth.dll) in the system path,but this

> doesn't solve my problem on tomcat.

I would guess that you got a completely different error if the dll was not in the path? If yes then that would indicate that it has nothing to do with it.

Note again that if this is a permissions problem then it has NOTHING to do with code.

jschella at 2007-7-12 2:00:22 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4

Thanks for your answers.

Before putting the file in the system path the application didn't go in eclipse.

I repeat ,it is ok when i try it in eclipse ,on the same computer in witch tomcat is installed.

Maybe some configuration files are different between eclipse and tomcat.

This is driving me crazy!!!

Bye and thanks again

Ratataplana at 2007-7-12 2:00:22 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5

> Thanks for your answers.

> Before putting the file in the system path the

> application didn't go in eclipse.

> I repeat ,it is ok when i try it in eclipse ,on the

> same computer in witch tomcat is installed.

Well when I run tomcat (or any windows service) on my machines then there are in fact not running under the same user that I log in as.

And unless you specifically set it up that way or you run tomcat from the command line, then it isn't running like that on your machine either.

jschella at 2007-7-12 2:00:22 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 6

I run tomcat from the command line,but in the connection string i put the username and its password.

Obviously this username is defined on the 2003 server on witch sql server is running and is also defined as sql user.

So, since i'm a Tomcat and mssql beginner(i'm an iseries/db2 expert) how i can configure Tomcat to log in to sql server at his startup?

Bye

Ratataplana at 2007-7-12 2:00:22 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 7

> I run tomcat from the command line,but in the

> connection string i put the username and its

> password.

> Obviously this username is defined on the 2003 server

> on witch sql server is running and is also defined as

> sql user.

> So, since i'm a Tomcat and mssql beginner(i'm an

> iseries/db2 expert) how i can configure Tomcat to

> log in to sql server at his startup?

Still doesn't make sense.

If you are using only jtds and you are only using a jtds connection string then the fact that you are running in tomcat (via the command line only) has nothing to do with tomcat.

In the above tomcat is going to do nothing but load the jtds driver and use exactly the connection string that you specified. It has no choice.

Now if you are in fact using a connection pool, or jndi, or a configured connection string (or not running via the command line) then that would be the source of your problem.

jschella at 2007-7-12 2:00:22 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 8

Hi,

this is the connection code

<sql:setDataSource var="reflui"

url="jdbc:jtds:sqlserver://Reflui/ww00012007;namedPipe=true"

driver="net.sourceforge.jtds.jdbc.Driver"

/>

and this is the exception :

[ServletException in:/Resources/jsp/bodies/bodypes01.jsp] Unable to get connection, DataSource invalid: "java.sql.SQLException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection." javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.sql.SQLException: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection." at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:843) at

..... and so on.

If i put username and password in the url,i get a 'Login failed for user 'xxx' instead of Login failed for user '(null)'.

What do you think about ?

Ratataplana at 2007-7-12 2:00:22 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 9

> Hi,

> this is the connection code

> <sql:setDataSource var="reflui"

> url="jdbc:jtds:sqlserver://Reflui/ww00012007;namedPi

> e=true"

>driver="net.sourceforge.jtds.jdbc.Driver"

That isn't code. It is configuration in tomcat.

So you are not in fact using the same thing in both places.

To start with hard code the connection string in to the java code that is running in tomcat. Do not use the configuration info at all.

Report if that works.

jschella at 2007-7-12 2:00:22 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 10
Hi,thanks for you attention<<Do not use the configuration info at all.>>Wath do you want to say ?
Ratataplana at 2007-7-12 2:00:22 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 11
Hi,finally solved!!Sql server didn't allow anonymous connections.I discovered it reading the sql logs.I changed a couple of parameters and a registry key and now it works perfectly.You were right,it was only configuration ,not code!ThanksBye
Ratataplana at 2007-7-12 2:00:22 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...