Skip to content Skip to sidebar Skip to footer

The Connection To The Host Server Failed. Java

I'm trying to run a query but I keep getting this error: The connection to the host server=localhost, named instance sqlexpress failed. Error: 'java.net.UnknownHostException: serve

Solution 1:

There is one interesting site at http://msdn.microsoft.com/en-us/library/ms378428%28v=sql.90%29.aspx

Based on this, i think connect URL should be:

jdbc:sqlserver://Owner-PC;instanceName=SQLEXPRESS;DatabaseName=myDatabase;

Solution 2:

Per the answer for Connecting to SQL Server 2008 from Java by Venkatesh:

Try following connection,

 String Connectionurl="jdbc:sqlserver://localhost:1433;DatabaseName=myDatabase"

Post a Comment for "The Connection To The Host Server Failed. Java"