app failed due to java.sql.SQLException: [Microsoft][ODBC driver for Oracl
Hello I developed a small applicaion for insert data into database.but i am getting exception in the server like this.
app failed due to java.sql.SQLException: [Microsoft][ODBC driver for Oracle][Oracle]ORA-01401: inserted value too large for column
And the code is given below..
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
publicclass Jdbc1extends HttpServlet
{
publicvoid service(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
{
PrintWriter out=response.getWriter();
String no=request.getParameter("no");
String name=request.getParameter("name");
String age=request.getParameter("age");
try
{
System.out.println("1");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("2");
Connection con=DriverManager.getConnection("jdbc:odbc:rakesh","scott","tiger");
System.out.println("3");
Statement st=con.createStatement();
System.out.println("4");
st.executeUpdate("INSERT INTO ind VALUES('+no+','+name+','+age+')" );
con.commit();
con.close();
}
catch(Exception e)
{
System.out.println(" app failed due to "+e);
}
}
}
Please give solution for this....
# 1
If you Google this:
ORA-01401: inserted value too large for column
and then look at your three columns and values, what conclusion would you draw?
I'd recommend that you do that and see if that helps.
%
PS - Why are you using the ODBC bridge driver and not the Oracle type IV driver?
# 2
Hello sir..
thanks for ur reply...
for oracle 10g --> we use XE as datasourse name..
now i am using oracle 8i...so what should i write...in the datasourse name...that means.......
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:?","scott","tiger");
What should i write in place of ?..
# 3
> Hello sir..
> thanks for ur reply...
> for oracle 10g --> we use XE as datasourse
> name..
What?
> now i am using oracle 8i...
Not so from the code you posted. Didn't I see "jdbc:odbc:..." in your first post?
> so what should i
> write...in the datasourse name...that means.......
> Connection
> con=DriverManager.getConnection("jdbc:oracle:thin:@loc
> alhost:1521:?","scott","tiger");
Do you really use the default username and password?
> What should i write in place of ?..
The name of the database you wish to connect to, of course.
Do you have your tnsnames.ora set up properly? Did you install this database?
None of this has ANYTHING to do with the error you posted, of course. Fix that first and then worry about the thin driver. At least it appears that the code you posted managed to connect to the database.
%