I have made a project using Entity Framework in Visual Studio. I have following connection string
<connectionStrings>
<add name="HospitalManagementEntities" connectionString="metadata=res://*/HospitalEntities.csdl|res://*/HospitalEntities.ssdl|res://*/HospitalEntities.msl;provider=System.Data.SqlClient;provider connection string="data source=.;initial catalog=HospitalManagement;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />
<add name="HospitalManagementContext" connectionString="metadata=res://*/HospitalManagement.csdl|res://*/HospitalManagement.ssdl|res://*/HospitalManagement.msl;provider=System.Data.SqlClient;provider connection string="data source=.;initial catalog=HospitalManagement;integrated security=True;multipleactiveresultsets=True;application name=EntityFramework"" providerName="System.Data.EntityClient" />
</connectionStrings>
It connects with the mssql.
But when I try to connect with same database from Java - Hibernate/Spring it gives me error.
UDP Connection String
<bean id="dataSourceMain"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="url" value="jdbc:sqlserver://localhost\SQLEXPRESS;databaseName=HospitalManagement;integratedSecurity=true;Trusted_Connection=yes;" />
</bean>
Error
Could not obtain connection to query metadata : The connection to the host localhost, named instance sqlexpress failed. Error: "java.net.SocketTimeoutException: Receive timed out". Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434. For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host.
TCP Connection String
<bean id="dataSourceMain"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="url" value="jdbc:sqlserver://localhost;databaseName=HospitalManagement;integratedSecurity=true;Trusted_Connection=yes;" />
</bean>
Error
Could not obtain connection to query metadata : The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
Ports Info
Netstat
Questions
As you can see that both udp and tcp ports are blocked/inactive.
1) So how Visual Studio managed to get connected to MSSQL ?
2) What protocol does Entity framework uses in above case ?
3) Is there a way to connect to Mssql in Java - Hibernate/Spring, bypassing the firewall or udp/tcp requirements ?
P.S. I have no admin rights. So for now I can't enable TCP/IP port.