Advertisement
xlrnxnlx

non-important

May 23rd, 2014
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. public String selectCategoryByID( int id ){
  2.     String name = "";
  3.     synchronized( this ){
  4.         if( connect() ){
  5.             try {
  6.                 state = con.prepareStatement("select * from airplanecategory where id = ?");
  7.                 state.setInt(1, id);
  8.                 result = state.executeQuery();
  9.                
  10.                 while( result.next() )
  11.                     name = result.getString( "genre" );
  12.             } catch( SQLException e ){
  13.                 throw new DataAccessException("");  
  14.             } finally {
  15.                 disconnect();
  16.             }
  17.         }
  18.     }
  19.     return name;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement