[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

java.sql.SQLException: General error

Posted on 2003-11-23
9
Medium Priority
?
1,244 Views
Last Modified: 2007-12-19
i have this error.

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 beans.customer.insert(customer.java:98)
        at org.apache.jsp.customer_0005fconfirm$jsp._jspService(customer_0005fconfirm$jsp.java:150)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

and this is the code.

       public void getConnection() throws SQLException, ClassNotFoundException {
           try {
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
               conn = DriverManager.getConnection("jdbc:odbc:myDSN");
           } catch (Exception e) { e.printStackTrace(); }
        }
     
        public void insert() {
            try {
            getConnection();
            PreparedStatement pstmt=null;
            pstmt=conn.prepareStatement("insert into Customer values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
            pstmt.setString(1, customer );
            pstmt.setString(2, customercode );
            pstmt.setString(3, warranty );
            pstmt.setString(4, ic );
            pstmt.setString(5, addr1 );
            pstmt.setString(6, addr2 );
            pstmt.setString(7, addr3 );
            pstmt.setString(8, postcode );
            pstmt.setString(9, state );
            pstmt.setString(10, area  );
            pstmt.setString(11, tel );
            pstmt.setString(12, handphone );
            pstmt.setString(13, dob );
            pstmt.setString(14, dop );
            pstmt.setString(15, dealer );
            pstmt.setString(16, status );
            pstmt.setString(17, remark);
            pstmt.setString(18, operator );
            pstmt.setString(19, date );
            pstmt.execute();
            }catch (Exception e) {
                e.printStackTrace();
            }
        }

customer.java:98 is pointing to this line,
       pstmt.execute();

Can you tell me what is going on? I am using the ODBC-JDBC bridge. This is setting is done using the XP Profesional ODBC admnistrative task.
What is the "General Error" means? I am sure it's npt general for me.. Ha... :-)
0
Comment
Question by:heman7719
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
9 Comments
 
LVL 14

Accepted Solution

by:
sudhakar_koundinya earned 580 total points
ID: 9808422
is conn object is created at class level?
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9808426
i doubt this statement also


pstmt=conn.prepareStatement("insert into Customer values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

should be some thing like this

pstmt=conn.prepareStatement("insert into Customer (customer,costomercode,... ) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");


because table should containg only 19 columns when you follow your procedure
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9808440
is it possible to post your table structure?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:heman7719
ID: 9809125
sudhakar, thank you for your time.

1. conn obeject was created at the beginning of my class. :-)
2. the prepared statement means i am creating the whole DB schema at one shoot. in my db, i have totally 19 fields. then i mean, foloow by the sequence, i insert it one by one.
3. During my design of the db, i set no one as a primary key. i doubt this is the one who causing me this problem.

By the way, what is the General Errors means for me? Is this general consist of what kind of error? Null Pointer? or data truncation?? etc..??
0
 

Author Comment

by:heman7719
ID: 9809138
and one funny things is i still can insert data into my table. I mean the insert() statement.....

but the error come out... what is happening?

0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9809703
Ok can u do some thing like this and let me know?

(customer,customerid,....) values(...,...,...,...,) bla bla bla

i doubt here if we use all columns at a time

0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 9809708
>>i doubt here if we use all columns at a time

i mean  without specifying column names
0
 
LVL 3

Expert Comment

by:savalou
ID: 9811125
Try a pstmt.executeUpdate() rather than just an execute().
0
 

Author Comment

by:heman7719
ID: 9822491
sudhakar_koundinya , sovled the problem.

It's beause on my Access database, i specified a field whereby is Primary key and i update a reduntant data for that fields... prompt me error..

thank you for your time.
0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ransomware, the malware that locks down its victim’s files until they pay up, has always been a frustrating issue to deal with. However, a recent mobile ransomware will make the issue a little more personal… by sharing the victim’s mobile browsing h…
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question