Hi, i have got this assignment to to which is due in like 3 days, m in high school so n0t so clued up. My asssignment is to create a database with MS Access, n to create a jdbc-odbc link so that the user can extract the data from the database, and request queries on it. my project is done to the extent that i have xtracted the data into a vector(Just learnt it so i use it alot). I would like to use my current class, LMS, as just a class to extract the data. the help i need is how to create and link other classes to it. my database holds information on stock records, and the queries that i want the user to have available is the geneal description of an item of a certain user inputted stock code, its price, expiry date, and quantity left. i also think i should create a transaction class to insert/delete stuff in the database, when stock is sold/bought..i dunno how to use the code tags, but here oes, my code will be in the next post, any ideas or simpler methods??help pls

import java.sql.*;

    public class LMS
   {
       public static boolean loadODBC()
      {
      
         try
         {
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            System.out.println("Connected\n");
            return true;
         }
             catch (Exception e)
            {
               System.out.println("Not Connected\n");
               return false;
            }
      }
   
   
       public static void main(String[]args)
      {
       
         String StockNum,ProdName,Description,Warehouse,ExpDate;
         int CostPrice;//declare
      
         Connection conn;
         Statement set;
         String sql;
         ResultSet rs;
      
         if(!loadODBC())
         {
            return;
         }
      
         try
         {
            
            conn=DriverManager.getConnection("jdbc:odbc:LMS","","");
            set=conn.createStatement();
            sql="SELECT*FROM StockTable";
            rs=set.executeQuery(sql);
         
            
         
            while(rs.next())
            {
               StockNum=rs.getString("Stock Num");
               ProdName=rs.getString("Name of Product");
               Description=rs.getString("Description");
               CostPrice=rs.getInt("Cost Price (per pack)");
               Warehouse=rs.getString("Warehouse");
               ExpDate=rs.getString("Date of Expiration");
            	
            }
         	
         }
             catch(Exception e)
            {
               System.out.println("error");//my program now catches this exception??howcome?
            }
         System.out.println("");
      	
      }
       private static String spaces(String s,int width)
      {
         String temp="";
         for(int i = 0;i<=width-s.length();i++)
         {
            temp=temp+" ";
         }
         return temp;
      }
   	
   }
This article has been dead for over six months. Start a new discussion instead.