problem inserting values into oracle database

hi,

I have a problem inserting values to oracle database. when i use ms-

access with JDBC-ODBC driver it works fine.

I am using JWS, copied .html into Public_html and .class into Servlet

directory everything is working. what changes should i do when i use

microsoft odbc driver for oracle. The below program connects to oracle but

not inserting values to database

//

import javax.servlet.*;

import javax.servlet.http.*;

import java.sql.*;

import java.io.*;

public class oname extends HttpServlet

{

public void doPost(HttpServletRequest req,HttpServletResponse res)

throws ServletException,IOException

{

res.setContentType("text/html");

PrintWriter out=res.getWriter();

String Fname=req.getParameter("a");

Connection cn=null;

Statement st=null;

String sql;

try

{

DriverManager.registerDriver(new

sun.jdbc.odbc.JdbcOdbcDriver());

System.out.println("Connecting to DataBase");

cn=DriverManager.getConnection

("jdbc:odbc:register","sams","sams12");

System.out.println("Connected to DataBase");

st=cn.createStatement();

}

catch(Exception e) { }

out.println("<html><body>");

try

{

out.println("inside sql");

sql="insert into name values('"+Fname+"')";

st.executeUpdate(sql);

out.println("values inserted");

}

catch(Exception e) { }

out.println("</body></html>");

}

}

//-

Any help will be appreciated..

Sangeetha.

-

[1661 byte] By [msangeetha] at [2007-9-26 7:07:09]
# 1
maybe Oracle's Autocommit ist set to false by default. So a cn.commit() could help...
rennie1 at 2007-7-1 16:47:39 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...