>-----Original Message-----
>From: RAHUL RAJ [mailto:omrahulraj...@gmail.com]
>Subject: Re: Working of Tomcat with MS Access
>
>Yes, it runs as a service. But how to know under what account does that
>service run? does it mean 'admin' or 'normal user' or 'system'?
>I made a system DSN for this...not the user DSN(Data Source Name)
>and I launched tomcat service by right click 'run as admin'

I'm really surprised you have had as many responses to this thread as you've 
had.

Assuming you have Tomcat installed as a Windows service, usually the default 
account that runs Tomcat as a Windows service is "Local System Account".  You 
need to change that account to one that has access to your mdb.  You can do 
that through the Services console.  Or try starting Tomcat via the startup.bat 
file, that should launch Tomcat with the same account you've logged into your 
system with, which hopefully is the same account you need to for "Access".

The code you posted should work, although I can't understand what the purpose 
of your assignment is.  Don't get in the habit of using this code for anything 
related to logging in, or anything else.

If you must stay in the MS world, use SQL Express.

try {
        Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver");
        Connection con = DriverManager.getConnection("jdbc:odbc:rahul","","");

      Statement stmt = 
con.createStatement(ResultSet.TYPE_FORWARD_ONLY,ResultSet.CONCUR_READ_ONLY);
      String query = "Select whatever";

      ResultSet rs = stmt.executeQuery(query);

      while(rs.next()){
          // do stuff
        }
        rs.close();
      stmt.close();
      con.close();
    } catch(SQLException ex) {

    } catch(java.lang.ClassNotFoundException jdbce) {

    }

Reply via email to