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
Glad to see this. I would like to use JPA (Java Persistence API from Hibernate) with SQL Server Express edition. Wondering if you guys can provide any information with regard to this.
We are a hibernate ceritified driver. YOu should use SQLServerDialect in the configuration see: http://www.hibernate.org/hib_docs/v3/reference/en/html/session-configuration.html
Let me know if there is anything specific you want to know.
I have a password protected database. How can I connect to it via JDBC? In what connection parameter I must send database password?
Before we can answer your question, we need to know which SQL Server Edition you are using. Could you please clarify?
I've been trying to configure Tomcat 6.0 to use the SQL Server 2005 JDBC Driver to access SQL Server 2005 through a jndi provided DataSource.
I am converting from programmatic creation of a Connection to using a DataSource to obtain a Connection.
I'm using the following per web application WEB-INF\context.xml:
<Context path="/eclipse" docBase="eclipse" debug="5" reloadable="true" crossContext="true">
and the following WEB-INF\web.xml fragment
When i execute something like the following code,
ctx = new InitialContext();
object = ctx.lookup("java:comp/env/jdbc");
I get the following STDOUT log message
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
Can you tell me how to configure Tomcat to allow servlets and JSP pages to access SQL Server? This has been somewhat frustrating.
Hello. I'm developing my application in Sun Java Studio Creator and Sun AppServer 8.2. I have this application that uploads pdf files to the database. With SQLServer 2000 it works, but now I'm using the same application to upload files to SQLServer 2005 and it doesn't work. Is there any property or something else that I must set in the database in order to do this? Thanks in advance.
Sorry, I forgot to mention in my previous post that I'm using the latest JDBC driver (sqljdbc.jar v1.2.2727).
The issue I believe you are hitting is your Context is not complete. I've seen this done one of two ways:
1. Grab the environment first, and then grab the datasource
// Grab the Environment first
object = ctx.lookup("java:comp/env");
// Now grab the DataSource
DataSource ds = (DataSource)ctx.lookup("jdbc/orpsMirror");
2. Grab the DataSource from the get go
// Grab the DataSource with the full path from the Environment
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/orpsMirror");
I believe yours was failing because it was just looking for an element called "jdbc" which didn't exist.
Hope that helps!
Correction to the first code segment I posted. It should be:
Context envCtx = (Context)ctx.lookup("java:comp/env");
DataSource ds = (DataSource)envCtx.lookup("jdbc/orpsMirror");
We are evaluating JDBC v1.2 and found out there is different with getBytes Method (SQLServerResultSet) call getBytes Method (SQLServerResultSet)
this is output when I tried two drivers:
using JDBC v1.1
Timestamp from DB is: 2007-10-26 12:45:45.9
byte array is:
0 is -45
1 is -103
2 is 0
3 is 0
4 is -38
5 is 82
6 is -46
7 is 0
using JDBC v1.2
Timestamp from DB is: 2007-10-26 12:44:42.04
0 is 0
1 is 0
2 is -103
3 is -45
4 is 0
5 is -46
6 is 8
7 is 4
you can see first 4 elements values have been changed (with different order). can someone provide more information about this? Thanks.
Hola actualice el sqljdbc 1.1 por la vesion 1.2 y al ejecutar cualquier consulta me da este error com.microsoft.sqlserver.jdbc.SQLServerException: La instrucción no devolvió un conjunto de resultados.
Si me pudieran ayudar con esto... Gracias
Can you provide a sample that is failing?
¿Puede usted proporcionar una muestra que falla?
I'm using Tomcat 5.5, J2SDK 1.4 and I want to access my db at MS SQL Server 2000. I'm getting error as
"Following error/exception occured - java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unsupported method: ResultSet.isAfterLast at"
Following error/exception occured - java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Unsupported method: ResultSet.setFetchDirection at
Can you try the SQL 2005 JDBC Driver, this supports SQL 2000 server as well.
Does anyone know if it is possible through JDBC connection to have the loginto SQL server automatically authenticate through AD(Active Directory - windows login, instead of entering a user name and password.) similar to single sign on.
If possbile, how? Can anyone direct me to any documentations, etc?