Bharath R
Bharath R

Reputation: 1531

Unable to get SQL Server connection object

I wrote a simple code to connect to SQL Server database and to does a simple select statement, this code runs successfully on my local machine over VPN but when I deploy the same code in the servers, then my code is stopping at getting the DB connection object.

It is not even throwing any timeout exception, so I thought of a port issue and checked using telnet which is successful. Can anyone please suggest why this might happen? I am able to get connection object of the same DB from my local machine over VPN.

        Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
        String connectionUrl = props.getProperty("DBURI");
        Connection conn=null;
        System.out.println(connectionUrl.trim());
        conn = DriverManager.getConnection(connectionUrl.trim());

Upvotes: 0

Views: 164

Answers (1)

Bharath R
Bharath R

Reputation: 1531

Problem with the sqljdbc jar file , Used any 32 bit one , After replacing the jar , everything worked fine. Thanks

Upvotes: 1

Related Questions