Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Wednesday, March 7, 2012

cannot connect with JDBC to express 2005

Hi all,

I try to connect with a java application to a freshly download SQL server express 2005, but I cannot anything I do.

If I try with the following string "10.0.0.82:1433;databaseName=flavio;user=f.palumbo;" I get this message :

java.sql.SQLException: Impossibile eseguire l'accesso per l'utente 'f.palumbo'. L'utente non è associato a una connessione SQL Server trusted.

If I try with this string "localhost:1433/flavio" I get this message :

com.microsoft.sqlserver.jdbc.SQLServerException: Il numero di porta 1433/flavio non è valido.

So I'm getting crazy to find out a solution ... can somebody help me?

Thanks a lot

Flavio

The first error says that f.palumbo user is not associated with a trusted user. Are you sure you have added the user using the sql express surface administrator to the server. The second syntax you are using is invalid. You cant do localhost:1433/flavio to get to the database flavio.

|||

Also, to troubleshoot express issues you may look at here:

http://blogs.msdn.com/sql_protocols/archive/2006/03/23/558651.aspx

|||

Hi thanks for your reply,

but about your "Are you sure you have added the user using the sql express surface administrator to the server" the answer is "no I'm not sure at all".

Sorry, I'm sure a newbie, but I cannot find a user administration tool in the place you say ; can you please give a more detailed path to do this work ?

Thanks a lot

Flavio

cannot connect with JDBC to express 2005

Hi all,

I try to connect with a java application to a freshly download SQL server express 2005, but I cannot anything I do.

If I try with the following string "10.0.0.82:1433;databaseName=flavio;user=f.palumbo;" I get this message :

java.sql.SQLException: Impossibile eseguire l'accesso per l'utente 'f.palumbo'. L'utente non è associato a una connessione SQL Server trusted.

If I try with this string "localhost:1433/flavio" I get this message :

com.microsoft.sqlserver.jdbc.SQLServerException: Il numero di porta 1433/flavio non è valido.

So I'm getting crazy to find out a solution ... can somebody help me?

Thanks a lot

Flavio

The first error says that f.palumbo user is not associated with a trusted user. Are you sure you have added the user using the sql express surface administrator to the server. The second syntax you are using is invalid. You cant do localhost:1433/flavio to get to the database flavio.

|||

Also, to troubleshoot express issues you may look at here:

http://blogs.msdn.com/sql_protocols/archive/2006/03/23/558651.aspx

|||

Hi thanks for your reply,

but about your "Are you sure you have added the user using the sql express surface administrator to the server" the answer is "no I'm not sure at all".

Sorry, I'm sure a newbie, but I cannot find a user administration tool in the place you say ; can you please give a more detailed path to do this work ?

Thanks a lot

Flavio

Cannot connect w/ Java app but can connect w/ .Net app - SQL Server Express 2005

I'm having a problem connecting with a Java application but I CAN connect using my .Net application - the user name and password are the same for both (using the same database on SQL Server Express 2005).

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>
<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