How to connect to MS Access from servlet uploaded in TOMCAT server

Hi,
I want to access MS Access from servlet .I use TOMCAT server.I want to know what should i do.How to get drivers and how to set class path for them.
Please help me in finding the solution
thanks and Regards

HI,
try this
<Code>
response.setContentType(CONTENT_TYPE);
     PrintWriter out = response.getWriter();
     java.sql.DatabaseMetaData dm = null;
     java.sql.ResultSet rs = null;
     try
          Class.forName("sun,jdbc.odbc.JdbcOdbcDriver");
          Connection con = java.sql.DriverManager.getConnection("jdbc:odbc:dsnName","","");
          dm = con.getMetaData();
          out.println("<html>");
          out.println("<head><title>Servlet1</title></head>");
          out.println("<body bgcolor=\"lightblue\">");
          if(con!=null){
               dm = con.getMetaData();
               out.println("<B><br>Driver Information</B>");
               out.println("\n\t<br><br>Driver Name: "+ dm.getDriverName());
               out.println("\n\t<br>Driver Version: "+ dm.getDriverVersion ());
               out.println("\n\t<br>Database Information ");
               out.println("\n\t<br>Database Name: "+ dm.getDatabaseProductName());
               out.println("\n\t<br>Database Version: "+ dm.getDatabaseProductVersion());
               out.println("\n\t<br><br>Avalilable Catalogs ");
               rs = dm.getCatalogs();
               while(rs.next()){
                         out.println("<br>\tcatalog: "+ rs.getString(1));
               out.println("\n\t<br><br>conURL =" + conURL);
               out.println("\n\t<br><br>Title = Database");
               rs.close();
               rs = null;
               con.close();
          }else {
               out.println("Error: No active Connection");
     }catch(ClassNotFoundException e) {
          out.println("Coudn't laod the database driver: " + e.getMessage());
     } catch(SQLException e) {     
          out.println("SQLException caught: " + e.getMessage());
          try {
               if (con != null)
                    con.close();
               if (rs != null)
                    rs.close();
          catch (SQLException ignored) {}
          finally {
               try {
                         if (con != null)
                              con.close();
                         if (rs != null)
                              rs.close();
                    catch (SQLException ignored) {}
</Code>
Sachin

Similar Messages

  • How to connect a database (Access)?

    can i know how to connect to MS ACCESS, the database file name is "account"
    I have column "name" with data "testing"
    and column "id" with data "123", can i know how to link the data and view it on JTextField?
    Thanks

    on Windows:
    Contr Panel->Admin Tools->Data Sources(ODBC)->System
    DNS tab->MS Access Driver, give it a name and use that
    name in ur code.
    <code>
    Class.forName(driverName);
    conn = DriverManager.getConnection(dbURL,"","");
    </code>
    i think the dbURL is
    'sun.jdbc.odbc.JdbcOdbcDriver'....Wrong. That's the name of the JDBC driver class.
    The URL is "jdbc:odbc:dsn", where dsn is the data source name you gave in the Control Panel.
    and i think standard
    SQL querying applies ... i haven't worked with access
    b4 so i am not sure...i would like to know the correct
    way...so keep me posted...
    good luck!If you stay away from M$ JET SQL and stick to ANSI SQL your code will be portable.

  • How to connect jsp & ms-access

    hi,
    i need to retrive data from database.how to connect jsp & ms-access.i m using weblogic8.1.

    hi,
    i need to retrive data from database.how to connect jsp & ms-access.i m using weblogic8.1.

  • How to connect to  Oracle database from webdynprojava application

    Hi
    How to connect to  Oracle database from webdynprojava application. where can we provide the code to connect to database.?
    Thank You.

    Hi,
    You need to create  Java Bean model. The bean is a typical java bean with default constructor, getter and setter. You can have additional methods for query etc. The attributes in the class will be your model node and attributes.
    However you need to configure the connection and create JNDI using visual administrator before writing the code.
    You can also consider writing Session EJB with oracle and using them in WD.
    http://help.sap.com/saphelp_nwce10/helpdata/en/45/dcaa4f05535591e10000000a1553f7/frameset.htm
    Srini

  • How to connect iseries green screen from java program

    how to connect iseries green screen from java program to get the data in the DB files ,here the DB is DB2/400

    Just some Friday fun. Use the telnet program that comes with Windows and supports VT escape sequences.
    import java.io.*;
    import java.net.*;
    public class AutoTelnet {
         private static Socket s;
         public static void main(String[] args) throws Exception {
              Thread t = new Thread() {
                   @Override public void run() {
                        try {
                             s = new ServerSocket(5555).accept();
                        } catch (IOException ex) {
                             ex.printStackTrace();
              t.start();
              Process p = new ProcessBuilder("cmd", "/C", "start", "telnet", "127.0.0.1", "5555").redirectErrorStream(true).start();
              t.join();
              PrintStream ps = new PrintStream(s.getOutputStream());
              ps.println("Screen will be cleared in 5 seconds");
              ps.println("5");
              Thread.sleep(1000);
              ps.println("4");
              Thread.sleep(1000);
              ps.println("3");
              Thread.sleep(1000);
              ps.println("2");
              Thread.sleep(1000);
              ps.println("1");
              Thread.sleep(1000);
              ps.println("\u001b[2J");
              Thread.sleep(5000);
    }

  • HT2534 How do I turn off access from the App Store to my credit card?

    How do I turn off access from App Store to my credit card?

    try follow those instructions
    http://support.apple.com/kb/ht1918

  • How to prevent a rdp user from mapping drives on the server ?

    Hi,
    User A from Domain A (using Win7 pro) is able to rdp to Server Z (Windows Server 2008) which is in Domain Z and is able to map drive.
    My question is : How do I prevent User A from mapping any drive in Server Z ?
    Please advise. TIA !

    Hi,
    if a user has access to the other share there is no way to prevent that user from mapping a drive.
    However, you can remove the "map Network drive" functionality via policy, please see
    http://msdn.microsoft.com/en-us/library/ms812045.aspx
    That does not prevent users from mapping  their drive manually using the "net use ..." command from a shell. While it is possible to restrict running of the net command, I do not recommend that (see
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/b5012142-cfe9-4b24-99b9-d7ff3b84f0f4/what-security-policy-blocks-use-of-the-net-command-for-nonadmin-users?forum=winserverGP).
    ( What you may consider when having Shares cross-forest, you can remove that authorized users permission from the share replacing it by DOMAIN\Domain users groups, etc. So access to the share is limited instead of using a share that a user has access to.
    Please Keep in mind that even when you remove the Network drives a user can still Access the resource via UNC. )
    Regards,
    Martin

  • Write Access to a file in Tomcat server via J2me Midlet

    How to make write access to a file using midlet and HTTP connection?
    I have text file in the Tomcat server and I am able to read it with HTTP connection using emulator, but don't have idea how to make write access to the file. I'd like to write some text to the file.

    Thanks, but could you be more accurate. What methods should I use in the servlet and what methods in the midlet?
    Some links which concern this subject, would be nice too. I have tried with google, no success.

  • How to connect to oracle ebs from an external software

    Hi!
    I want to develop an integration for oracle EBS. Therefor I'm looking for ways how to connect to the EBS and for a repository of functions which can be called from an external program. I'm not quite sure if this is the right place to ask but I could not find anything yet so I'm trying here.
    Are there any standard connectors for the EBS provided by Oracle?
    Thanks,
    Konrad

    Oracle Applications Architecture is a framework for multi-tiered, distributed computing that supports Oracle Applications products. In this model, various servers are distributed among multiple levels/tiers as follows:
    - The Desktop Tier --> Web browser with Jinitiator or Sun JRE
    - The Application Tier --> Web, Forms, Reports, Admin, and Concurrent servers
    - The Database Tier --> Oracle Enterprise Edition Database
    The Application tier is the layer which is responsible for:
    - Hosting the various servers that process the business logic
    - Managing communication between the desktop tier and the database tier
    So, in order to connect to the database, you can either access the application tier, or connect directly to the database. I do not think it is possible to communicate with the application services from some other application. Therefore, you would need to connect to the database directly which can be achieved as explained in my previous reply. There is no such API which can be used to open/close a database connection. Oracle E-Business Suite is just a database with number of schemas and objects which are tightly integrated.
    More details about Oracle E-Business Architecture can be found in:
    Oracle Applications Concepts
    http://download-uk.oracle.com/docs/cd/B25516_14/current/acrobat/11iconcepts.pdf

  • How to connect to oracle database from visual basic 2010 express edition

    I have installed visual basic 2010 express edition on windows xp. But visual basic 2010 express edition supports Microsoft sql server database file,Microsoft sql server compact 3.5, Microsoft access database file. I want to connect to oracle database from visual basic 2010 express edition. So what drivers are required and how to do connectivity?

    Hello,
    I wasn't clear on what you were using to make the connection. I had a look in Visual Studio 2010 (don't have express to test sorry).
    I think you mean the Data Sources available under the menu Data-> Datasources. this seems to match the description you give when I
    look at the list of datasource options.
    In here you can make ODBC connections via the Microsoft .net Data Provider .
    If you select ODBC as a datasource you can see listed the DSN's you created - for example I see 2 which use the Oracle ODBC driver.
    This assumes you installed an Oracle Client + the oracle version of the ODBC driver (comes with the oracle client).
    Once you created a server connection then you should see it in the server explorer.
    You can also download the Oracle Developer Tools for Visual Studio which is an add on for VS.
    ** I suspect this is only for VS 2010 and I didn't see that Express was supported.
    http://www.oracle.com/technetwork/developer-tools/visual-studio/overview/index-097110.html
    Let me know if that helps.
    John

  • How to connect two different tables from different server?

    Dear all expert,
    I need to develop a report where i need to connect 2 different tables from 2 different servers. For examples:
    BUT000 tables from CRM and KNKK from R3.
    Is it possible to do so? Because i try to link these 2 tables together and when i preview the report, it run very slow and sometime it hang. I did not get any result.
    Thank You.

    Moved to SAP Integration kit forum
    Appears you are using SAP data sources.
    And yes you can but the linked field types must match and be able to be converted into the WHERE portion of the SQL. Click on Database, Show SQL... and see if there is one. If not CR can't figure out how to so it brings all data client side and filters on the second pass.
    Thank you
    Don

  • How to call any .tmpl file from servlet by sending some parameters ?

    Hi,
    I am new to Java Servlet and HTML template language ( anyfile.tmpl).
    I have created simple login authentication with user registration for new user.
    If user already exists, after successful login, he should be navigated to INBOX page (that inbox page is some inbox.tmpl file) from SERVLET itself using following BOLD statements given in code below. But its not working.. :-( Please do the needful.
    Thank you.
    if (session == null) {
         try {
              userName = request.getParameter("login");
              pwd = request.getParameter("password");
              if (!userName.equals("") && !pwd.equals("")) {
              try {
    //Database connection, data fetching, query execution etc.
    // code will go here
                   while (rs.next()) {
                   if (userName.equals(rs.getString("username")) & pwd.equals(rs.getString("pwd"))) {
                        String u_name = userName;
                        String ph_no = (new Integer(rs.getInt("ph_no"))).toString();
                        String address = rs.getString("address");
                        session = request.getSession();
                        session.setAttribute("user", userName);
                        String inbox = context.getInitParameter(INBOX);
                        Template inboxTmpl = new Template(inbox);
    *                    inboxTmpl.setParam("userName", u_name);*
    *                    inboxTmpl.setParam("ph_no", ph_no);*
    *                    inboxTmpl.setParam("address", address);*
    *                    out.println(inboxTmpl.output());*
                        System.out.println("Login successful..");
                        break;
                   rs.close();
         pstmt.close();
    con.close();
    (P.S - I am forced to use HTML.TEMPLATE(i.e. .tmpl file) instead of JSP)}

    Where does Template come from?
    But its not working.The other day I called the car repair shop. I told them my car did not work and I wanted them to fix it. They asked what was wrong, whether it did not start, whether suspicious sounds were heard, whether the car did not want to brake any longer, whether it gave a smoke from the exhaustion, whether the wind shield was broken, whether the oil was leaking etc. But I insisted just telling them "it doesn't work".

  • How to connect to a Unix from Crystal Reports running on windows?

    <p>Any idea on how to connect from windows Crystal Reports X1 client to a Unix box
    file directoriesu2026<br>
    <br>
    Any suggestions would be much appreciatedu2026<br>
     </p>
    Edited by: DarkNight on Nov 13, 2009 10:42 AM

    Hi Darknight,
    What is it you want to find once you are connected? Since you posted this in the Database Connectivity forum I assume you want to connect to some DB or flat file on that server? If it's a DB then use the client to connect from windows. If it's a flat file then you should be able to use whatever connection utility you use to see the file system from windows. I don't know Unix so not sure but need more details.
    Thank you
    Don

  • How to connect to Oracle 11gR2 from CF9

    Hi,
    how to connect to Oracle 11gR2 64 bit Database from CF9?
    In CF Administrator no Oracle Driver is available.
    Do I have to install Oracle Client Software on Server Hardware where CF9 Server is installed?
    If yes, is Oracle Instant Client is enough or do I have to install full oracle client?
    Any idea?
    regards Claudia

    Excellent, glad to hear it's sorted. Just be careful if you use any of the "advanced" features such as returning querysets from stored procedures or BLOBs, apparently there are differences between the JDBC and full DataDirect drivers in those cases.
    However in 99% of cases you won't notice the difference.

  • How to connect to UNIX OS from oracle stored procedure

    Hi,
    I need to connect to UNIX OS from oracle stored procedure.
    Curently working in Oracle9i.
    I tried in google but I could'nt get any.
    Can you send me pointers on how to do this.
    Thanks,
    Kavitha.

    Can use Java Stored Proc, or an External Proc.
    Java method:
    create or replace and compile Java Source named "OSCommand" as
    -- java:        OS COMMAND
    -- descr:       Executes an Operating System Command using the JAVA RTS
    -- IN parameter:        os command to execute (including fully qualified path names)
    -- OUT parameter:       returncode [\nstring]
    --                      where string a max of 32000 chars of the output of the command
    --                      (note that \n is used as separators in the string)
    --                      returncode=-1   Java RTS error occurred (e.g. command does not exist)
    --                      returncode=255  o/s command failed (e.g. invalid command params)
    import java.io.*;
    import java.lang.*;
    public class OSCommand{
            public static String Run(String Command){
                    Runtime rt = Runtime.getRuntime();
                    int     rc = -1;
                    try{
                            Process p = rt.exec( Command );
                            int bufSize = 32000;
                            int len = 0;
                            byte buffer[] = new byte[bufSize];
                            String s = null;
                            BufferedInputStream bis = new BufferedInputStream( p.getInputStream(), bufSize );
                            len = bis.read( buffer, 0, bufSize );
                            rc = p.waitFor();
                            if ( len != -1 ){
                                    s = new String( buffer, 0, len );
                                    return( s );
                            return( rc+"" );
                    catch (Exception e){
                            e.printStackTrace();
                            return(  "-1\ncommand[" + Command + "]\n" + e.getMessage() );
    show errors
    create or replace function osexec( cCommand IN string ) return varchar2 is
    -- function:    OS EXEC
    -- descr:       Executes an Operating System Command
    language        JAVA
    name            'OSCommand.Run(java.lang.String) return java.lang.String';
    show errors===
    This can then be used from PL/SQL and even SQL. e.g.
    SQL> select osexec( '/bin/date' ) from dual;
    OSEXEC('/BIN/DATE')
    Wed Nov  9 13:30:13 SAST 2005
    SQL>Note the Java permissions required - replace FOO with the name of applicable Oracle schema
    ==begin
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.io.FilePermission',
                    '<<ALL FILES>>',
                    'execute'
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.lang.RuntimePermission',
                    'writeFileDescriptor',
            dbms_java.grant_permission(
                    'FOO',
                    'SYS:java.lang.RuntimePermission',
                    'readFileDescriptor',
            commit;
    end;
    /==
    Last thing... note that opens a potential giant size security hole into the Oracle Server Platform. So implement it properly using a proper Oracle security model.

Maybe you are looking for

  • Mac will not open iCloud "Documents" - No Errors

    Hello, Over the past few days, I have noticed that my iCloud documents will not open on my Mac. I am able to edit them on my iOS devices. (via Numbers, Pages, Keynote for example) I am able to Save new documents to my "iCloud" I am NOT able to open t

  • After Upgrade from 11.1.1.3 to 11.1.2.2 Essbase Application Not Shown in Calculation Manager

    I have upgraded from EPM 11.1.1.3 to 11.1.2.2 and now want to import Business Rules to Calculation Manager for use with Essbase. However I cannot see my Essbase Application in Calculation Manager; (only the provided sample applications are shown in t

  • Exporting Jpegs from Lightroom - DPI question

    When I export Jpegs from Lightroom, I set the dpi to 300 pixels per inch. I do not specify a max width or height. When I view these files in Adobe Bridge (CS2 or CS3) the file info says 300dpi. However, when I open the files in Photoshop and select i

  • Adobe Acrobat forms

    I have made a fillable form in Acrobat and need to get it into Iweb. I tried to drag the PDF into the window but it looks like it disabled the fields. Can this be done? I just want my customers to fill out the PDF and then e-mail it to me. Can this b

  • Synchronize SAP Roles with IDM Roles

    Hi, i have a question concerning SAP integration in IDM. Is it possible to import the Roles from SAP (named Activity groups) in IDM? And how does the "synchronize identity system roles with resource roles" function work? Thanks in advance! gojo