Troubleshooting

Using JDBC

Q1:Why does the DriverManager tell me that no suitable driver exists?
This usually happens for one of three reasons:
  • You mistyped the JDBC URL and the driver manager doesn't recognize the database type.

  • You didnt load the JDBC driver class with Class.forName, and you didn't add it to the jdbc.drivers system property.

  • The driver class isn't in the classpath.

Q2:My driver is in the classpath; why can't I connect to the database?
Your database URL may be incorrect, or you may be using the wrong driver.
Q3:Why do I get errors saying I can't allocate any more database statements after my program has been running for a few minutes?
If you don't explicitly close your Statement objects, they don't get closed until the garbage collector ...

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.