The error I get is: "com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "CORNERS" requested by the login. The login failed." An interesing note - I get the same message if the database is not running.
SQL Server Express 2005 is installed in mixed mode.
Here is my connection string in the .Net appplication: <add key="connectString" value="Server=(local);UID=sa;PWD=myPasswd;Database=CORNERS" />.
These are my values in my Java app web.xml -
<init-param>
<param-name>DBDriver</param-name>
<param-value>com.microsoft.sqlserver.jdbc.SQLServerDriver</param-value>
</init-param>
<init-param>
<param-name>DBURL</param-name> <param-value>jdbc:sqlserver://localhost\sqlexpress:1055;databaseName=CORNERS</param-value>
<init-param>
<param-name>DBUser</param-name>
<param-value>sa</param-value>
</init-param>
<init-param>
<param-name>DBPwd</param-name>
<param-value>myPasswd</param-value>
</init-param>.
And yes, the port is 1055 - I checked to find it.
I am using Microsoft SQL Server 2005 JDBC Driver 1.0 (sqljdbc_1.0.809.102).
Does anyone have any idea what is wrong so that the login fails in the Java application but works in the .Net application?
Mostlikely, you have a syntax error in your connection string.
jdbc:sqlserver://localhost\sqlexpress:1055;databaseName=CORNERS
please refer to http://msdn2.microsoft.com/en-us/library/ms378428.aspx
you can try
jdbc:sqlserver://localhost:1055;databaseName=CORNERS,
|||I tried your suggestion and it does not work. I get the same error. I tried many different variations of the connection string and none of them have worked.I think it is important to note that I get this error even if the database is NOT running.
This leads me to believe it's a problem with the driver. I have the sqljdbc.jar located in my Tomcat\common\lib directory. Is this incorrect?|||Can you get a trace with FINEST level turned on?|||How do I turn the trace on? And to the finest level? And will this make a difference considering that I get the same message whether or not the database is actually running?|||
I'm having a similar problem. However I am using context.xml to define the connection pool as:
<Resource name="jdbc/SqlServerLocal"
auth="Container"
type="javax.sql.DataSource"
username="PortalUser"
password="********"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://servername\\SQLEXPRESS:1433"
maxActive="10"
maxIdle="4"
maxWait="100" />
and this works on my Windows development machine... but when I ftp the *.war file to the Linux server, I get the following message:
Cannot load JDBC driver class 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
I put the 'sqljdbc.jar' file in the /common/lib path for both installations.
|||Adisciullo,
Please refer to the following site for information regarding turning tracing on:
http://msdn2.microsoft.com/en-us/library/ms378517.aspx
Please post the results so we can further diagnose this.
Additionally, does this problem also reproduce with the v1.1 driver. You can find it at: http://www.microsoft.com/downloads/details.aspx?FamilyId=6D483869-816A-44CB-9787-A866235EFC7C&displaylang=en
Thanks,
Jaaved Mohammed
No comments:
Post a Comment