Link to home
Start Free TrialLog in
Avatar of ipoh1977
ipoh1977

asked on

why it's contain more data?? ken, object, TomYates??

i have program like this.

//get information from user entry screen.
// contain 15 input text box with the same name of "warranty"
String [] warranty = request.getParameterValues("warranty");
string [] techcode = request.getParameterValues("techcode");
.
.
    Connection conn=null;
    ResultSet rs=null;
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    conn = DriverManager.getConnection("jdbc:odbc:myDSN");
    PreparedStatement ps =null;
    ps = conn.prepareStatement( "Insert into Service values(?,?,?,?,?,?);" );

    out.println("Warranty :" + warranty.length);

    for (int j=0;j<warranty.length;j++) {
        ps.setString( 1, techcode);
        ps.setDate(2, new java.sql.Date(df.parse(date[j]).getTime()) );
        ps.setString(3, warranty[j]);
        ps.setString(4, filter[j]);
        ps.setInt(5, Integer.parseInt(tech_comm[j]));
        ps.setInt(6, Integer.parseInt(dealer_comm[j]));
        ps.executeQuery();
 }

*******
and i tell you what happend. Although i only enter 3 rows data (including techcode, date, warranty, filter, tech_comm, dealer_comm),  but after i hint the enter, it's going to print out this :
Warranty : 15

And this will cause me error since the rest of the data (started from 4 ) will contain null value.

Thus, i wonder what is happending.. and this cause me error...

Aren't it's (warranty.length) should only contain how many row i key in?

please help...

Avatar of jimmack
jimmack

If I understand you correctly, then you need to test whether the text fields are empty.  Change:

    for (int j=0;j<warranty.length;j++) {
        ps.setString( 1, techcode);

to

    for (int j=0;j<warranty.length;j++) {
        if ((warranty[j] != null) && (warranty[j].length() > 0))
        {
            ps.setString( 1, techcode);
            .
            .
Sorry.  A bit more explanation:

If your form contains 15 warranty fields, then all these values will be sent in the request (whether they contain data or not).

You might be able to leave out the test for null, but better to be safe than sorry ;-)
Avatar of TimYates
yeah, Jim is right :-)

tImyates ;-)
Avatar of ipoh1977

ASKER

ok. let me test it out.

tImyates, so sorry about that....
:-) he...
again......... got late...........................(throwing mouse around..:-)) why everybody gets easy ones to answer!!!!

( no pun intended)
but surprise it's contain all the 15 row of data... previously in my others code, i no need to check either it's contain null or not. The array will only contain "value" data...

anyway, no harm add the code in...
ai.... error again... i think this time is not as easy as above... i have to post the whole code.. sorry to confuse you...

*****
<%
boolean pass=false;
String techcode=request.getParameter("techcode");
String [] warranty = request.getParameterValues("warranty");
String [] filter = request.getParameterValues("filter");
String [] date = request.getParameterValues("date");
String [] dealer= request.getParameterValues("dealer");
String [] tech_comm=request.getParameterValues("tech_comm");
String [] dealer_comm=request.getParameterValues("dealer_comm");

for (int i=0; i<warranty.length;i++) {
    if (filter[i]==null || date[i]==null || tech_comm[i]==null || dealer_comm==null ) {
        pass=false;
        break;
    }
%>  
<%
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
pass=true;
}

System.out.println("Pass"+pass);


if (pass) {
int num=0;
try {
    Connection conn=null;
    ResultSet rs=null;
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    conn = DriverManager.getConnection("jdbc:odbc:myDSN");
    PreparedStatement ps =null;
    ps = conn.prepareStatement( "Insert into Service values(?,?,?,?,?,?);" );
   
    for (int j=0;j<warranty.length;j++) {
       if ((warranty[j] != null) && (warranty[j].length() > 0)) {
        ps.setString( 1, techcode);
        ps.setDate(2, new java.sql.Date(df.parse(date[j]).getTime()) );
        ps.setString(3, warranty[j]);
        ps.setString(4, filter[j]);
        ps.setInt(5, Integer.parseInt(tech_comm[j]));
        ps.setInt(6, Integer.parseInt(dealer_comm[j]));
        ps.executeQuery();
        System.out.println(techcode+":"+warranty[j]+":"+filter[j]+":"+tech_comm[j]+":"+dealer_comm[j]);
        out.println("Warranty " + warranty[j]);
    }
    }
    System.out.println("NUM"+num);
} catch (Exception e) {
    e.toString();
    e.printStackTrace();
}
%>

******

I have this exception..
Passtrue
java.sql.SQLException: General error
        at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6987)
        at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
        at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
        at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214)
        at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(JdbcOdbcPreparedStatement.java:89)
        at org.apache.jsp.tech_0005fconfirm$jsp._jspService(tech_0005fconfirm$jsp.java:122)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)

it's pointing to this line of code (tech_0005fconfirm$jsp.java:122),
>>  ps.executeQuery();

*******
And before that i have make necessary checking...
1. All the data must be enter complete as one. (mean can not let date blanll or warranty blank etc..)
2. Parse the date and int so that it's match the database type.

what would be the wrong one?? any ideas? "General Errors".. ai... lausy exception...

Kludeep, challenging??
You shouldn't need the ";" on the end of your prepared statement (AFAIK).

I have to go out for a while now.  Hopefully someone else may be able to help.

Possibly Tom ;-p

:-)
*kicks Jim* ;-P

He's right though:

>  ps = conn.prepareStatement( "Insert into Service values(?,?,?,?,?,?);" );

should be:

ps = conn.prepareStatement( "Insert into Service values(?,?,?,?,?,?)" );

(no semi-colon) :-)
jimmack, i can compile the whole code. No error.. and what is AFAIK??
changed like what you suggested... same ...

 ps = conn.prepareStatement("Insert into Service values(?,?,?,?,?,?)");
   
The code will compile with the ";" in the SQL string, but I don't think it will run...

Have you tried it without the ";"?

> and what is AFAIK

As Far As I Know :-)

Same exception?  odd...

what are the fieldnames in your table?
Passtrue
java.sql.SQLException: General error
        at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6987)
        at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
        at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
        at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214)
        at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(JdbcOdbcPreparedStatement.java:89)
        at org.apache.jsp.tech_0005fconfirm$jsp._jspService(tech_0005fconfirm$jsp.java:122)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.netbeans.modules.
Ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh!!

    for (int j=0;j<warranty.length;j++) {
       if ((warranty[j] != null) && (warranty[j].length() > 0)) {
        ps.setString( 1, techcode);
        ps.setDate(2, new java.sql.Date(df.parse(date[j]).getTime()) );
        ps.setString(3, warranty[j]);
        ps.setString(4, filter[j]);
        ps.setInt(5, Integer.parseInt(tech_comm[j]));
        ps.setInt(6, Integer.parseInt(dealer_comm[j]));
        ps.executeQuery();
        System.out.println(techcode+":"+warranty[j]+":"+filter[j]+":"+tech_comm[j]+":"+dealer_comm[j]);
        out.println("Warranty " + warranty[j]);
    }

SHOULD BE:

    for (int j=0;j<warranty.length;j++) {
       if ((warranty[j] != null) && (warranty[j].length() > 0)) {
        ps.setString( 1, techcode);
        ps.setDate(2, new java.sql.Date(df.parse(date[j]).getTime()) );
        ps.setString(3, warranty[j]);
        ps.setString(4, filter[j]);
        ps.setInt(5, Integer.parseInt(tech_comm[j]));
        ps.setInt(6, Integer.parseInt(dealer_comm[j]));
        ps.executeUpdate();
        System.out.println(techcode+":"+warranty[j]+":"+filter[j]+":"+tech_comm[j]+":"+dealer_comm[j]);
        out.println("Warranty " + warranty[j]);
    }
executeUpdate() NOT executeQuery() :-)
this is the schema:

Table name:Service
Columns :  TechName (text)
                  ServiceDate (Date/Time)
                  Warranty (Text)
                  Filter (Text)
                  TCom (Num - Long Integer)
                  DCom (Num - Long Integer)

this is the print out i added in before the ps.execute();

        ps.setString( 1, techcode);
        ps.setDate(2, new java.sql.Date(df.parse(date[j]).getTime()) );
        ps.setString(3, warranty[j]);
        ps.setString(4, filter[j]);
        ps.setInt(5, Integer.parseInt(tech_comm[j]));
        ps.setInt(6, Integer.parseInt(dealer_comm[j]));
  >> System.out.println(techcode+":"+warranty[j]+":"date[j]+":"+filter[j]+":"+tech_comm[j]+":"+dealer_comm[j]);
        ps.executeQuery();


and this is the error:
Passtrue
FKS:KELVIN:02/02/2003:A:12:12
java.sql.SQLException: General error
        at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6987)
        at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
        at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
        at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214)
        at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery(JdbcOdbcPreparedStatement.java:89)
        at org.apache.jsp.tech_0005fconfirm$jsp._jspService(tech_0005fconfirm$jsp.java:123)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
 
In fact i have entered 2 rows of data... but can't see the second one...
Passtrue
FKS:KELVIN:02/02/2003:A:12:12
java.sql.SQLException: General error
        at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6987)
        at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
        at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
        at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214)
        at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:136)
        at org.apache.jsp.tech_0005fconfirm$jsp._jspService(tech_0005fconfirm$jsp.java:123)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.se


*******

for (int j=0;j<warranty.length;j++) {
       if ((warranty[j] != null) && (warranty[j].length() > 0)) {
        ps.setString( 1, techcode);
        ps.setDate(2, new java.sql.Date(df.parse(date[j]).getTime()) );
        ps.setString(3, warranty[j]);
        ps.setString(4, filter[j]);
        ps.setInt(5, Integer.parseInt(tech_comm[j]));
        ps.setInt(6, Integer.parseInt(dealer_comm[j]));
        System.out.println(techcode+":"+warranty[j]+":"+date[j]+":"+filter[j]+":"+tech_comm[j]+":"+dealer_comm[j]);
        ps.executeUpdate();
        out.println("Warranty " + warranty[j]);
    }
Timyates... come back to you tomorroow...

thank for your time...
Right...here we go...  the definitive way to do it...  this *will* work ;-)

---------------------

Connection conn=null;
try
{
    SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    conn = DriverManager.getConnection("jdbc:odbc:myDSN");
   
    for (int j=0;j<warranty.length;j++)
    {
        if ((warranty[j] != null) && (warranty[j].length() > 0))
        {
            PreparedStatement ps =null;
            try
            {
                ps = conn.prepareStatement( "Insert into Service values(?,?,?,?,?,?);" );
                ps.setString( 1, techcode);
                ps.setDate(2, new java.sql.Date(df.parse(date[j]).getTime()) );
                ps.setString(3, warranty[j]);
                ps.setString(4, filter[j]);
                ps.setInt(5, Integer.parseInt(tech_comm[j]));
                ps.setInt(6, Integer.parseInt(dealer_comm[j]));
                if( ps.executeUpdate() != 1 )
                {
                    out.println( "Insert failed for " + warranty[ j ] ) ;
                }
                else
                {
                    out.println("Warranty " + warranty[j]);
                }
                System.out.println(techcode+":"+warranty[j]+":"+filter[j]+":"+tech_comm[j]+":"+dealer_comm[j]);
            }
            finally
            {
                try { if( ps != null ) ps.close() ; } catch( Exception ex ) { }
            }
        }
    }
    System.out.println("NUM"+num);
}
catch( Exception e )
{
    e.printStackTrace();
}
finally
{
  try { if( conn != null ) conn.close() ; } catch( Exception ex ) { }
}
You have to close your PreparedStatement between each insert...you cannot reuse it :-)

Hope that's ok!

(I havent compiled it, but it should work) :-)
>> this *will* work ;-)
>> (I havent compiled it, but it should work) :-)

What was the conclusion on the ";" at the end of the statement (which I notice you've kept in) ?
seems to work :-)

I guess it just gets ignored by the driver...
> (which I notice you've kept in)

Hehehe...I forgot to remove it ;-)

I think the problem here was reusing the PreparedStatement without first closing and reopening a new one...

maybe......
OK :-)
didn't have time to read everything and try but here are my 2 cents:

>>     ps = conn.prepareStatement( "Insert into Service values(?,?,?,?,?,?);" );
the sql statement is not correct. remove the ';' in the end. that will make access to think that's 2 statement and try to execute ';' after instert.

>>         ps.executeQuery();
this shoudl be ps.executeUpdate() instead.

>> Aren't it's (warranty.length) should only contain how many row i key in?
warranty.length contains number of warrenty form fields in you form, the only exception to this is checkbox form field, which only returns those checked.

>> I think the problem here was reusing the PreparedStatement without first closing and reopening a new one...

PreparedStatement is designed to be executed multiple times without reopening. This isn't a problem.

If my comment contains answers already given by others, then ignore that part and accept others.
I better have a crack now that everyone else has done the hard work :)

   // Create your statement before the loop and reuse it for each iteration

   PreparedStaement ps = conn.prepareStatement( "Insert into Service values(?,?,?,?,?,?)" );

   for (int j=0;j<warranty.length;j++)
    {
        if ((warranty[j] != null) && (warranty[j].trim().length() > 0))
        {
            try
            {
                ps.setString( 1, techcode);
                ps.setDate(2, new java.sql.Date(df.parse(date[j]).getTime()) );
                ps.setString(3, warranty[j]);
                ps.setString(4, filter[j]);
                ps.setInt(5, Integer.parseInt(tech_comm[j]));
                ps.setInt(6, Integer.parseInt(dealer_comm[j]));
                if( ps.executeUpdate() != 1 )
                {
                    out.println( "Insert failed for " + warranty[ j ] ) ;
                }
                else
                {
                    out.println("Warranty " + warranty[j]);
                }
                System.out.println(techcode+":"+warranty[j]+":"+filter[j]+":"+tech_comm[j]+":"+dealer_comm[j]);
            }
        }
    }
What's the catch?

Or should I say *Where*'s the catch ;-)
you should probably also explicitly state the column names in your insert so there is no mismatching occurring.
OK. guys.. i am back. Let me try one by one suggested by all the "Big name" here... he..
get back you one by one
First try, TimYates suggestion on  Date: 12/02/2003 06:05AM PST --- same error... this time event worst.. no System.out.println() come out..but its pointing to the   if( ps.executeUpdate() != 1 ) (tech_0005fconfirm$jsp.java:163) adn trust me, i hae remove the ";" in the preparedstatement. :-)

Passtrue
java.sql.SQLException: General error
        at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6987)
        at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
        at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
        at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214)
        at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:136)
        at org.apache.jsp.tech_0005fconfirm$jsp._jspService(tech_0005fconfirm$jsp.java:163)

>>you should probably also explicitly state the column names in your insert
object, is something like this?
PreparedStaement ps = conn.prepareStatement( "Insert into Service values(?,?,?,?,?,?)" );
or
PreparedStatement ps = conn.prepareStatement("Insert into Service (TechName, ServiceDate, Warranty, Filter, TCom,DCom) values (?,?,?,?,?,?)");

Hm... doesn't work also.... this is the error.

Passtrue
java.sql.SQLException: General error
        at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6987)
        at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
        at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
        at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214)
        at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:136)
        at org.apache.jsp.tech_0005fconfirm$jsp._jspService(tech_0005fconfirm$jsp.java:164)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at org.
and it's pointing to the same place of the code....

:-( I am crying already....
Guys.. let's start from the very very basic one... since it's GENERAL ERROR...

why no one give comments on the database shcema that i have created?? i have a strong feeling on this...

have a look again.

Table name:Service
Columns :  TechName (text)
                 ServiceDate (Date/Time)
                 Warranty (Text)
                 Filter (Text)
                  TCom (Num - Long Integer)
                 DCom (Num - Long Integer)

The catch is the Num-long integer.. i have no idea what is this long integer means.. and what i've planned to insert is 12.22 is possible. But for the testing that i have done, i only enter integer which is 12 ONLY.

Should i change ?? i mean the data type?? because it's look the code is all right...
this is my code :

try
{
   SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
   conn = DriverManager.getConnection("jdbc:odbc:myDSN");
 
    for (int j=0;j<warranty.length;j++)
    {
       if ((warranty[j] != null) && (warranty[j].length() > 0))
        {
           PreparedStatement ps =null;
           try
           {
               ps = conn.prepareStatement("Insert into Service (TechName, ServiceDate, Warranty, Filter, TCom, DCom) values (?,?,?,?,?,?)");
               ps.setString( 1, techcode);
               ps.setDate(2, new java.sql.Date(df.parse(date[j]).getTime()) );
               ps.setString(3, warranty[j]);
               ps.setString(4, filter[j]);
               ps.setInt(5, Integer.parseInt(tech_comm[j]));
               ps.setInt(6, Integer.parseInt(dealer_comm[j]));
               if( ps.executeUpdate() != 1 ){
                   System.out.println( "Insert failed for " + warranty[ j ] ) ;
               } else {
                   out.println("Warranty " + warranty[j]);
               }
               System.out.println(techcode+":"+warranty[j]+":"+filter[j]+":"+tech_comm[j]+":"+dealer_comm[j]);
           }
           finally
           {
               try { if( ps != null ) ps.close() ; } catch( Exception ex ) { ex.toString(); }
           }
       }
   }
   System.out.println("NUM"+num);
}
catch( Exception e ) {    e.printStackTrace(); }
finally
{
 try { if( conn != null ) conn.close() ; } catch( Exception ex ) { }
}

and this is the error




Passtrue
java.sql.SQLException: General error
        at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6987)
        at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
        at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
        at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(JdbcOdbcPreparedStatement.java:214)
        at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(JdbcOdbcPreparedStatement.java:136)
        at org.apache.jsp.tech_0005fconfirm$jsp._jspService(tech_0005fconfirm$jsp.java:163)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
can you also check the lenght of text column of your table is big enough to hold your data?
you're unnecessarily recreating and closing your statement, though this is not related to your error.

try to do the insert directly into the database (without Java) and see if that gives you a better indictation of what the problem is.
ASKER CERTIFIED SOLUTION
Avatar of kennethxu
kennethxu

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And were you getting this error way back when this question began??
ken, TQ for that. (Simulating the situation) for me.

I have check the Field Size, it's correct.
TechName - Filed Size=25
ServiceDate = default, no specific
Warranty = Filed Size=8
Filter = 2
TCom-Long integer- default
DCom - Long Integer-default

let me get you the whole page after i have changed like your page does...


Object,
>>And were you getting this error way back when this question began??
what does this mean?
> what does this mean?

Before you asked this question, were you getting this error "java.sql.SQLException: General error" ?
hm.. good idea.. hard code the value... let me see this:

ha... i've sovled it. Thank you for your brainstorming..... :-)
The answer for this is....

this is my original input page

input.jsp
======
Techcode : <input type="text" name="techcode" />

for (int i=0; i<10; i++) {
...
..
..}

and for my updateid.jsp

String [] techcode = request.getParameterValues("techcode");


everything look fine.. but for my Database, I HAVE SET THE TECHCODE AS A PRIMARY KEY!!!
and now it's going to insert a duplicate value while the techcode is still the same....

:-)

general error... i think thats mean by the databse error.. not the coding...

THANK YOU VERY ONe.. i am so happy for it........
By the way, the TCom and Dcom datatype, if it's going be long integer, can i insert 12.20 or 0.35?

or you think i should use Double or Integer??
use Double
friend... got errors... but nothing to shown... what had happend to this code?

try {
} catch (Exception e) { e.printStackTrace(); }

is in the code

Connection conn = null;
PreparedStatement ps = null;
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
int num=0;
if (pass) {

try {
  conn = DriverManager.getConnection("jdbc:odbc:myDSN");
  ps = conn.prepareStatement("Insert into Service (TechName, ServiceDate, Warranty, Filter, TCom, DCom) values (?,?,?,?,?,?)");
 
   for (int j=0;j<warranty.length;j++)
    {
      if(warranty[j].length() > 0) {
       out.println(techcode+",");
       out.println(warranty[j]+",");
       out.println(filter[j]+",");
       out.println(tech_comm[j]+",");
       out.println(dealer_comm[j]+"<br>");
       ps.setString( 1, techcode);
       ps.setDate(2, new java.sql.Date(df.parse(date[j]).getTime()) );
       ps.setString(3, warranty[j]);
       ps.setString(4, filter[j]);
       ps.setInt(5, Integer.parseInt(tech_comm[j]));
       ps.setInt(6, Integer.parseInt(dealer_comm[j]));
       ps.executeUpdate();
      }
   }
   out.println("Num " +num);
} catch( Exception e ) {
  e.printStackTrace();

but the entry doesnt go in yet.. no exception thrown...
whats the output?
no output... nothing come out.. thats surpirse...
anyway, let me try my luck to troubleshoot first...
only way i could see that could happen is if pass is false.
o/wise at least this line "out.println("Num " +num);" would be executed.
or a stack trace
>> e.printStackTrace();
try
e.printStackTrace( new java.io.PrintWriter( out ) );
Glad to know your problem is solved.

I feel guilty to get all the points since everybody helped here and there. I'm going to post points for you guys:

jimmack: https://www.experts-exchange.com/questions/20816494/points-for-jimmack.html
TimYates: https://www.experts-exchange.com/questions/20816495/points-for-TimYates.html
objects: https://www.experts-exchange.com/questions/20816497/points-for-objects.html