users@glassfish.java.net

Connecting to SQL Server 2005: Shouldn't this work?

From: <glassfish_at_javadesktop.org>
Date: Tue, 15 Jun 2010 02:51:09 PDT

Hi

I am trying to connect with Glassfish v2.1 to SQL server 2005, but I keep on getting "com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user <myuser>". But why?

I use sqljdbc.jar version 1.2 (downloaded from Microsoft)
Datasource Classname: com.microsoft.sqlserver.jdbc.SQLServerDataSource
Resource type: javax.sql.DataSource
In additional properties I specify:
   serverName (an IP)
   databaseName (my database name)
   portNumber 1433
   instanceName (my database instance)
   user (my db user)
   password (my db password)

I guess the problem is related to the instance name, because it is the first time I use it to connect to MS SQLServer (I have several connections which doesn't use it working fine). I have also tried removing the instanceName property and indicating this value in the serverName (IP\instancename format), as I do when I create an ODBC connection, but the result is the same.

I have tested the supplied values creating an ODBC connection using exactly the same values (copy-paste) and they are right

I am thinking about decompiling sqljdbc.jar and trying to debug it, it is the only thing I can think of I haven't already tried.

Any suggestion would be more than welcome.

Thanks
Idoia Usoz
[Message sent by forum member 'idoiausoz']

http://forums.java.net/jive/thread.jspa?messageID=474305