共用方式為


JDBC to SQL Azure

Using the open source jTDS JDBC Driver, you can connect to SQL Azure.

 

Driver class name: net.sourceforge.jtds.jdbc.Driver

Database URL: jdbc:jtds:sqlserver:// <server>. database.windows.net:1433/ <databasename> ;ssl=require

Username: (in the form username@server from SQL Azure)

 

The key thing is the “ssl=require” placed at the end of the connection string. SQL Azure SSL encrypts the data on the wire, and requires SSL. Which is rather a good thing.

Hope this saves someone some time.

Comments

  • Anonymous
    July 20, 2010
    Thank you for those information, it helps me to start working with Azure from our open source bpm java product. Regards Olivier

  • Anonymous
    February 08, 2011
    So, is jTDS an officially supported JDBC Driver?

  • Anonymous
    February 09, 2011
    Try the more recent msdn.microsoft.com/.../aa937724

  • Anonymous
    August 16, 2012
    Thank you very much for this. It saved me lots of time. Much appreciated.

  • Anonymous
    January 23, 2013
    i am using jtds 1.2 .jar for SQL Azure getting error like this any solution java.lang.Exception: Connection failed with unspecified error. at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:109) at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:53) at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.open(JDBCConnection.java:72) at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnectionFactory.createConnection(JDBCConnectionFactory.java:53) at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83) at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:355) at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76) at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

  • Anonymous
    January 24, 2013
    @ganapathi : has the IP address you are attempting to connect from been added to the Permitted IP addresses in the Firewall rules (SQL Azure)

  • Anonymous
    June 02, 2013
    The comment has been removed

  • Anonymous
    June 02, 2013
    The comment has been removed

  • Anonymous
    June 03, 2013
    The comment has been removed

  • Anonymous
    June 04, 2013
    As I am not deeply involved in this as I once was, I suggest popping over to msdn.microsoft.com/.../gg715284.aspx or www.windowsazure.com/.../java

  • Anonymous
    August 11, 2014
    -Djsse.enableCBCProtection=false is needed too -- that did the trick for me. See stackoverflow.com/.../connecting-to-azure-sql-db-via-jtds-on-an-android-device