Access database vs Tomcat 1.4.2.9

Good afternoon
I'm currently at my practical training and i'm trying te access a MS Access database with a Servlet. I've already done that in the past and there weren't any issues, so it should be a piece of cake.
Unfortunately, i think there's an issue with Tomcat. When i access the database from the servlet, i always get a "General Error", with no explanation. It seems he can't find the data source or the driver. I already configured a System and User DSN for the database, so this should work.
I also wrote a testapplication, to test my database-class and when i write something to that database, it really updates the database.
I have to use that specific version of tomcat, i'm afraid upgrading Tomcat is not an option.
Here's my code:
Open connection:
     /** Openen van de connectie naar de databank */
     private void openDatabank()
          try{
               Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               con = DriverManager.getConnection("jdbc:odbc:Viewer");
        catch(SQLException e){ System.out.println("SQLExcep " + e.getMessage()); e.printStackTrace(); }
        catch(ClassNotFoundException cnf){ System.out.println("CNF: " + cnf.getMessage()); cnf.printStackTrace(); }
     }Insert information into the database
     public void voerNonQueryUit(String sql)
          openDatabank();
         try{
              Statement stmt = con.createStatement();
              stmt.execute(sql);
              sluitDatabank();
         }catch(Exception e){ e.printStackTrace(); }
     }Call the insert method:
     /** Kijkt of databank al is aangemaakt */
     private void maakDatabank()
          if(db == null)
               db = new Databank();
     /** Sessieid die behoort aan gebruiker wegschrijven in databank */
     public void schrijfSessieIDWeg(GenerateID generateid)
          maakDatabank();
          sql = "INSERT INTO Sessie(SessieID) VALUES ('" + generateid.getId() + "')";
          db.voerNonQueryUit(sql);
     }

I'd look at two things:
(1) Your PATH environment variable should have JAVA_HOME/bin as its very first entry, where JAVA_HOME is the directory where you've installed the JDK.
(2) If the first thing doesn't fix it, there's probably a registry setting that points to the JRE. On my machine, it's under LOCAL_MACHINE/SOFTWARE/Java Soft. See what's in there and make it use the ones you want.
MOD

Similar Messages

  • Using JavaScript to access Database

    Hi all,
    I am using JSP and Tomcat for my web application.
    Now i need to use Javascript to access the MS Access database. Can anyone please tell me the class and command for accessing database from javascript.
    Please give me an example and that will help me. I know it is not good to access database using JavaScript. But in this situation i have to use it anyhow.
    Thatnks

    Hi all,
    Thanks very much for your help. Now some of you said that it is not possible in JSP to access database using JavaScript, some of you said yes it is possible but not secure, I understand the both concepts.
    Now my problem is last year i built a web application for my company and the scenario is like this:
    The staff records their working time in that application. Now when they click a button it creates a drop down list of all clients they have and that list is in HTML as SELECT TAG. So the select tag includes 100+ client name.
    Now they can add as many client as they want for example if i have worked with 10 clients i will create 10 drop down list by pressing button called ADD CLIENT and will record their hours.
    Now from the description above you guys can understand that an OnClick Javascript event in involved to create multiple dropdown list.
    Now what i want is that i want those 100+ client list to come from database rather than typing them in the SELECT TAG. and please remember the SELECT tag is implemented in Javascript using innerHTML event.
    Now for those of you who suggested that it is not possible to use Javascript in accessing database, can you please tell me how can i implement Onclick event using JSP/Serverlet and can create dynamic drop downlist?
    Thanks for your time to read this long message.

  • Problem in establishing connectin to Oracle Database using TOMCAT-APACHE

    Hello can anyone help me i can't establish a coonection to Oracle Database eventhough i have set everything in my server.XML...
    I manage to connect to ACCES database but not Oracle... help me... here is the resource portion in my server.xml
    <!-- My Forum Context - Access Database-->
    <Context path="/forum" docBase="forum" debug="0" reloadable="true">
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_forum_log." suffix=".txt" timestamp="true"/>
    <Resource name="jdbc/forumDb" auth="Container" type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/forumDb">
    <parameter><name>user</name><value></value></parameter>
    <parameter><name>password</name><value></value></parameter>
    <parameter><name>driverClassName</name><value>sun.jdbc.odbc.JdbcOdbcDriver</value></parameter>
    <parameter><name>driverName</name><value>jdbc:odbc:forumDb</value></parameter>
    </ResourceParams>     
    </Context>
    <!-- PMOD Context - Oracle -->
    <Context path="/pmod" docBase="pmod" debug="0" reloadable="true">
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_pmod_log." suffix=".txt" timestamp="true"/>     
    <Environment name="maxExemptions" type="java.lang.Integer" value="15"/>
    <Parameter name="context.param.name" value="context.param.value" override="false"/>          
    <Resource name="jdbc/pmodDb" auth="Container" type="javax.sql.DataSource"/>
    <ResourceParams name="jdbc/pmodDb">
    <parameter><name>user</name><value>pmod_owner</value></parameter>
    <parameter><name>password</name><value>pmod_owner</value></parameter>
    <parameter><name>driverClassName</name><value>oracle.jdbc.driver.OracleDriver</value></parameter>     
    <parameter><name>driverName</name><value>jdbc:oracle:thin:@192.9.200.2:1521:PMOD</value></parameter>
    </ResourceParams>     
    </Context>
    can anyone help... thanks...
    sharil

    hello....
    here is how i do it if i use access, i just set in my server.xml as bellow....
    <!-- PMOD Context -->
    <Context path="/pmod" docBase="pmod" debug="0" reloadable="true">
    <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_pmod_log." suffix=".txt" timestamp="true"/>
    <Ejb name="ejb/User" type="Session" home="pmod.user.UserHome" remote="pmod.user.User"/>
    <Environment name="maxExemptions" type="java.lang.Integer" value="15"/>
    <Parameter name="context.param.name" value="context.param.value" override="false"/>
                   <Resource name="jdbc/pmodDb" auth="SERVLET" type="javax.sql.DataSource"/>
                   <ResourceParams name="jdbc/pmodDb">
                   <parameter><name>user</name><value></value></parameter>
                   <parameter><name>password</name><value></value></parameter>
    <parameter><name>driverClassName</name><value>sun.jdbc.odbc.JdbcOdbcDriver</value></parameter>
              <parameter><name>driverName</name><value>jdbc:odbc:pmodDb</value></parameter>
    </ResourceParams>     
    </Context>
    later i would call from my servlet as follows
    InitialContext initCtx = new InitialContext ();
    DataSource ds = (DataSource)initCtx.lookup ("java:comp/env/jdbc/pmodDb");
    conn = ds.getConnection();
    then i can establish connection to my database... but now i change to oracle and my server.xml i configure as follows
    <!-- PMOD Context -->
    <Context path="/pmod" docBase="pmod" debug="0" reloadable="true">
              <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_pmod_log." suffix=".txt" timestamp="true"/>     
    <Environment name="maxExemptions" type="java.lang.Integer" value="15"/>
    <Parameter name="context.param.name" value="context.param.value" override="false"/>          
              <Resource name="jdbc/pmodDb" auth="Container" type="javax.sql.DataSource"/>
              <ResourceParams name="jdbc/pmodDb">
                   <parameter><name>user</name><value>pmod_owner</value></parameter>
                   <parameter><name>password</name><value>pmod_owner</value></parameter>                
                   <parameter><name>driverClassName</name><value>oracle.jdbc.driver.OracleDriver</value></parameter>     
                   <parameter><name>driverName</name><value>jdbc:oracle:thin:@192.9.200.2:1521:PMOD</value></parameter>
    </ResourceParams>     
    </Context>
    and i call from my servlet like before ...
    InitialContext initCtx = new InitialContext ();
    DataSource ds = (DataSource)initCtx.lookup ("java:comp/env/jdbc/pmodDb");
    conn = ds.getConnection();
    the datasource would return null in other word i cannot find the database
    however if i tried to establish connection directly,
    String u1 = "pmod_owner";
    String p1 ="pmod_owner";
    String path = "jdbc:oracle:thin:@192.9.200.2:1521:PMOD";
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    conn = DriverManager.getConnection( path, u1, p1 );
    i can talk with the database....
    so if anyone out there can help me to point me where did i go wrong?
    fyi: i have put a lib which contains oracle jdbc driver called classes12.zip in my c:\tomcat\common\lib\
    thank you

  • Need access levels to access database

    hi ,
    i am doing project with jsp in ms-access database. this webapplication should be accessible to 10 people. all should be view the data but levels should be there.how can i get the access levels to the database like reading access to some 2 people. writing and modifying access to some 5 people.inserting can be done by other 2 people . please give the solution for this. i have netbeans4.1 ide , and tomcat bundled server.
    so, kindly give the jsp code and msaccess solution.
    thanks .

    I am not informed if the ms-access DB supports SQL-92. In that case you should be able to define the users and set the rules using GRANT sql command. So it is more or less an off topic entry here for a java forum.
    Else if you try to implement the authoization business logic out of your DB domain in java (or C or whatever), it is no more coupled with the DB and most likely that is not what you are supposed to deliver.

  • Caonnecting ms access database through tomcat5.5 query

    Hi,
    I have installed tomcat5.5 and jdk1.6 on my machine which has Windows server2003 as OS.
    I'm not able to clearly underdstand the steps in tomcat docs for connecting to database and the changes to be made in different files.
    Can someone tell me detailed and clear steps for connecting to an ms access database through jsp?
    Thanks in advance for your suggestions.

    I'm not exactly sure why you have this problem. I know that the Microsoft SQL Server driver has a parameter "readOnly=false". Check your DB2 docs to see if you need to set a flag like that, too.
    Maybe it has to do with transactions and auto commit. See if DB2 assumes autoCommit true or false. Maybe you have to explicitly commit your INSERT.
    Maybe you're writing to one database and opening another. Make sure that's correct.
    There are other suggestions that I'll offer.
    You do all that work with a database in a constructor? Bad idea.
    You've got database and UI stuff all mingled together. Ever heard of MVC separation?
    Be object-oriented - start by designing an object to encapsulate all those items you're trying to INSERT.
    Then write a Data Access Object (DAO) that does CRUD operations for that object. Test these thoroughly, preferrably with JUnit, until they're 100% perfect.
    Then have a separate UI that instantiates these objects and calls their methods. The persistence layer shouldn't know about UI stuff, and the UI shouldn't need to have any persistence code in it.
    %

  • Java visit microsoft access database question

    I want to visit microsoft access database,like follows:
    String dirverClass="sun.jdbc.odbc.JdbcOdbcDriver"; String url="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\\apache-tomcat-5.5.27\\webapps\\Test\\db.mdb"; String content=""; try{   Class.forName(dirverClass);   Connection conn=DriverManager.getConnection(url);   Statement stmt = conn.createStatement();   String sql="select * from mytab"; ResultSet rs = stmt.executeQuery(sql); while(rs.next()){       content=rs.getString("zd1"); }
    My question is whether I must install microsoft access database?
    Thanks

    Far as I know and have been able to determine a MS Access ODBC driver comes with every windows install going back to about windows 98. Might be 95 as well.
    I haven't looked at some of the more exotic ones like the 64 bit versions nor the mobile versions.

  • SQLException while accessing an MS Access database from a JSP

    I have a set of classes for accessing an MS Access database and have set up the database properly(System dsn...etc).These work fine when im using them from a console application....but when im tryng to use these from a jsp im getting an SQL general exception(Error code: 0).Really caught up here.please help.
    Im using jdk 1.6 and tomcat 6.0 and ms access 2000.
    Edited by: Sayantan_Auddy on Oct 15, 2008 12:56 AM

    I have a set of classes for accessing an MS Access database and have set up the database properly(System dsn...etc).These work fine when im using them from a console application....but when im tryng to use these from a jsp im getting an SQL general exception(Error code: 0).Really caught up here.please help.
    Im using jdk 1.6 and tomcat 6.0 and ms access 2000.
    Edited by: Sayantan_Auddy on Oct 15, 2008 12:56 AM

  • Does MS Access work with Tomcat?

    Hi,
    I'vw setup a access database with pageview under Tomcat. I can access the page in the same machine, but, when it's accessed from other machines, It returns error:
    'c:\jakarta-tomcat-3.2.2\webapps\Access_data\xyz1.mdb' is not a valid path.
    It is defined in the connection setup under Acces. I tried to change it to URI address and that doesn't help. Can someone tell me how can I correct this problem for users?
    TIA

    Hi,
    I created a database using MS Access. In Access, there's an option to create HTML page which would call the DB. I did that and saved it under Tomcat. I can access the page, but, problem is MSAccess isn't saving the parameters like permissions, etc. Any ideas.
    BTW, your solution worked just once. I did the mapping under web.xml as 'mdb' and 'application/mdb'. It started throwing the same error again.

  • Connect to a remote MS Access database using RmiJdbc

    Hello,
    I want to access a remote MS Access database from oracle stored procedures.
    Does anyone know how i can load the RmiJdbc driver using the loadjava command or with any other way.
    Because when i try to load RmiJdbc.zip using the loadjava command I am getting the error:
    ORA-29533:attempt to overwrite class or resource string while defining or compiling scott.TestClient
    this error is occured for multiple files...
    I don't know how to delete this classes.
    Because this error occured and the first time i tried to load Rmijdbc driver.
    and when i use the dropjava command to drop it,and then load it again the same error occures.
    Can anyone help me how to load this driver?
    Please answer because i need it as soon as possible.
    Thanks

    Hi,
    try this.
    String s = "UPDATE AGENT SET afname='test',alname='u',city='d',AGENT.[percent]=1 WHERE aid=23";
    -------->AGENT.[percent]

  • How to Protect your Custom Access Database Product - so that you can sell & distribute it?

    I'm looking for an update on this topic as I have been away from Access for a couple of years and have not kept up with the latest.
    Hopefully they have made it easier to design, develop, sell and distribute custom database solutions. So here goes...
    Question A:
    If one develops a custom database product with Access 2013 what is the current best way to...
    1 - Prevent it from being (too easily) copied
    2 - Prevent it from being (too easily) reverse engineered
    3 - Prividing a time limited free demo copy?
    4 - Providing a demo copy with limited functionality... like limiting the number of records in an important table, or whatever?
    5 - What have I left out of this list that should be considered for protecting ones investment in the development of the product? (other than copyright, of course.)
    Question B:
    What is the latest on being able to migrate an Access database to the cloud?
    1 - Entirely online
    2 - Part in the cloud and part on the users machine
    3 - And what about all that VBA code - is there no way to make that work in the cloud and/or on a web server... or does it all have to be tossed and all the coding redone?
    Question C:
    What are other alternatives solutions for selling your custom database application while protecting all your investment in developing it?
    1 - Write the front end in C++  (so that it is fully compiled) and the back end in ASP with MS SQL Server? (or alternative server side solutions)
    2 - Write the whole thing as a server side solution with browser interface?
    3 - Or what?
    Thanks for any help.

    Hi Fran_3,
    >>What is the latest on being able to migrate an Access database to the cloud?
    In my option, the Access Web app would be a better choise.
    Regards,
    Tony
    Help each other

  • "Connection is closed" closed error while using MS Access database

    We are using MS Access database in our project. Recently the database was upgraded to 2000.
    After upgrading the database, I get the folowing error when getAutoCommit() is called on a connection -
    java.sql.SQLException: Connection is closed
         at sun.jdbc.odbc.JdbcOdbcConnection.validateConnection(Unknown Source)
         at sun.jdbc.odbc.JdbcOdbcConnection.getAutoCommit(Unknown Source)
    The connection is not closed explicity before getAutoCommit() is called, only the statement is closed.
    This error is sporadic and occurs under load scenario only (when a lot of connections are open). Once the error occurs, all the database calls fail then onwards. The error was not occuring before the database was upgraded.
    I suspect the jbdc-odbc driver. The driver might not be compatible with Access2000 database. Under load scenario, it might be closing connections automatically.
    Has anybody faced similar problem before? Where can I find the compatible jdbc-odbc driver? And how to ensure that it is jdbc-odbc driver problem only?
    The database verison - MS Access 2000
    Java version - 1.3.1_01

    can i just point out that there is no support for transactions in Access so I wonder why you are calling autoCommit methods at all...

  • Access of ms access database and displaying it on applets

    I had made the connection thru JDBC and was able to access data from MS Access database when i had written java application program. But when i created one applet and created instance of that class which was making connection to the database thru JDBC and called one method which was returning one value from the database , i was not able to get on the applet(in the text field) . It gave me some security exception saying acces is not allowed.
    Please give me the reason for this and send me reply back on this email id
    [email protected]

    Welcome to the club. There is an on-going discussion from which I too would like to learn this. Try http://forum.java.sun.com/thread.jsp?forum=31&thread=174953.
    Best Wishes.

  • Not getting the records from Access database

    Hi All,
    Iam creating a universe based on Access database. I am able to view the data from all the tables except one table. When i try to view the data there is one error message "Syntax error in from clause, State: 37000". Everything is ok at database side. What does this error means?
    Please help me on this.
    Thanks.

    Hi BOCP,
           Thanks for your reply. I have resolved my issue. Actually my issue was, I have a table "Date" in universe which was created in Access database, when i tried to view the Date Table values in Universe i was getting that Syntax error in From clause message. I came to know that Date is a keyword or predefined table in WebI & it wont accept that word as a user defined Table. So i renamed that table in Access and Universe. Now my issue was solved.
    Thanks,
    Swati.

  • Refreshing Excel 2010 workbook with connection to Access database on shared network drive

    I have an Excel 2010 workbook that has a connection to an Access database that's on a shared drive on the company network. I can refresh the data in the regular Excel application but when it's hosted in the browser I get this error message "The data
    connection uses Windows Authentication and user credentials could not be delegated."
    Next, I installed PowerPivot for SQL server 2008 and used PowerPivot to connect to the same Access database. I uploaded it to a PowerPivot gallery but when I try to refresh the data but it says "the workbook was created in an older version of Excel
    and PowerPivot and cannot be refreshed until the file is upgraded." I tried to go to "Manage data refresh" but I get the "Sorry, something went wrong" page. Do I need to install PowerPivot for SQL server 2012 to do scheduled data refreshes?
    What about manual refreshes?

    I have an Excel 2010 workbook that has a connection to an Access database that's on a shared drive on the company network. I can refresh the data in the regular Excel application but when it's hosted in the browser I get this error message "The data
    connection uses Windows Authentication and user credentials could not be delegated."
    Next, I installed PowerPivot for SQL server 2008 and used PowerPivot to connect to the same Access database. I uploaded it to a PowerPivot gallery but when I try to refresh the data but it says "the workbook was created in an older version of Excel
    and PowerPivot and cannot be refreshed until the file is upgraded." I tried to go to "Manage data refresh" but I get the "Sorry, something went wrong" page. Do I need to install PowerPivot for SQL server 2012 to do scheduled data refreshes?
    What about manual refreshes?

  • Unable to Publish Access database to SharePoint site in 2013

    I have a user requesting to publish access (2007/2010) web database into SharePoint 2013. I am able to publish this database on all sites under one site collection (test) but fails on the other site (different site collection). I have compared site collection
    and site features and both site collection (working and non-working one) has SharePoint Server Enterprise Site features enabled. Is there any other features that should be turned on? 
    Initially it looks it has succeded but then give mesesage
    "Publish Failed - Your application has encountered errors while attempting to publish. The publish operation has failed and the target site has not been created. For more details, see the following tables
    Moveto SharePoint Site Issues"
    Move to SharePoint Site Issues
    Issue
    Reason
    Object Type
    Object Name
    Field Name
    There was an error uploading properties and/or data macros on this table.
    Table
    mytab
    Errors have prevented one or more tables from being uploaded to the server.
    Table
    Could not save this object's changes to the server. You must enter a value in the 'Name' field.
    Navigation Pane
    Navigation Pane
    Could not save this object's changes to the server. You must enter a value in the 'Name' field.
    VBA Properties
    VBA References
    Could not save this object's changes to the server. You must enter a value in the 'Name' field.
    Database Properties
    DBProps
    Could not save this object's changes to the server. You must enter a value in the 'Name' field.
    Theme
    Office Theme
    <tfoot></tfoot>
    I am unable to make any sense as it's one empty table and able to publish same table on another site (under different site collection). 
    MK Sin

    Hi MK,
    According to your description, my understanding is that you got an error when you published Access database to SharePoint 2013.
    Please deactivate SharePoint Server Enterprise Site Collection features at site collection level and deactivate SharePoint Server Enterprise Site features at site level, then activate them again, compare the result.
    Per the error message, please type a value in the ‘Name’ filed, then publish the table, compare the result.
    In addition, here is a similar article, please check whether it is useful for you:
    http://support.microsoft.com/kb/2711562
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

Maybe you are looking for