java - Why doesn't SQLException extends IOException? -


as client, when "bad" happens input / output of program, i/o exception should thrown. when i'm connected server, program has input-output-relationship client said server. therefore, when on communication doesn't work (something "bad"), resulting exception should ioexception, i.e. sqlexception should extend ioexception.

why not case?

because sqlexception not related io.

for example if write bad sql command have sqlexception.

here non exhaustive list of possible sqlexceptions not related io:

  • bad sql grammar
  • wrong attribute numbers
  • wrong attribute types
  • constraint violation
  • privilege problems
  • duplicate primary keys
  • not existing table or column names

from javadoc:

an exception provides information on database access error or other errors.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -