fulhamHead
fulhamHead

Reputation: 687

Accessing a .mdf SQL Server file using JDBC in Java?

I am trying to access and read data from a .mdf Microsoft SQL Server file (located on a remote server) inside a Java application running locally.

I have a SQL Server JDBC driver installed and it's on my classpath but I still cannot seem to access the file, I get the following error:

The connection to the host PD-SQLTEST, named instance sqlexpress failed.
Error: "java.net.SocketTimeoutException: Receive timed out"

I am defining the connection URL as follows:

String URLSqlServer ="jdbc:sqlserver://PD-SQLTEST\\SQLEXPRESS; databaseName=AOMLive";

The .mdf is called AOMLive.mdf

Any ideas what I am doing wrong here? Does the SQL Server Database on the remote server have to be running for me to access?

Upvotes: 1

Views: 1410

Answers (1)

John Coleman
John Coleman

Reputation: 51

You must have the SQL Server running; JDBC cannot read that file directly.

Upvotes: 5

Related Questions