Search code examples
javasql-serverubuntujtds

Connect MS SQL database from Java in ubuntu environment


I am using ubuntu 12.04 and wanted to connect to the MS SQL server database which is hosted in the same network. I was able to connect this using Squirrel , yet unable to connect from a java program. These are the tools I and .jars I am using . Intellij Idea is the tool jar are jtds-1.3.1.jar and sqljdbc4.jar Java version 1.7

I am hoping to develop a web application in the Ubuntu Environment , yet my database will be in Ms Sql windows table. Is this feasible ? Please intruct me step by step , and sample code to connect ms sql database which s hosted ina wondows environment

Rashen


Solution

  • It does not change anything that your DB is hosted on Linux / Windows, as long as you can access it through your network.

    There is a post where you can see how to connect to your DB from Java using jTDS: Connect to SQL Server 2012 using jTDs

    If it does not solve your problem, can you give us your exact error message?