无任何错误或异常,却无法进行数据库插入操作,求救
package fatie;
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class fatieServlet extends HttpServlet
{
//初始化变量
public void init(ServletConfig config) throws
ServletException {
super.init(config);
}
//获取数据库连接
private Connection initConnection()
{
Connection conn=null;
try
{
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver ");
}
catch(
ClassNotFoundException e)
{
e.printStackTrace();
}
try
{
conn=DriverManager.getConnection( "jdbc:odbc:forumData ", "sa ", "sa ");
}
catch(
SQLException e)
{
e.printStackTrace();
}
return conn;
}
//释放数据库连接
private void freeConnection(Connection conn)
{
try
{
conn.close();
}
catch(SQLException e)
{
System.out.print( "释放数据库
连接失败 "+e.toString());
}
}
//插入数据库操作
public int insertData(PreparedStatement pstmt)
{
int n=0;
try
{
n=pstmt.executeUpdate();
}
catch(SQLException e)
{
e.toString();
}
return n;
}
//获得主题ID
private int getTopicID()
{
String sql= "select * from sumTopic ";
ResultSet rs=null;
Statement stmt=null;
int n=0;
try
{
Connection conn=this.initConnection();
stmt=conn.createStatement();
rs=stmt.executeQuery(sql);
if(rs.next())
{
n=rs.getInt(1);
}
}
catch(SQLException e)
{
e.printStackTrace();
}
return n;
}
//实现总贴数目的更新
private int addOne(int n)
{
int k=0;
String sql= "update sumTopic set sumTopic= ' "+n+ " '+1 ";
try
{
Connection conn=this.initConnection();
PreparedStatement pstmt=conn.prepareStatement(sql);
k=pstmt.executeUpdate();
}
catch(SQLException e)
{
e.toString();
}
return k;
}
//doPost方法实现
public void doPost(HttpServletRequest req,HttpServletResponse resp)throws ServletException,
IOException {
int n=0;
String typeid=req.getParameter( "typeID ");
//int i=Integer.parseInt(typeid);
String title=req.getParameter( "