Database Connection Problem with MS SQL Database: JDBC-ODBC Driver from JSP

时间秒杀一切 提交于 2019-12-12 01:57:29

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/2967256/database-connection-problem-with-ms-sql-database-jdbc-odbc-driver-from-jsp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!