Announcement and Discussions related to the Microsoft JDBC driver for SQL Server
Unsure of what to specify in the connection URL? Having trouble configuring the driver for Integrated Authentication? Confused about some behavior with the Microsoft SQL Server JDBC driver? Then, this is the blog site for you.
The SQL Server JDBC team maintains this blog. The team is responsible for all things regarding JDBC with SQL Server. We hope to use this blog to proactively provide answers to many of the re-occuring issues that we see our customers face. We will also use this blog to provide some insight into features in planning for future releases.
Hopefully you will find this useful.
SQL Server JDBC teamDisclaimer: This posting is provided "AS IS" with no warranties, and confers no rights
I use JSQLConnection to connect to sqlserver2000 with this code:
connectionURL = "jdbc:JSQLConnect://COMPUTER1/database=ee/user=hadi/password=hadi";
Connection connection = DriverManager.getConnection(connectionURL);
but i recieved an exeption:
description The server encountered an internal error () that prevented it from fulfilling this request.
org.apache.jasper.JasperException: Exception in JSP: /ExampleJSP.jsp:73
71: // Make the DBMS connection
73: Connection connection = DriverManager.getConnection(connectionURL);
75: // Make the statement
javax.servlet.ServletException: com.jnetdirect.jsql.JSQLException: Failed Logon:com.jnetdirect.jsql.JSQLException: TCP/IP connection failed to host:COMPUTER1 java.net.ConnectException: Connection refused: connect url:jdbc:JSQLConnect://COMPUTER1/database=ee/user=hadi/password=hadi
if my username or password or servername is incorrect how can i find them in my data base.
I use tomcat5.5
Sounds like you have a generic TCP connection failure issue. Please take a look at the following blog posting (http://blogs.msdn.com/sql_protocols/archive/2007/07/19/tcp-provider-no-connection-could-be-made-because-the-target-machine-actively-refused-it.aspx). The concept applies to both SQL Server 2000 and SQL Server 2005.
We are not experienced with the JSQLConnection driver you are using so I recommend that you ask the appropriate community for additional help.
Regarding looking up the user and password information, I would recommend asking the DBA who created the database and user.
pls i just came across this site and I am trying to connect to sql server 2k5 developer edition from cold fusion and i kep having this error
Connection verification failed for data source: AdventureWorks
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'ColdFusionLogin'. The user is not associated with a trusted SQL Server connection.
The root cause was that: com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'ColdFusionLogin'. The user is not associated with a trusted SQL Server connection.
Also while trying to connect to sql server 2k5 from eclipse, i had almost the same error
om.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'EclipseLogin'. The user is not associated with a trusted SQL Server connection.
at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSParser.parse(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(Unknown Source)
at com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.loginWithoutFailover(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnectionInternal(Unknown Source)
at com.microsoft.sqlserver.jdbc.SQLServerDataSource.getConnection(Unknown Source)
I have already configured a logn id on the server for EclipseLogin using sqlserverauthentication mode and added the jar file to the classpath on eclipse
any ideas on what to do?
The scenario in your first posting, did you verify that the AdventureWorks database is installed on the SQL Server instance you are trying to connect to?
The scenario in your second posting, please verify that the SQL Server instance you are trying to connect to supports SQL Server user credentials. One way to verify is to use the SQL Server Management Studio application that comes with SQL Server to see if that works with the same user credentials. You can also use Management Studio to manage the security configuration of SQL Server.
If you would like to use SQL Server user credentials, please make sure SQL Server is configured correctly and the "integratedSecurity" property is set to 'false' or left as default of 'false'.
I can successfully use the integrated security feature to connect to my MSSQL 2005 database via a generic class, but if i attempt to use the same connection code the connection fails.
When running the generic class it passes in the user credentials(the ones I pass into the function) just fine by when I attempt to use the same code in Tomcat it tries to use the Account on the server that running tomcat. Is there any way to force the jdbc driver to use the credentials supplied instead of the servers credentials.
There is no way currently in the driver to provide Windows credentials to authenticate the user to SQL Server. Is not possible for you to run the Tomcat instance under a Windows user who has access to SQLServer?
Thank you for the quick response
That would be possible but that makes things odd on a security standpoint. I will give you my scenario. I am a software developer in an organization large enough that I do not have to manage the Tomcat Server or MSSQL Server. The DBAs are asking that we use AD authentication instead of the SQL authentication to access the SQL server.To make this happen I need to use the integerated security feature of the JDBC driver. This works but leads to this issue. The Tomcat Instance would need to be able to run multiple application all of which would need to use the MSSQL database. Security would not want us to use the same service account to access all the databases; which, if we ran the tomcat instance as the ad user with the ability to connect to mssql it would use the same ad user for all connections.
Thanks for pointing this out to me. Is there any MS documentation on not being able to provide the windows credentials so I can show my server admins / security / manager.
My application used JDBC driver to validate the MS SQL server login.
->Currently it uses SQL Server Authentication
->I wanted to have my applicataion use Windows Authentication. Hence, added IntegratedSecurity=true to the connection URL.
->But DriverManager.getConnection(args,pro) errors like this
[MyApplication][SQLServer JDBC Driver][SQLServer]Login failed for user'(null)'. Reason: Not associated with a trusted SQL Server connection.
Thanks in advance
How to test whether my sql std 2005 server can be connected thru SSL? Every connection is working but connecting thru jdbc fails with
"Connection string: jdbc:sqlserver://serverbame\user/pwd.
driver could not establish a secure connection to sql server using ssl.
TDS proto stream is not valid.
JDBC 1.2 installed.
Sudeep your issue may be that the computer/server that your are running the jdbc application on and the computer/server that the MSSQL server is on are on different domains. I ran into the same issue when the client and server were not on the same server.
Sorry "I ran into the same issue when the client and server were not on the same DOMAIN"
Hello. I'm running SQL Server 2005 and have a named instance. I have enabled TCP/IP for the instance, and in IPall it lists a dynamic port of 1522. That's fine, but I don't know what to list for the host. Username and password are separate properies. My script for the connection is:
<property name="url" value="jdbc:sqlserver://Localhost:1522;databaseName=TestDB;"/>
Instead of Localhost, do I enable IP1 in Confirguration Manager and use the IP Address from that? Do I use the computer name? Instance name? I'm just not sure how to define the host.
Thanks very much,
Can i Use database as a Microsoft Access in hernate.
if any body know please help me what that approch
I saw that there is a way to embed a failover address into a connection string as shown below:
"Data Source=SQLA\INST1;Failover Partner=SQLB\INST1;Initial Catalog=DBMTest;Integrated Security=True"
Can I do this for a connection from an application running in a Java environment under Tomcat? (Please say yes!!!)