views:

271

answers:

1

I'm using Netbeans 6.8 to develop application using JSP. I'm able to work with it properly in my project guides system. But i'm unable to get the connection to database from my system.

It shows error unable to connect.

I have not changed any of the codes. How can I fix this error?

A: 

This can have one or more of the following causes:

  1. IP address or hostname in JDBC URL is wrong.
  2. Hostname in JDBC URL is not recognized by local DNS server.
  3. Port number is missing or wrong in JDBC URL.
  4. DB server is down.
  5. DB server doesn't accept TCP/IP connections.
  6. DB server has run out of connections.
  7. Something in between Java and DB is blocking connections, e.g. a firewall or proxy.

To solve the one or the other, follow the following advices:

  1. Verify and test it using ping.
  2. Refresh DNS server or use IP address instead in JDBC URL.
  3. Verify it in the DB configuration.
  4. Start the DB.
  5. Verify it in the DB configuration.
  6. Restart the DB and fix your code accordingly that it closes connections in finally.
  7. Disable firewall and/or configure firewall/proxy to allow/forward the port.

That said, the JDBC-ODBC bridge driver is a poor choice for SQL Server. Rather use its own JDBC driver or the much more performant and robust jTDS driver.

BalusC
Thanks bro.let me try with TDS or so.
Mr.K