Servlet not inserting into Access Databse. help please

I have the following code which is inserting three fields into a database. The database name is contacts.mdb, and the table is contacts. I have setup the ODBC connection on the server, of which I have both IIS and Tomcat running. The form.html that I am accessing is on the tomcat server root and that code is below as well. After hitting the submit button on the form I get forwarded to the servlet, and the page is blank. However, when I open the database, no updates have occured. Please help. I hope I have provided enough detail. Thanks so much.
-------- servlet code start --------------
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class WebServlet
extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String sourceURL = "jdbc:odbc:terry_web_contacts";
Connection databaseConnection = DriverManager.getConnection(sourceURL);
Statement stmt = databaseConnection.createStatement();
String jname = request.getParameter("Name");
String jemail = request.getParameter("Email");
String jcomments = request.getParameter("Comments");
String sqlInsertString ="INSERT INTO contacts (name, email, comments) VALUES ('" + jname +"', '" jemail "', '" + jcomments + "')";
stmt.executeUpdate(sqlInsertString);
databaseConnection.close();
catch(ClassNotFoundException cnfe)
System.err.println("Error loading Driver");
catch (SQLException sqle){
System.err.println("SQL Error");
---------- servlet code end ---------------------
---------- html form code start ------------------
<HTML>
<HEAD>
<TITLE>Example</TITLE>
</HEAD>
<BODY BGCOLOR="WHITE">
<TABLE BORDER="2" CELLPADDING="2">
<TR><TD WIDTH="275">
<H2>I'm a Simple Form</H2>
<FORM METHOD="POST" ACTION="/servlet/WebServlet">
<p>
<INPUT NAME="Name" TYPE="TEXT" id="Name" SIZE=30>
</p>
<p>
<INPUT NAME="Email" TYPE="TEXT" id="Email" SIZE=30>
</p>
<p>
<textarea name="Comments" id="Comments"></textarea>
</p>
<P>
<INPUT TYPE="SUBMIT" VALUE="Click Me">
<INPUT TYPE="RESET">
</FORM>
</TD></TR>
</TABLE>
</BODY>
</HTML>
------------- html code end ------------------

Okay, here is my modified code. However, I catch a sql error. It prints out "sql error". If I try to isolate the different lines of code with try catch blocks, the compiler says it does not recognize the symbols for example stmt, or databaseConnection. Arggh, what can I do? Help please.
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class WebServlet
    extends HttpServlet {
  public void doPost(HttpServletRequest request, HttpServletResponse response)
     throws ServletException,IOException
     PrintWriter out = response.getWriter();
     String jname = (String) request.getParameter("Name");
     String jemail = (String) request.getParameter("Email");
     String jcomments = (String) request.getParameter("Comments");
try
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
catch(ClassNotFoundException e)
     out.println("class error");
try
     Connection databaseConnection = DriverManager.getConnection("jdbc:odbc:terrycontacts");
     Statement stmt = databaseConnection.createStatement();
     String sqlInsertString ="INSERT INTO contacts(name,email,comments) VALUES('"+jname+"','"+jemail+"','"+jcomments+"')";
     stmt.executeQuery(sqlInsertString);
     databaseConnection.commit();
     databaseConnection.close();
catch(SQLException e)
     out.println("sql error");
     out.close();
}

Similar Messages

  • Port 21 not open - FTP access denied - Help please :-)

    I am running Server 10.3.9 on a DP 1.8 G5 with 1 GB RAM.
    I configured and started ftp services and set up a user and folder. Tried to access using fetch from a machine on the LAN before setting up NAT for WAN access and got an Access Denied message. Did a port scan of the server and found that there are no ports open in the 20-23 range. I am not running the server's firewall.
    Can somebody tell me how to open up port 21? Please use small words
    DP G5 - 1GB RAM   Mac OS X (10.3.9)  

    Stumbled across somebody else's post. Turns out port 21 likes to close itself at times. A restart took care of it.

  • File to RFC problem- data is not inserting into ztable in R3 system

    Hi
    i have done File to RFC scenario which picks data from flat file and inserts into ztable via RFC in R3. but while testing my scenario everything is successful in XI monitoring (Successful flag in MONI and RWB) and in auditlog message status is DLVD.
    it seems to be everything successful in XI and RFC call also successful in R3 system.
    but for some reason data is not inserting into table (RFC is used to insert data into ztable)
    Is there any way to debug RFC call excecution in XI..?
    RFC code is like this:
    insert ZMM_AUTO_GR from INPUT_TABLE.
    commit work.
    END FUNCTION.
    please advice what could be the reason not inserting into table.
    Help would be appreciated.
    Regards,
    Rajesh

    Hi Praveen,
    please see audit log- from communication channel monitoring..
    Receiver channel 'CC_INCA_RFC_SAPECC_Receiver' for party '', service 'R3DCLNT210' (internal name 'RfcClient[CC_INCA_RFC_SAPECC_Receiver]')
    Client data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=210, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=jsaha, jco.client.sysnr=00, jco.client.ashost=ausr3devdc02}
    Repository data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=210, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=jsaha, jco.client.sysnr=00, jco.client.ashost=ausr3devdc02}
    Current pool size: 1, maximum pool size : 1
    Channel History
    - OK: 2008-07-28 04:32:04 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA
    - OK: 2008-07-28 04:31:04 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA
    - OK: 2008-07-28 03:56:56 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA
    - OK: 2008-07-28 03:49:04 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA
    - OK: 2008-07-28 03:48:04 PDT: Message processed for interface ZAUTO_GR_STAGE_INCA

  • Record not inserting into the table through Forms 10g

    Hi all,
    I have created a form in 10g(10.1.2.0.2) based on just one table that has 4 columns(col1, col2, col3, col4).
    Here col1, col2 and col3 are VARCHAR2 and col4 is date and all the columns are not null columns(There are no primary and foriegn key constrains, which means duplicates are allowed).
    My form contains 2 blocks where block 1 has one text item (col1) and 3 buttons (Delete, Save, Exit).
    And block2 is a database block and has col2,col3,col4 which are in tabluar layout frame displaying 10 records.
    When the form is opened the cursor has to be in block1.col1 for querrying. Here i enter a value in col1, and then when I click on col2 in the block2, then I put execute_query in new_block_instance of block2, which displays the records.
    The block2 properties are not updatable, insertable and query is allowed.
    Everything is working good until here. But here in the block2 when I want to insert another record into the table, by navigating all the way down to the last empty record and entering the new values for col2, col3 and col4 And then Ctrl+S will display the message "*FRM-40400: Transaction complete: 1 record applied and saved.*" But actually the record is not inserted into the table.
    I also disabled the col4 by setting the Enabled property to No, since while inserting new record the date have to be populated into it and it shouldnt be changed by the user. And im populating the sysdate into the new record by setting Intial Value property to *$$DATE$$*.
    And another requirement which I could not work arround here is that, the col3 also should be populated with the username of the user while inserting.
    please help me...

    Hi Sarah,
    I do not want to update the existing record. So I kept Udate Allowed to No in property palette for the items in block2.
    Do I have to do this property at block level also?
    I'm inserting a new record here.
    Edited by: Charan on Sep 19, 2011 8:48 AM

  • Data is not inserting into table

    Hi Team,
    I am inserting data into a custom table.
    but my records are not inserting into table
    //CO File
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    am.invokeMethod("createEmployee");
    // am.invokeMethod("init");
    * Procedure to handle form submissions for form elements in
    * a region.
    * @param pageContext the current OA page context
    * @param webBean the web bean corresponding to the region
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean);
    if (pageContext.getParameter("Apply") != null)
    OAViewObject vo = (OAViewObject)am.findViewObject("TestEmpVO1");
    String NAME = (String)vo.getCurrentRow().getAttribute("Name");
    Number employeeNumber = (Number)vo.getCurrentRow().getAttribute("Num");
    String NUM = String.valueOf(employeeNumber.intValue());
    am.invokeMethod("apply");
    MessageToken[] tokens = { new MessageToken("EMP_NAME", NAME),
    new MessageToken("EMP_NUMBER", NUM) };
    OAException confirmMessage = new OAException("AK", "FWK_TBX_T_EMP_CREATE_CONFIRM", tokens,
    OAException.CONFIRMATION, null);
    pageContext.putDialogMessage(confirmMessage);
    else if (pageContext.getParameter("Cancel") != null)
    am.invokeMethod("rollbackEmployee");
    TransactionUnitHelper.endTransactionUnit(pageContext, "empCreateTxn");
    // End CO
    //AMImpl
    package oracle.apps.fnd.framework.toolbox.labsolutions.server;
    import oracle.jbo.Row;
    import oracle.jbo.Transaction;
    import oracle.jbo.RowSetIterator;
    import oracle.jbo.domain.Number;
    import oracle.apps.fnd.common.MessageToken;
    import oracle.apps.fnd.common.VersionInfo;
    import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
    import oracle.apps.fnd.framework.OAException;
    import oracle.apps.fnd.framework.OARow;
    import oracle.apps.fnd.framework.OAViewObject;
    import oracle.apps.fnd.framework.server.OAViewObjectImpl;
    // --- File generated by Oracle Business Components for Java.
    public class TestEmpAMImpl extends EmployeeAMImpl
    * This is the default constructor (do not remove)
    public TestEmpAMImpl()
    * Container's getter for TestEmpVO1
    public TestEmpVOImpl getTestEmpVO1()
    return (TestEmpVOImpl)findViewObject("TestEmpVO1");
    * Creates a new employee.
    public void createEmployee()
    OAViewObject vo = (OAViewObject)getTestEmpVO1();
    // Per the coding standards, this is the proper way to initialize a
    // VO that is used for both inserts and queries. See View Objects
    // in Detail in the Developer's Guide for additional information.
    if (!vo.isPreparedForExecution())
    vo.executeQuery();
    Row row = vo.createRow();
    vo.insertRow(row);
    // Required per OA Framework Model Coding Standard M69
    row.setNewRowState(Row.STATUS_INITIALIZED);
    } // end createEmployee()
    public void apply()
    getDBTransaction().commit();
    * Sample main for debugging Business Components code using the tester.
    public static void main(String[] args)
    launchTester("oracle.apps.fnd.framework.toolbox.labsolutions.server", "TestEmpAMLocal");
    //End AmImpl
    Please suggest.
    Thanks,
    Ajit

    Ajit,
    Its always a good idea to close the thread with an explanation. It will help others whenever they are into similar situation.
    --Shiv                                                                                                                                                                                                                                                                                               

  • Popup not INSERTing into table and not refreshing called page ...

    Greetings
    Environment: APEX 3.1.1.00.09 on AIX 5.3 in 10gR2
    I have read many of the threads concerning my issue and I feel I am getting close to the answer but somehow have combined too many of the suggestions and am tripping over my own code.
    Please look at my sample application on apex.oracle.com:
    Workspace: galway
    User: gwicke
    Password: gwicke
    Please start with Page3, select any Agency and then click 'Add New Contract'.
    There is currently a <strong>BOLD </strong>label 'Add New Builder' that is a link that should open a popup window. Type any name into the field and click 'Create Builder'. This should INSERT the row into the builder table, close the popup, assign the new builder name to the calling page item 'Builder Name' and populate the screen item.
    In it's current state, the application will open the popup window, allow entry and close upon clicking the 'Create Builder' button. However the new builder is NOT inserted into the table and the calling page item is not populated.
    By looking at the Page Items and Session State I can see the correct values assigned to the 'Pn_BULDER_NAME' items on both the popup page (4) and the calling page (2) but the value does not appear on the screen.
    I've read where there's really two parallel universes, no sorry, two versions of the screen items, one in Session State and one that is displayed in the browser and there are steps to take to be sure the one displayed is updated from Session State as I would like in this case.
    I've entered Javascript code in the Page4 - header to define the 'passBack2()' function and code in the 'Optional URL Redirect' section of the 'Add Builder' button to hopefully execute the ARP for the INSERT, assign the Page2 items and close the popup. It doesn't quite get all that done.
    Any helpp is greatly appreciated. Thanks to Denes for most of the code suggestions I've followed.
    -gary

    Hi Gary,
    I think that there's a very simple solution to this - didn't really spot it last night.
    Firstly, yes, you could use a "button" to handle the call for the popup - just make sure that the button is a URL type "button" that is actually an A tag with the call in the URL target setting. Alternatively, you could take you existing A tag and use the same class attribute for one of your buttons as this should make it look like a button.
    More importantly, though, I think that we could do it as:
    1 - On your page 2 popup call, clear that cache for page 4 (the popup page) - I have already done this in your app by updating the url
    2 - On the popup page, allow the user to enter in their desired P4_BUILDER_NAME value (not sure if you want to do something to make this unique?)
    3 - Let the user click the Create button on the popup. This will submit the page, which will get your P4_BUILDER_RANK (the pk) value and insert a new record into the table (you could consider creating a sequence and a trigger to handle the creation of a new PK value?).
    4 - Assuming the P4_BUILDER_RANK then exists (it wouldn't if there was an error somewhere), then conditionally display a region that had a piece of javascript that submits page 2 and then closes itself - we don't need to pass anything back to page 2 (see below)
    5 - As the P4_BUILDER_NAME and P4_BUILDER_RANK exist in the session, when page 2 is being reloaded, (A) the select list would be updated with the new Builder (still not sure why all my entries appeared at the bottom instead of in alpha order??) and (B) both P2_BUILDER_NAME and P2_BUILDER_RANK can have Post Calculation Computations set (NVL(:P4_BUILDER_NAME,:P2_BUILDER_NAME) and NVL(:P4_BUILDER_RANK, :P2_BUILDER_RANK) respectively) - the effect of this is, if there are values stored in the P4 page items, we use them, otherwise we use whatever values were in the P2 page items
    6 - Finally, to stop (5) happening in all page 2 loads, you would need to clear the cache for page 4 in as many places as possible - eg, branches to page 2 or buttons on page 2
    The reason we can't pass values back to page 2 is that one of the items is a select list. The value we want to select won't appear on the select list until the page has been submitted. So, we can't set the value and submit because the value isn't there. We can't submit and set the value because javascript wouldn't know when the page has been updated (or, at least, you would have to put some independant mechanism in place to identify this, which may become complicated).
    So, simply put, as long as we know that if the values are in the session, we can use Post Calculation Computations to set our fields to these values. The only thing to bear in mind is that we need to ensure that these session values only exist when we need them - hence clearing the cache. This principle should work for any type of field - but, as you have no doubt seen, simple text fields can be updated by the popup directly as the field should accept any value we give it.
    My only other recommendation would be to completely remove the MRU processes from the page as these are not required (they just confuse the issue) and you could make your PK fetch and record insert into a single process - just to keep things neat and tidy, you understand!
    When I finished with your app last night, I did leave it so that javascript would create a new option on the select list and then set the value. But the above methodology seems to be a lot simpler.
    Andy

  • HT204053 My kids now each have an itouch, should we all have different apple ids even if I am paying for all itunes and app store purchases? what about icloud? I would like to share itunes and app purchases, but not necessarily photos...help please!

    My kids now each have an itouch, should we all have different apple ids even if I am paying for all itunes and app store purchases? what about icloud? I would like to share itunes and app purchases, but not necessarily photos...help please!

    The recommended solution for most families is to share the same Apple ID for iTunes and App Store purchases, so you can share your purchases, but us different IDs for iMessage, FaceTime and iCloud.  With this arrangement, each person can automatically download purchases made on the shared ID (by turning this feature on in Settings>iTunes & App Stores), while keeping their FaceTime calls, text messages and iCloud data (including photo stream) separated.  There is no requirement that the ID you use for purchasing be the same as the ID you use for these other services.
    This article: http://www.macstories.net/stories/ios-5-icloud-tips-sharing-an-apple-id-with-you r-family/.

  • How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    How can I add a new Template to My Templates in Pages? I've read most of the discussions on the subject but it doesn't work for me. By the time I reach the Templates folder, I only see templates for Numbers and not for Pages. Need help, please.  Thanks

    Si vous avez utilisé la commande Save As Template depuis Pages, il y a forcément un dossier
    iWork > Pages
    contenant Templates > My Templates
    comme il y a un dossier
    iWork > Numbers
    contenant Templates > My Templates
    Depuis le Finder, tapez cmd + f
    puis configurez la recherche comme sur cette recopie d'écran.
    puis lancez la recherche.
    Ainsi, vous allez trouver vos modèles personnalisés dans leur dossier.
    Chez moi, il y en a une kyrielle en dehors des dossiers standards parce que je renomme wxcvb.template quasiment tous mes documents Pages et wxcvb.nmbtemplate à peu près tous mes documents Numbers.
    Ainsi, quand je travaille sur un document, je ne suis pas ralenti par Autosave.
    Désolé mais je ne répondrai plus avant demain.
    Pour moi il est temps de dormir.
    Yvan KOENIG (VALLAURIS, France)  mercredi 23 janvier 2011 22:39:28
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • I would like to upgrade my OS from 10.6.8. I can't find any higher version on the site. Yosemite is the latest but not available. Can someone help please?

    I would like to upgrade my OS from 10.6.8. I can't find any higher version on the site. Yosemite is the latest but not available. Can someone help please?

    If Yosemite is not available to you, your system may not meet the minimum requirements.
    How to install OS X Yosemite on your Mac - Apple Support

  • I purchased the Logitech F310 game controller for my 2011 MacBook Pro. How do I get the driver installed for it. The Disk that came with the controller is a mini disk and will not insert into my laptop.

    I purchased the Logitech F310 game controller for my 2011 MacBook Pro. How do I get the driver installed for it. The Disk that came with the controller is a mini disk and will not insert into my laptop.

    May not make a difference anyway. The Logitech support site does not show drivers for Mac OS for the F310:
    http://www.logitech.com/en-us/support/gamepad-f310?crid=411
    I'd contact their support to find out if there is a Mac driver available, and if they can either give you a web link to get it, e-mail you the software, or snail-mail you a standard-size disk with the drivers.

  • I have just downloaded Lion and my AverTv Molar will not work, just comes up can not find device can anybody help please

    Hi, I have just downloaded Lion, and my AverTV Volar M will not work, just come up can not find device can anybody help please.

    Contact the manufacturer's tech support for help. Most likely it needs a compatible driver.

  • Records are not inserted into MTL_TXN_REQUEST_HEADERS,MTL_TXN_REQUEST_LINES

    Hi all,
    I am doing pick release thru API.
    For that , I have run following API successfully but my problem is that records are not inserted into MTL_TXN_REQUEST_HEADERS , MTL_TXN_REQUEST_LINES
    tables so that I cannot generate the move order. Can anyone suggent the valuable tips for that ?
    1. WSH_DELIVERIES_PUB.create_update_delivery
    2. WSH_DELIVERY_DETAILS_PUB.Detail_to_Delivery
    3. WSH_PICKING_BATCHES_PUB.CREATE_BATCH
    4. WSH_PICKING_BATCHES_PUB.RELEASE_BATCH
    5. WSH_DELIVERIES_PUB.Delivery_Action ( for p_action_code = 'PICK-RELEASE' )
    regards with thanks in advance
    sanjay

    Hi All,
    To create a Move Order Header & Line Record in MTL_TXN_REQUEST_HEADERS and MTL_TXN_REQUEST_LINES tables , I have run an seeded
    procedure : CreateMoveOrderHeader & CreateMoveOrderLines .
    The procedure : CreateMoveOrderHeader was run successfully but when I am going to run procedure : CreateMoveOrderLines , it is giving
    an error .
    Following Error text I am receiving at the time of running of procedure : CreateMoveOrderLines .
    Initialized applications context: 5707 50138 660
    *==========================================================*
    Calling INV_MOVE_ORDER_PUB.Create_Move_Order_Lines API
    *==========================================================*
    Return Status: E
    Error Message :INV
    *==========================================================*
    From the above error message, no specific error is received . Only " Error Message : INV " is received hence it is very difficult to judge & resolve an error .
    Can anyone guide me that what is an error ? For what reason I am getting an error ?
    regrads
    Sanjay

  • I have purchased a TV show series. I show that from the purchased screen it has downloaded. However it is not in my library. How do I watch this episode? Several of the episodes are in the library but a few did not make it there. Help please!

    I have purchased a TV show series. I show that from the purchased screen it has downloaded. However it is not in my library. How do I watch this episode? Several of the episodes are in the library but a few did not make it there. Help please!

    Sometimes things have inconsistent labeling.  Check your Recently Added playlist.

  • Apple not recognizing known password.  Iforgot does not send email verification.  Help please.

    Apple not recognizing known password.  Iforgot does not send email verification.  Help please.
    Don't know any other way to put it.  I typed in the correct password.  Now the account is locked.  Iforgot does not send an email verification.  The email is not in the junk mail or anywhere else.  It is typed correctly.  This is frustrating.  I was just trying to update the Ipad Mini.  I wanted to change the ownership to my husband and noticed that my daughter attached a new Icloud account.  I was just trying to verify her account.  I have the correct password.  Now the account is locked out.

    I figured it out.  It's a little confusing.  I was trying to add a new email address for iCloud and I was supposed to type in the main iCloud user ID and password.  The wording is not helpful because it displays the name of the new email address.

  • HT3775 This info is not helping. I am using VC500MAC digital video conversion system to record old VHS tapes to computer. The file is .mov, but quicktime is not playing it back. Help, please.

    This info is not helping. I am using VC500MAC digital video conversion system to record old VHS tapes to computer. The file is .mov, but quicktime is not playing it back. Help, please.

    Sorry for this question. Can you use this device with Vlc or QuickTime? Does skype support it? Is this device supported only by its own software?
    I need a device that can work with my own software. My software can work only with a QuickTime supported device.
    Thanks if you will reply to me.

Maybe you are looking for