.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

JDBC Driver - is the connection to DB encrypted?

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :

I'm using the JDBC4 driver.  As with most Java DB connections you create a connection URL similar to:

jdbc://myDatabaseServer user=jimmy; password=foobarbaz

My question is: is this login data transmitted to the SQL server in a secure manner when using the Microsoft JDBC4 driver?






View Complete Post

More Related Resource Links

How can I improve the performance of batch inserts with the JDBC driver?

In our testing, batch inserts are more than 4 times faster on Oracle with the Oracle JDBC driver than on SQL Server with either the Microsoft or jTDS JDBC drivers on the same hardware.  The issue appears to be with the JDBC driver, not the database server.  We have run tests with SQL Server 2005/2008 on a number of machines with similar results. The following code shows a simplified example of the code we are executing.  It uses a 2 column table which has an index on the id column.  In the test program we are inserting 100k rows with a batch size of 10k.  Any suggestions on improving the performance with the SQL Server JDBC driver?   private void testBatchInserts(Connection conn, int rows, int batchSize) throws SQLException {     String sql = "INSERT INTO Bench (id, name) VALUES (?, ?)";     conn.setAutoCommit(false);     PreparedStatement stmt = conn.prepareStatement(sql);     int batchCount = 0;     // For each row...     for (int i = 1; i <= rows; i++) {       // Create the record       stmt.setInt(1, i);       stmt.setString(2, "ROW #" + i);       // Add it to the batch       stmt.addBatch(); &nb

How do I install SQL Server 2005 JDBC driver

I'm an new bie to "SQL Server 2005 JDBC Driver". I have downloaded SQL Server 2005 JDBC driver and extracted it to C:\Program Files\Microsoft SQL Server 2005 JDBC Driver\. Is the installation complete now? How can I use this driver from my application? If there is a step-by-step instruction on whether we need to run some scripts in SQL Server or to configure some system variables, it would be great. Thanks in advance for your time in this.Cheeeeerrzzzz! S@kthi http://blogs.msdn.com/sqlsakthi | http://twitter.com/PowerSakthi Mark as Answer if it helps. This posting is provided "AS IS" with no warranties and confers no rights.

SQL Server JDBC Driver 1.2 Issue

I am using JDBC 1.2 driver to connect to Sql Server 2005 database and i am facing the application crash issues several times and javacores shows that the crash happens during JDBC call. This issue is happening several times in our application, please let me know if an upgraded driver version will fix the problem or to investigate the driver issue further NULL            1XMCURTHDINFO  Current Thread Details NULL           ---------------------- 3XMTHREADINFO      "WebContainer : 8" (TID:0x5946E100, sys_thread_t:0x51D052F0, state:R, native ID:0x000008AC) prio=5 4XESTACKTRACE          at com/microsoft/sqlserver/jdbc/PLPInputStream.getBytes(Bytecode PC:64(Compiled Code)) 4XESTACKTRACE          at com/microsoft/sqlserver/jdbc/DDC.xmlPLPToObject(Bytecode PC:132(Compiled Code)) 4XESTACKTRACE          at com/microsoft/sqlserver/jdbc/ServerDTVImpl.getValue(Bytecode PC:216(Compiled Code)) 4XESTACKTRACE          at com/microsoft/sqlserver/jdbc/DTV.getValue(Bytecode PC:216(Compiled Code)) 4XESTACKTRACE          at com/micro

Microsoft SQL Server 2005 JDBC Driver

I'm getting the following exception when attempting to connect to SQL Server 2005 using Microsoft's new JDBC driver: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host  has failed. java.net.ConnectException: Connection refused: connect The help docs suggest checking connectivity using telnet. So attempting to connect via telnet to generates: Could not open connection to the host, on port 23: Connect failed. So I try to start telnet: net start telnet I get the following error message: The service cannot be started either because it is disabled or because it has no enables devices associated with it. Can anyone help? Thanks

Why SQL accepts both encrypted connection and non-encrypted connections when force encryption option

I have installed a certificate and have set force encryption to yes under the flags' tab of protocols' window as well as SQLnative client configuration properties but SQL Server accepts both encrypted connection and non-encrypted connections,why?(i have checked the encrypt connection of the connection properties of connect to server window). also when i run profiler, it can capture both T-SQL statements which has run against encrypted and non-encrypted connection and i expect the profiler should not be able to get the encrypted connection's T-SQL statement,am I right or something is wrong with my  configurations?--yousef

Microsoft JDBC driver 3.0

Our application used Inet opta driver. Would like to try out the Microsoft driver. If you have used this driver, please provide more info on Microsoft jdbc driver 3.0.

SQL JDBC Connection timed out, please help, I am in urgent

Hi there, i am working on SQL JDBC 2005 version 1.1. I have a liferay portal database located at server 1, wsrp portlets' database located at server 2 (with instance name instance1). The producer (liferay) have to create a connection with server 2 (use connection string) to authenticate the consumer. If the registration properties is valid, then the consumer are able to consume the wsrp portlet. (Note that i use tomcat as web container)But when the producer connect to server 2, tomcat throws error:com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host  has failed. java.net.ConnectException: Connection timed out: connect    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(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.SQLServerDriver.connect(Unknown Source)    at java.sql.DriverManager.getConnection(DriverManager.java:525)    at java.sql.DriverManager.getConnection(DriverManager.java:193)     at   com.mypackage.utils.DBUtils.getDBConnection(DBUtils.java:45)My connection string pattern is : "jdbcqlserver://{0}:{1};User={2};Password={3};DatabaseName={4}"Which {0}: s

JDBC connection to SQLserver failing with ERROR [JDBCExceptionReporter] The connection is closed.

SQL server version: MS 2005 9.00.3050.00 Std edition Development version is on a stand alone server. Production is on an active/active cluster. Full error message below. There is an explanation and solution as noted below. However we do not see this issue in all our environments. Can anyone tell me why we see this issue in our production environment but not on our development environment, especially as the issue seems to arise following low usage times. Explanation / Solution If you are using the v1.2 driver, and you can positively rule out transient network connectivity issues and multithreaded usage, the next most common cause I am aware of is where a connection pool is being used and the pooling manager (e.g. DBCP or C3PO) does not test pooled connections for validity before handing them out to the app. What happens in this case is connections that sit idle in the pool for a very long time get closed by the TCP/IP stack, routing hardware, etc. Then they're already dead when the pooling manager hands them out. The solution is to configure the pooling manager to validate connections before handing them out, typically using a validation query like "SELECT 1". Error Message INFO | jvm 1 | 2010/09/07 07:52:11 | [09.07 07:52:11.396] LOG ERROR BROKO-EY-TBF-REDUCED-ENV-DP> INFO | jvm 1 | 2010/09/07 07:52:11 | - broko.quark.QueueMonitorThread.getNextCommand(QueueM

Recommend the best JDBC driver and version to connect to SQL server 2005 sp2


SQL version details:Microsoft SQL Server 2005 - 9.00.3050.00 (Intel X86) Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2) on a clustered server.

Are there any issues using:

JDBC driver: Microsoft SQL Server JDBC Driver 3.0.
JBOSS: JBoss 4.2.3 with JDK 6 ?

Issue with Registering to Redistribute SQL JDBC Driver


At the link http://msdn.microsoft.com/en-us/sqlserver/aa937725.aspx -  Register for Microsoft SQL Server JDBC Driver Redistribution Rights.

It appears that you can register to redistribute the SQL jdbc.jar.  Yet, when you click the I Accept -- you get a "broken link" or 404.    I registered with the Site Feedback for the SQL server site.   Anyone done this in the past or know if Microsoft still supports this?


JDBC Connection using Dynamic Ports


I have a sql cluster running 3 instances.One of the user is trying to connect to these instances using JDBC connectivity.We have configured to use Dynamic ports so the url with the default port is not working for us and I cannot change the port.Can you please plese let me know the URL for this.Also on the Surface Area Configuration Manager I sec Client Protocols ,How is this different from the Protocols for each instance.




MSSQL 2005 JDBC driver multiple select statements in stored procedure



we have a stored procedure with multiple select in it.



Select a,b,c from table1

Select f,g,h  from table2

Select j,k,l  from table3


Sometimes select no 2 will not return any values.

when this happens  we get only 2 result sets using CallableStatement getMoreResults method. 

it seems that if a select  doesn't return something it will  not have a corresponding resultset. 

On 2000 (driver + server) version we got an empty resultset for this situation. 

Is there  any  way to have the same behaivor with 2005 ?   We tryed with 1.2 and 2.0 jdbc driver.




JDBC 3.0 Driver Permanently Locks Table

I am using the JDBC driver to insert data into a SQL Server Express database. The JDBC driver running in a Tomcat servlet completes the insert with no exception. However, subsequent actions using the Microsoft SQL Server Management Studio on the table just operated on by the JDBC driver all timeout. The only recovery option is to restart SQL Server. Operations on other tables in the same database are unaffected.

JDBC 3.0 Driver Permanently Locks Table

I am using the JDBC driver to insert data into a SQL Server Express database. The JDBC driver running in a Tomcat servlet completes the insert with no exception. However, subsequent actions using the Microsoft SQL Server Management Studio on the table just operated on by the JDBC driver all timeout. The only recovery option is to restart SQL Server. Operations on other tables in the same database are unaffected.

Websphere with Microsoft SQL JDBC Driver 2.0 eats up CPU when StaleConnection is encountered


Here's what happened

1. SQL Server started as a service

2. Websphere (with JDBC Data Source utilizing MSSQL JDBC Driver) is started via startserver.bat

3. I ran my application a few times (which accesses the database)

4. I restart the MSSQL Service

5. I click on a button that attempts to query the database

6. CPU utilization of websphere shoots up and doesn't return to 0 (unless you restart websphere)


To investigate I isolated the DataSource and Connection object generation in a Serverside script and that seems to work fine but when you put them inside Stateless, Container Managed Session Beans then it sort of goes into limbo.  Weird thing is that the same code, when using DataDirect, works well.

However, since it seems like DataDirect is not packaged with websphere anymore, Im left with no option but to use MSSQL JDBC Driver.  Any thoughts on how I can reclaim those CPU resources?  Unfortunately, a try catch doesnt help since program hangs when it executes Connection.execute() - meaning it doesn't reach the catch part

Sql 2008 peer-to-peer replication and jdbc driver


Hi, sorry but i'm a sql dummy...:-)

I setup a sql 2008 p2p replication for a database.

Can i specify, on a jbdc connection string, the path of the 2 sql server for automatic failover?

I try failoverPartner variable, but this is only for database mirroring.....

Can u help me?

Thanks in advance


Conversion error in the JDBC 3.0 driver when accessing metadata


I am using SQL Server 2008 R2 and the SQL Server JDBC driver 3.0.1301.101.

When reading meta data for a table I get the following SQLServerException on column 22 (SOURCE_DATA_TYPE)

The conversion from char to SMALLINT is unsupported.

The following code demonstates the problem.

import java.sql.*;
import com.microsoft.sqlserver.jdbc.SQLServerDataSource;

public class SQLJDBCTest {

 public static void main(String[] args) {
  SQLServerDataSource ds = new SQLServerDataSource();

  Connection cn = null;
  ResultSet rs = null;
  try {
   cn = ds.getConnection();
   rs = cn.getMetaData().getColumns("Archive25", "dbo", "CountryCode", null);
   if(rs != null) {
    ResultSetMetaData rsm = rs.getMetaData();
    while(rs.next()) {
     for(int i = 1; i <= rsm.getColumnCount(); ++i) {
      String cname = rsm.getColumnName(i);
      Object obj = rs.getObject(i);
      System.out.println(cname + " " +obj);
  }catch(Exception ex) {


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend