Plz help in jdbc in db2.

hi friends i am new in eclipse and DB2-9
i write this code
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class T4DB2Connect
public static void main(String args [])
try
Class.forName("com.ibm.db2.jcc.DB2Driver");
Connection con =DriverManager.getConnection("jdbc:db2//localhost:50000/test","username","password");
Statement st=con.createStatement();
String query="select * from test ";
ResultSet rs=st.executeQuery(query);
while(rs.next())
System.out.println("username is "+rs.getString(1));
System.out.println("and student number is "+rs.getString(2));
//System.out.println("row inserted");
con.close();
catch(Exception e)
System.out.println("error is "+e.getMessage());
now when i run this code i found the following error
error is No suitable driver
although database is working properly. plz help me .
thanks

hi Balcus C thanks for the information now i ma pasting code as u said . but still there is a problem
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class T4DB2Connect
     public static void main(String args [])
          try
               Class.forName("com.ibm.db2.jcc.DB2Driver");
               Connection con =DriverManager.getConnection("jdbc:db2://localhost:50000/test","anshuldb2","tgmc2008");
               Statement st=con.createStatement();
               String query="select * from anshuldb2.test ";
               ResultSet rs=st.executeQuery(query);
               while(rs.next())
                    System.out.println("username is   "+rs.getString(1));
                    System.out.println("and student number is   "+rs.getString(2));
               //System.out.println("row inserted");
               con.close();
          catch(Exception e)
               e.printStackTrace();
}now i am using the same code with print stack trace and in jdbc url jdbc:db2://localhost:50000/test","anshuldb2","tgmc2008
where anshuldb2 is the username and tgmc2008 is the password now i get the error
com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -204, SQLSTATE: 42704, SQLERRMC: ANSHULDB2.TEST
     at com.ibm.db2.jcc.c.fg.e(fg.java:1596)
     at com.ibm.db2.jcc.c.fg.a(fg.java:1206)
     at com.ibm.db2.jcc.b.gb.g(gb.java:140)
     at com.ibm.db2.jcc.b.gb.a(gb.java:39)
     at com.ibm.db2.jcc.b.w.a(w.java:34)
     at com.ibm.db2.jcc.b.vb.g(vb.java:139)
     at com.ibm.db2.jcc.c.fg.n(fg.java:1177)
     at com.ibm.db2.jcc.c.fg.a(fg.java:1832)
     at com.ibm.db2.jcc.c.fg.a(fg.java:473)
     at com.ibm.db2.jcc.c.fg.executeQuery(fg.java:457)
     at T4DB2Connect.main(T4DB2Connect.java:17)
i am unable to solve this problem here i use the query "Select * from anshuldb2.test" thsi is told to me by my project mentor. plz help me.

Similar Messages

  • How to use % wildcard in jdbc plz help me

    Hello all,
    try
         PreparedStatement st=dbcon.prepareStatement("select * from stud2  where ename=? ");
    st.setString(1,ename+"%");
    ResultSet rs=st.executeQuery();
    while(rs.next())
    out.println("<td>");
    out.println(rs.getString(2));//this field is for name
    out.println(rs.getString(3));//this is for addresss
    }catch(Exception e){}This code is in servlets,and iam using MS-ACCESS as database.
    in this way iam trying this code , usage of %wild card but iam not getting the right anser, i want the anser if i will type any letter it should search the database and display me all names of that letter
    plz help me solving this problem
    vidya.

    PreparedStatement ps = con.prepareStatement("select blah from blah where blah like ?");
    ps.setString(1, "a%"); // everything that starts with 'a'
    rs = ps.executeQuery();

  • Driver adding...| plz help

    i wrote a little servlet that works with db2 database , compiled it , deployed it but when i call it from the browser window it says that oit can t reach db2 driver ... may be i should add it somehow somewhere.... PLZ HELP
    ***********************************************************MY SOURSE CODE
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import javax.servlet.http.*;
    import javax.servlet.*;
    public class db2serv extends HttpServlet {
    public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
    res.setContentType("text/html;charset=Windows-1251");
    PrintWriter pw = res.getWriter();
    String title ="servlet/db2 example titll ?";
    pw.println("<HTML><HEAD><TITLE>"+title+"</TITLE> </HEAD>");
    pw.println("<BODY>");
    pw.println("<H1>"+title +"</H1>");
    try {
    Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
    Connection con = DriverManager.getConnection("jdbc:db2:irabase","login","passwd");
    Statement st = con.createStatement();
    ResultSet rs = st.executeQuery("select * from cname");
    /* output */
    pw.println("<TABLE>");
    while (rs.next()) {
    pw.print("<TR>");
    pw.println("<TD>"+rs.getString(3)+"</T D>");
    pw.println("</TR>");
    pw.println("</TABLE>");
    pw.println("<h2>The en</h2>");
    rs.close();
    st.close();
    } catch (Exception e) {
    throw (new ServletException(e));
    pw.println("</BODY>");
    pw.println("</HTML>");
    pw.close();

    error messege says:
    javax.servlet.ServletException: No suitable driver
         at db2serv.doGet(db2serv.java:40)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:197)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:368)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
         at java.lang.Thread.run(Thread.java:484)
    root cause
    java.sql.SQLException: No suitable driver
         at java.sql.DriverManager.getConnection(DriverManager.java:537)
         at java.sql.DriverManager.getConnection(DriverManager.java:177)
         at db2serv.doGet(db2serv.java:21)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:197)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:176)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:172)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:368)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
         at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
         at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
         at java.lang.Thread.run(Thread.java:484)

  • Plz help using ms access as database,i want to create a login page in java

    hye frnz... plz help me m new to java
    m using ms access as database and try to create a login page where user type username and pw
    i had enter valid user entries in database i checked connectivity is working i want as user login the main window must open after checking username and pw field to database but
    now there is an error class not found exception sun:jdbc...... error
    plz help me i had stuck frm 4 days */
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    class Login extends JFrame
    //Component Declarations
    JLabel jlb1,jlb2;
         JTextField jtf1;
         JPasswordField jpf1;
         JButton jb1,jb2;
         //Constructor
         Login()
         //frame settings
              setTitle("Login Dialog");
              setLayout(new GridBagLayout());
              GridBagConstraints gbc = new GridBagConstraints();
              setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
              Dimension d= Toolkit.getDefaultToolkit().getScreenSize();
              setBounds(d.width/2-175,d.height/2-100,350,200);
              gbc.insets=new Insets(7,7,7,7);
         //adding components
              jlb1=new JLabel("User ID");
              gbc.gridx=0;
              gbc.gridy=0;
              add(jlb1,gbc);
              jlb2=new JLabel("Password");
              gbc.gridx=0;
              gbc.gridy=1;
              add(jlb2,gbc);
              jtf1=new JTextField(10);
              gbc.gridx=1;
              gbc.gridy=0;
              add(jtf1,gbc);
              jpf1=new JPasswordField(10);
              gbc.gridx=1;
              gbc.gridy=1;
              add(jpf1,gbc);
              jb1=new JButton("Login");
              gbc.gridx=0;
              gbc.gridy=2;
              add(jb1,gbc);
              jb1.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                   Connection conn=null;
                        Statement stmt=null;
                        boolean found=false;
                   try
                             Class.forName("sun.jdbc.driver.JdbcOdbcDriver");
                             String dataSourceName = "Inventory";
                             String dbURL = "jdbc:odbc:" + dataSourceName;
                             conn=DriverManager.getConnection(dbURL, "","");
                             stmt=conn.createStatement();
                             ResultSet rst=stmt.executeQuery("Select * from User");
                             System.out.println(jtf1.getText()+"/t"+jpf1.getPassword());
                             while(rst.next())
                                  System.out.println( rst.getString(1) +"/t"+ rst.getString(2));
              if(jtf1.getText().equals(rst.getString(1).trim()) && new String(jpf1.getPassword()).equals(rst.getString(2).trim()))
                                       found=true;
                                       rst.close();
                                       dispose();
                                       MainWindow mw= new MainWindow();     /*created min window object created to be opend after login but not working*/     
                                       break;
                             rst.close();
                             stmt.close();
                             conn.close();                    
                        catch(ClassNotFoundException e){System.out.print(e);}
                        catch(Exception e){System.out.print(e);}
                        if(found==false) /*this portion is executing and dialog box appears invalid name and pw with class not found exception sun:jdbc.......on console */
                             JOptionPane.showMessageDialog(null,"Invalid username or password",
                                  "Error Message",JOptionPane.ERROR_MESSAGE);
              jb2=new JButton("Clear");
              gbc.gridx=1;
              gbc.gridy=2;
              add(jb2,gbc);
              jb2.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent ae)
                        jtf1.setText("");
                        jpf1.setText("");
                        jtf1.requestFocus();
              setSize(350,200);
              setVisible(true);
              jtf1.requestFocus();
         public static void main(String args[])
    Login l=new Login();
    Edited by: 795772 on Sep 19, 2010 4:44 AM

    795772 wrote:
    hye frnz... plz help me m new to java
    m using ms access as database and try to create a login page where user type username and pw
    i had enter valid user entries in database i checked connectivity is working i want as user login the main window must open after checking username and pw field to database but
    now there is an error class not found exception sun:jdbc...... error
    plz help me i had stuck frm 4 days */
    <snip>The subject of this forum is Oracle databases. How does your problem relate to that subject?
    Two bits of advice:
    1) Make sure you ask questions in a forum related to your problem.
    2) If you want to be taken seriously as a professional, drop the MS IM Speak and use the language of the forum. In this forum it is English, which is successfully used by many people for whom English is far from their native language.

  • Plz. help,table does not show value for one field

    hi all,
    i have a really strange problem , i have a string field in access database that contains the date and time value,this field for some strange reason does not show in my table created through html,
    i tried all combination(arranging the fields) ,renaming it w/o help, it shows the value using out.println(but then why is it not showing me in the table???)
    plz. help ASAP.
    the code is as under
    <HTML>
    <HEAD><TITLE> LOGGED IN ok</TITLE> </HEAD>
    <BODY bgcolor = "yellow">
    <%@ page import = "java.sql.*" %>
         <%! // declaring variables
    String s = "";
    java.sql.ResultSet rs=null,rs1=null,rs2=null;
    java.sql.Connection con;
    java.sql.Statement stmt,stmt1;
    String empId = "",compid ="",calltype ="",probheader="",probdescription ="",probcomment ="",priority ="",a="";
    %>
    Following are the pending complaints ..
         <TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 width="100%">
         <TR>
         <TD> ComplainD </TD>
    <TD> ComplainId </TD>     
    <TD> ProbHeader </TD>     
    <!--
    <TD> ProblemDescription </TD>     
    <TD> Problem Comments </TD>     
    -->
    </TR>
         <%
         try
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         java.sql.Connection con = java.sql.DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};" +"DBQ=c:/vishal/HelpDesk.mdb;DriverID=22;READONLY=false","","");
         //java.sql.Connection con = java.sql.DriverManager.getConnection("jdbc:odbc:Portal");
              java.sql.Statement stmt = con.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE,java.sql.ResultSet.CONCUR_READ_ONLY);
              s = "select * from Complains";
         java.sql.ResultSet rs = stmt.executeQuery(s);               
                        while(rs.next())
                        //getting data from database
                                                           empId = rs.getString("EmpId");                    // out.print(" " + empId);
              compid = rs.getString("ComplainId");
              // out.print(" " + compid);
              calltype = rs.getString("CallType");
              // out.print(" " + calltype);
                        a = rs.getString("Complaindate"); //problem with this field
    out.print(a); // prints value
              %>               
                        <TR>      
                        <TD> <%=compid %> </TD>
                        <TD> <%=calltype %> </TD>     
                        <TD <%=a %> </TD>
                                       </TR>
    <%
                        }//while loop          
         %>
         </TABLE>     
         <%                
         }//try
              catch(Exception ep)
              out.println(ep);
              System.exit(1);
    %>
    </BODY>
    </HTML>
    value in database is as follows :-
    Complaindate
    5/18/2003 1:30:27 PM
    5/18/2003 7:32:43 PM
    5/18/2003 7:34:02 PM
    5/18/2003 7:49:19 PM
    5/18/2003 7:50:27 PM
    5/18/2003 10:49:42 PM
    5/18/2003 10:58:24 PM
    thanking u ,plz ask if any further clarifications

    Hi
    I am seeing nothing wrong with ur code..
    what about "view source" result.....plz check with that...
    whether u r getting all the trs and tds...
    revert back on this Issue..
    Mars Amutha

  • Urgent plz help me......plz

    Am very nem to jsp.
    am doing my final year project in jsp.
    I want to retreive value in the textbox depending on the selectino made in the dropdown.
    in the dropdown menu i retrieve employee id frm backend. n in the textbox i shuld get employee name depending on the selection made in the dropdown list. that is data in the textbox shuld change depending on the selectin made in dropdown.
    here is my code which i tired but in the textbox the value is alwys remaning the last record value n it is not changing depending on slectino made in dropdwon list
    <%@ page import="java.util.*" %>
    <%@ page language="java" %>
    <%@ page import="java.sql.*" %>
    <HTML>
    FAQ
    Category choice
    <FORM ACTION="selection.jsp" METHOD="POST">
    <%
    String nameselection = null;%>
    <SELECT NAME="Category" id= Category >
    <%
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn=DriverManager.getConnection("jdbc:odbc:man","scott","tiger");
    Statement statement = conn.createStatement();
    ResultSet rs = statement.executeQuery("SELECT DISTinCT empid FROM employee" );%>
    <OPTION VALUE='nochoice'>Please choose a category</OPTION>";
    <%while(rs.next()) {
    nameselection = rs.getString("empid");%>
    <OPTION value ="optcategory"><%out.println(nameselection);%>
    </OPTION>
    <% } %>
    </SELECT>
    Question selection
    <%
    String password = null;%>
    <%ResultSet m1 = statement.executeQuery("SELECT * FROM employee WHERE empid = ( '" + nameselection + "')");
    String mm1;
    while(m1.next()){%>
    <input type =text name=mm value="<%= m1.getString(2) %>">
    <%}%>
    </FORM>
    </HTML>
    plz help me....
    am very new to it.
    Thanx in advance

    hi manisha
    good try & sorry for late reply
    To say the truth i'm too new to jsp
    i'll give u my code see it for reference.. if u have any doubts in that pls don't forget to ask me
    function display()
      var index=document.form1.drug.value;
      document.form1.hid.value=index;
      form1.submit();
    function refresh()
         var indexOfcombobox = document.form1.drughid.value;
         sel = document.form1.drug;
         for (i=0; i<sel.options.length; i++) {
              if (sel.options.text ==indexOfcombobox ) {
                   sel.selectedIndex = i;
    <form name="form1" method="post" action="">
    <body onload="refresh() ">
    <select name="drug" id="drug" value="hid" onChange="display()">
    <option value="" selected> </option>
    <%
    while(rs.next())
    %>
    <OPTION VALUE="<%=rs.getString("DrugName")%>"><%=rs.getString("DrugName") %></OPTION>
    <%
    %>
    </select>
    <input type="hidden" name="hid">
    </div></td>
    </tr>
    <tr>
    <td>NDC code #</td>
    <td>
    <%
    //query for selecting the values from the database
    String sql1 = "SELECT ProductCode,DrugName,Dosageform from ProductMaster where DrugName='"+request.getParameter("hid")+"' ";
    rs=stm.executeQuery(sql1);
    %>
    <% while (rs.next())
    String val1=rs.getString("ProductCode");
    String val2=rs.getString("DrugName");
    String val3=rs.getString("Dosageform");
    out.println (val1 +"</td>");
    out.println ("<input type=hidden name=ndc value='" + val1 + "'>");
    out.println ("<input type=hidden name=drughid value='" + val2 + "'>");
    out.println("<td>Dosageform    :     "+val3);
    }Regards
    kalai                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Problem in Connection Polling? Plz Help Me

    This is the Error i got.....
    weblogic.jdbc.extensions.ConnectionDeadSQLException: weblogic.common.resourcepool.ResourceDeadException: 0:Could not create pool connection. The DBMS driver exception was: [BEA][Oracle JDBC Driver]Error establishing socket. Connection timed out: connect
    My application is runing Fine when small numer of users & less Database Connection Objects used.
    When more user it gives THIS Error.
    i increased the Connection poll Size But Again it gives the same error.....
    yesterday my server(Linux) was Hanged(problem with RAM) . Today
    we changed the RAM and its working fine. But the connection Polling is the current Problem.
    test Connection is Working Fine. But more Connection its not Working,
    giving this error...
    weblogic.jdbc.extensions.ConnectionDeadSQLException: weblogic.common.resourcepool.ResourceDeadException: 0:Could not create pool connection. The DBMS driver exception was: [BEA][Oracle JDBC Driver]Error establishing socket. Connection timed out: connect
    Plz help Me.....
    regards
    raghavan

    You can use like this:
    Order By
       Depot_Code,
       Bl_No nulls first ,
       Booking_No

  • Plz help me from the error - "org.apache.jasper.jasperException"

    I am getting error with this code ,plz help me out ,i wanna correct this urgently
    I've set the Environment variables JAVA_HOME and
    CATALINA_HOME and here is my coding and error report
                   hello.html
    <head><title>Database</title></head>
    <body>
    <form method="get" action="add.jsp">
    <pre>
    <center>Enter ur Name :<input type="text" name="nam" >
    <br><input type="submit" value=" Add ">
    </center></pre>
    </form>
    </body>
    </html>
                   add.jsp
    <%@ page language="java" %>
    <%@ page import="java.sql.*" %>
    <html>
    <head><title>JSP</title></head>
    <%! String name;
    Connection con=null;
    Statement st=null;
    %>
    <body>
    <% name=request.getParameter("nam");
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    //I have created a User DSN sjp
    con = DriverManager.getConnection("jdbc:odbc:sjp");
    st = con.createStatement();
    st.executeUpdate("insert into detail values('"+name+"')");
    catch(Exception e)
    con.close();
    st.close();
    %>
    <h1> Name Added</h1>
    </body>
    </html>
                   Error
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:207)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:534)
    root cause
    java.lang.NullPointerException     at org.apache.jsp.add_jsp._jspService(add_jsp.java:66)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:92)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:162)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:534)
    Apache Tomcat/4.1.31

    hi,
    when i use the code
    if(st != null)st.close();
    if(con != null ) con.close();
    that works good ,the old error has been corrected.
    but it's now throwing an SQLException[b] "datasource name not found and default driver not specified" why this occurs and also can u give me the explanation for the old error????
    I am sure that i have created an user DSN, i am 100% sure about it .even though there is an error.
    Deepak.
    Deepak.C

  • Plz help me, no display output during boot up of 715 workstation

    now i have a HP 715 model workstation,today, conneted hp monitor..but can't display output during system boot up so i tried  solve this problem,1)changed battery2)removed HDD after reboot system and press ESC key    => now can't use Keyboard..not working key board3)Press Tap key.. Just i think, this problem is system configulation problem. not monitor problem..so i found internet website..but now i can not change configulation who know this problem.plz help me  

    one question in html submit the reslut stored jdbc that value shows barchartAll your base are belong to us!
    You know, while I understand that English isn't your first language (neither is it mine) and there's no need to be perfect: if you can't write an understandable post yourself, consider asking someone to do it for you.

  • Code for radio button is not working plz help

    checkboxes are working fine but when i put radio code submit button does nothing
    plz help
    thanks in advance
    <%@ page language="java" contentType ="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" import= "java.sql.*,java.io.*,com.anaghan.MyBeans.CmsConnection"%>
    <jsp:useBean id="obj" scope="request" class="com.anaghan.MyBeans.DepartmentBean"/>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <script language="javascript" >
    function cmdOnSelect()                                   
                   var deptcode=document.DepartmentPage.cmdSelect.value;
                   DepartmentPage.method="post";
                   DepartmentPage.action="./vsnlemployee_calldatasheetcallhistory.jsp?flag=select&cmdSelect="+deptcode;
                   DepartmentPage.submit();           
    function validate()
         var user_etime = document.DepartmentPage.etime.value;
         var etime_length = document.DepartmentPage.etime.value.length;
         var user_edate = document.DepartmentPage.edate.value;
         var edate_length = document.DepartmentPage.edate.value.length;
         var user_calltype = document.DepartmentPage.calltype.value;
         var calltype_length = document.DepartmentPage.calltype.value.length;
         var user_callstatus = document.DepartmentPage.callstatus.value;
         var callstatus_length = document.DepartmentPage.callstatus.value.length;
         if( edate_length==0 )
              alert("Please enter the call date");
              return false;
         else if( calltype_length==0 )
              alert("Please enter the call type");
              return false;
         else if( callstatus_length==0 )
              alert("Please enter the call status");
              return false;
         else if( etime_length==0 )
              alert("Please enter the call timing");
              return false;
         else if(etime_length!=0 && etime_length!=4)
              alert("Entered timing is invalid");
              return false;
         else if (etime_length!=0)
              for (var i = 0; i < etime_length; i++)
                   valid_characters = new RegExp ("[0-9]", "g");
                   var part_user_etime = user_etime.charAt (i);
                   if (!valid_characters.test (part_user_etime))
                        alert("Special characters like '" + part_user_etime + "' are not allowed in timing" );
                        return false;
                   valid_characters = null;
              return true;
         else
              return true;
    function cmdOnClick()                                   
              if (validate())
                        DepartmentPage.method="post";
                        DepartmentPage.action="/anaghan/CallSheet?flag=call";     
                        DepartmentPage.submit()     
    </script>
    <script language="javascript" src="calendar1.js">
    </script>
    </head>
    <body>
    <%
    String uname=(String)session.getAttribute("employeeName");
    if(uname==null)
         response.sendRedirect("/Error.jsp?login=Login Session Problem");
    %>
    <%
         String date1="";
         String date2="";
    %>
    <%!
         ResultSet rs=null;
         Connection con =null;
         String conStr="sun.jdbc.odbc.JdbcOdbcDriver";
         String tableStr="jdbc:odbc:Anaghan";
    %>
    <%
         String companycode=request.getParameter("cmdSelect");
         HttpSession hs = request.getSession();
         hs.setAttribute("companycode",companycode);
         System.out.println("CALLLLL="+companycode);
    %>
    <%
         String flag="";
         String deptcode="";
         String commissioningdate="";
         String closuredate="";
    %>
    <%
         String a2="";String a1="";
    %>
    <form name="DepartmentPage" >
    <TABLE cellSpacing=0 cellPadding=0 width="100%" border="0" >
         <TR>
              <TD align=CENTER>
                   <h2> CALL DATA SHEET </h2>
              </TD>
         </TR>
         <TR>     
              <div>
                                  <FONT face="Arial " color=#000000 size=2>
              <TD valign="top">          
                   <TABLE cellSpacing=15 cellPadding=0 width="100%" border="0">
                        <TD width="50%" vAlign="top" align=CENTER height=24 bgcolor=#F8F8F8 >
                                       <tr>
                                            <TD align=RIGHT>Select Company - </TD>
                                                 <td><SELECT name="cmdSelect" size="1" onChange="cmdOnSelect();">
                                                 <OPTION SELECTED></OPTION>
                                                      <%
                                                           deptcode=request.getParameter("cmdSelect");
                                                           response.setContentType("text/html");
                                                           ResultSet rs = obj.onSelect();
                                                           while(rs.next())
                                                                String tempName=rs.getString(2);
                                                      %>
                                                 <OPTION id= "a<%=tempName %>" value= "<%=tempName%>"> <%=tempName %></OPTION>
                                                 <%}%>
                                                 </SELECT></td>
                                       </TR>
                                            </TD>
                                       </TABLE>
                                       <TABLE cellSpacing=15 cellPadding=0 width="100%" border="0">
                                            <TR>
                                                 <TD>
                                                 <table align="center" width="90%" cellspacing="2" cellpadding="2">
                                                      <tr>
                                                           <td align="center"><h2>Contact Person</h2></td>
                                                      </tr>
                                                 </table>
                                                 <table align="center" width="90%" border="1" cellspacing="2" cellpadding="2">
                                                 <tr><th>Name</th><th>Landline</th><th>Mobile</th><th>Fax</th><th>E-mail</th></tr>
                                                 <%!
                                                      ResultSet result=null;
                                                 %>
                                                 <%
                                                      response.setContentType("text/html");
                                                 try{
                                                      Connection con = DriverManager.getConnection("jdbc:odbc:Anaghan");
                                                      Statement stmt=con.createStatement();
                                                      result =stmt.executeQuery("select * from enquiry_details where companycode='"+deptcode+"' ");
                                                      while(result.next())
                                                      %>
                                                      <tr>
                                                           <OL><td align ="center"><%=result.getString(9) %></td>
                                                           <td align ="center"><%=result.getString(10) %></td>
                                                           <td align ="center"><%=result.getString(11) %></td>
                                                           <td align ="center"><%=result.getString(12) %></td>
                                                           <td align ="center"><%=result.getString(13) %></td></OL>
    <tr>
                                                           <OL><td align ="center"><%=result.getString(14) %></td>
                                                           <td align ="center"><%=result.getString(15) %></td>
                                                           <td align ="center"><%=result.getString(16) %></td>
                                                           <td align ="center"><%=result.getString(17) %></td>
                                                           <td align ="center"><%=result.getString(18) %></td></OL>
                                                           <%}
                                                      catch(Exception e)
                                                           e.printStackTrace();
                                                      }%>
                                                 </tr></table>
                                                 </TD>
                                            </TR>
                                            <TR>
                                                 <TD>
                                                 <table align="center" width="90%" cellspacing="2" cellpadding="2">
                                                      <tr>
                                                           <td align="center"><h2>Call History</h2></td>
                                                      </tr>
                                                 </table>
                                                 <table align="center" width="90%" border="1" cellspacing="2" cellpadding="2">
                                                 <tr><th>Call Type</th><th>Call Status</th><th>Service Type</th><th>Feedback</th><th>Next Visit</th><th>Call Date</th></tr>
                                                 <%!
                                                      ResultSet result1=null;
                                                 %>
                                                 <%
                                                      response.setContentType("text/html");
                                                 try{
                                                      result1=obj.onSelectCallHistory(deptcode);
                                                      while(result1.next())
                                                      %>
                                                      <tr>
                                                           <OL><td align ="center"><%=result1.getString(3) %></td>
                                                           <td align ="center"><%=result1.getString(4) %></td>
                                                           <td align ="center"><%=result1.getString(6) %></td>
                                                           <td align ="center"><%=result1.getString(7) %></td>
                                                           <td align ="center"><%=result1.getString(9) %></td>
                                                           <td align ="center"><%=result1.getString(8) %></td>
                                                           </OL>
                                                           <%}}
                                                      catch(Exception e)
                                                           e.printStackTrace();
                                                      }%>
                                                 </tr></table>
                                                 </TD>
                                            </TR>
                                       <TABLE cellSpacing=15 cellPadding=0 width="100%" border="0">
                                            <TD width="50%" vAlign="top" align=CENTER height=24 bgcolor=#F8F8F8 >
                                            <TR>
                                                 <TD></TD>
                                            </TR>
                                            <TR></TR>
                                            <TR>
                                                 <TD align=RIGHT>                                   
                                                 Type of Call - </TD>
                                            <td>
                                            <input type = radio name=calltype value=personal/>personal
                                            <input type = radio name=calltype value=email/>Email</td>
                                                 <!-- <TD><SELECT name="calltype" size="1" >
                                                      <OPTION SELECTED></OPTION>
                                                      <OPTION id= "s" value= "personal"> Personal </OPTION>
                                                      <OPTION id= "s" value= "telephonic"> Telephonic </OPTION>
                                                      <OPTION id= "s" value= "email"> E-mail </OPTION>
                                                      <OPTION id= "s" value= "meeting"> Meeting </OPTION>
                                                      </SELECT>
                                                 </TD>-->
                                            </TR>
                                            <TR>
                                                 <TD align=RIGHT>                                   
                                                 Status of Call - </TD>
                                                 <TD>
                                                 <SELECT name="callstatus" size="1" >
                                                      <OPTION SELECTED></OPTION>
                                                      <OPTION id= "s" value= "cold"> Cold </OPTION>
                                                      <OPTION id= "s" value= "warm"> Warm </OPTION>
                                                      <OPTION id= "s" value= "hot"> Hot </OPTION>
                                                      <OPTION id= "s" value= "closed"> Connection Executed </OPTION>
                                                      <OPTION id= "s" value= "upgrade"> Upgrade </OPTION>
                                                      <OPTION id= "s" value= "downgrade"> Downgrade </OPTION>
                                                      <OPTION id= "s" value= "shiftingoflocation"> Shifting of Location </OPTION>
                                                      <OPTION id= "s" value= "connectionterminated"> Connection Terminated </OPTION>
                                                      </SELECT>
                                                 </TD>
                                            </TR>
                                            <TR>
                                                 <TD align=RIGHT>Date - </TD>
                                                 <TD><input type="text" readonly name="edate" id="edate" size="10" value="<%=date1 %>">
                                                 <img src="./cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date">
                                                 </TD>
                                            </TR>
                                            <TR>
                                                 <TD align=RIGHT>                                   
                                                 Time - </TD>
                                                 <TD><input type="text" size="4" name="etime" maxlength="4"></TD>
                                            </TR>
                                            <TR>
                                                 <TD align=RIGHT>                                   
                                                 </TD>
                                                 <TD>(Write timing in 0000 - 2400 in this format only)</TD>
                                            </TR>
                                            <TR><TD align=CENTER> INFRASTRUCTURE DETAILS
                                                 </TD></TR>
                                            <TR></TR>     
                                            <TR>
                                                 <TD align=RIGHT bgcolor=#00CCFF>     
                                                 <font color="#CC6600" size=4>Details of service </font></TD>
                                                 <TD></TD>
                                            </TR>
                                            <TR>
                                                 <TD align=RIGHT>                                   
                                                 Circuit Specification - </TD>
                                                 <TD><SELECT name="servicetype" size="1" >
                                                      <OPTION SELECTED>---Services---</OPTION>
                                                      <OPTION id= "s" value= "IPLC"> IPLC </OPTION>
                                                      <OPTION id= "s" value= "VPN"> VPN </OPTION>
                                                      <OPTION id= "s" value= "ILL"> ILL </OPTION>
                                                      <OPTION id= "s" value= "VoIP"> VoIP </OPTION>     
                                                      <OPTION id= "s" value= "ISDN"> ISDN </OPTION>
                                                      <OPTION id= "s" value= "IDC"> IDC </OPTION>
                                                      <OPTION id= "s" value= "V-IPLC"> V-IPLC </OPTION>
                                                      <OPTION id= "s" value= "contactcenter"> Contact Center </OPTION>
                                                      </SELECT>
                                                 </TD>
                                            </TR>
                                            <TR>
                                                 <TD align=RIGHT vAlign=TOP>
                                                 Feedback Details - </TD>
                                                 <TD><TEXTAREA wrap="virtual" name="feedback" rows=5 cols=30 MAXLENGTH=100></TEXTAREA></TD>
                                            </TR>
                                            <TR>
                                                 <TD align=RIGHT>Next Visit Scheduled - </TD>
                                                 <TD><input type="text" readonly name="nextvisit" id="nextvisit" size="10" value="<%=date2 %>">
                                                 <img src="./cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the date">
                                                 </TD>
                                            </TR>
                                            <TR></TR>
                                            <TR>
                                                 <TD></TD>
                                                 <TD>     
                                                      <input type="button" name="bill" value="SUBMIT" onClick="cmdOnClick();">
                                                         <input type="reset" name="reset" value="RESET" >
                                                 </TD>
                                            </TR>
                                       </FONT>
                             </div>
                        </TD>
                   </TR>
              </TABLE>
         </TD>
         <TD vAlign=TOP bgcolor=#FFFFFF>
                   </TD>
         </TR></TABLE>
    </form>
    <script language="JavaScript">
         var cal1 = new calendar1(document.forms['DepartmentPage'].elements['edate']);
         var cal2 = new calendar1(document.forms['DepartmentPage'].elements['nextvisit']);
    </script>
    <script language="javascript">
    document.getElementById('a<%=request.getParameter("cmdSelect")%>').selected=true;
    </script>
    <BR><BR>
    <jsp:include page="index-end.jsp"/>
    </body>
    </html>

    If the reset doesn't work, you have to force iPad into Recovery Mode
    1. Turn off iPad
    2. Turn on computer and launch iTunes (make sure you have the latest version of iTune)
    3. Plug USB cable into computer's USB port
    4. Hold Home button down and plug the other end of cable into docking port.
    DO NOT RELEASE BUTTON until you see picture of iTunes and plug
    5. Release Home button.
    ON COMPUTER
    6. iTunes has detected iPad in recovery mode. You must restore this iPad before it can be used with iTunes.
    7. Select "Restore iPad"...
    Note:
    1. Data will be lost if you do not have backup
    2. You must follow step 1 to step 4 VERY CLOSELY.
    3. Repeat the process if necessary.

  • MySQL Boken Pipe Exception...Plz Help Me Urgently

    Hello Friends....
    When I shifted my Java application which has MySQL(Linux has MySQL - 4.1.21-standard version. ) as a backend on Linux Platform I encountered following exception...
    com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: Broken pipe
    STACKTRACE:
    java.net.SocketException: Broken pipe
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
    at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2692)
    at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2621)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1552)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2994)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1030)
    at ServerThread.run(ServerThread.java:98)
    ** END NESTED EXCEPTION **
    its working fine when I tested it on Windows patform with MySql 5.0 as backend.
    Plz Help me. I get struck on thi sproblem from last 2 days.
    //PremInd
    Message was edited by:
    Prem_India
    Message was edited by:
    Prem_India

    Thanks for your response....
    I'm developing chat application. In my server side code I called a thered which listen for all request for that user. The exception is occured in thread. Here is sanpshot of code...
    public class ServerThread extends Thread
    // Variable Declaration
    public ServerThread( Server server, Socket socket, String acntName, String opratorID )
        this.server = server;
        this.socket = socket;
        this.accName1 = acntName;
        this.oprID1 = opratorID;
        try
              Class.forName("com.mysql.jdbc.Driver").newInstance();                
            con = DriverManager.getConnection("jdbc:mysql://localhost/livechatdb","root","");
        catch(Exception ee)
             System.out.println("Break in ServerThread Cons "+ee);
        start();
      public void run()
        String savacc="";
        try
          DataInputStream din = new DataInputStream( socket.getInputStream() );
          DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
          String message;              
          while (true)
            System.out.println("Thread Runnnnnning..");
            message = din.readUTF();           
            System.out.println("~~~~ "+message);
           if(message.startsWith("^%%^"))
                   StringTokenizer stok = new StringTokenizer(message,"~");
                   String rmv1 = stok.nextToken();
                   String cID1 = stok.nextToken();
                   String accNm1 = stok.nextToken();
                   String oprID1 = stok.nextToken();
                   String deptNm1= stok.nextToken();              
                   String IPAddress1 = stok.nextToken();
                   String oprName1 = stok.nextToken();
                   PreparedStatement pStmt1;
                     rs.close();
                   try
                           System.out.println(" Line 9999 99999 ");         
                           pStmt1 = con.prepareStatement("Select status from Customer where custID = ? and accName= ? ");
                            pStmt1.setString(1,cID1);
                            pStmt1.setString(2,accNm1);                      
                           rs = pStmt1.executeQuery();       
                          System.out.println(" Line 100 1000 1000000  ");
                           while(rs.next())
                                  String stat = rs.getString("status");
                                  if(stat.equals("Chat Request"))
                                        /* set status to chatting in Cutomer table */
                                        String strStatus = "Chatting : "+oprName1;                                    
                                        pStmt = con.prepareStatement("Update Customer set status = ? where custID = ? and accName= ? ");
                                        System.out.println (" Line 107              107           107");
                                        pStmt.setString(1,strStatus);                                   
                                        pStmt.setString(2,cID1);
                                   pStmt.setString(3,accNm1);                                                                                    
                                 int i = pStmt.executeUpdate();
                                 System.out.println (" Line 112              112           112 "+i);
                                 dos.writeUTF("^%%^"+"~"+"Y"+"~"+IPAddress1);
                                 server.sendUpdateChatOperTbl(deptNm1,accNm1,cID1,"*",strStatus);                                                            
                                  else
                                        dos.writeUTF("^%%^"+"~"+"N"+"~"+IPAddress1);
                 catch (Exception ex)
                        System.out.println (" Line 131  131   131  "+ex);
           else if(message.startsWith("!O!"))  //chat opr connect
                            // other stuff
    After this line exception occured System.out.println(" Line 9999 99999 "); & it catch at this line System.out.println (" Line 131 131 131 "+ex);
    Thanks.
    Waiting for Reply...

  • Plz help me with this data insertion code

    Hi,
    I am listing a code below ,I am able to insert only one row of value.
    Then i get SQLException.General Exception and a Lock record MSAccess file is generated where .mdb file is stored.
    public void throwtodatabase()
    String gameid;
    ResultSet rs=null;
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con;
    con=DriverManager.getConnection ("jdbc:odbc:MyData","","");
    Statement stat3=con.createStatement();
    rs=stat3.executeQuery("select * from sudoko");
    while (rs.next()) {
    pctr=pctr+1;
    stat3.close();
    con.close();
    catch(Exception g)
    JFrame ob2=new JFrame();
    JOptionPane.showMessageDialog(ob2,g.toString(), "Message", JOptionPane.INFORMATION_MESSAGE);
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con;
    con=DriverManager.getConnection ("jdbc:odbc:MyData","","");
    gameid="G00"+String.valueOf(pctr);
    PreparedStatement stat=null;
    for (int t1=1;t1<=9;t1++) {
    for (int t2=1;t2<=9;t2++) {
    stat=con.prepareStatement("Insert into Sudoko(gameid,row,col,val) values(?,?,?,?)");
    stat.setString(1,gameid);
    stat.setString(2,String.valueOf(t1));
    stat.setString(3,String.valueOf(t2));
    stat.setString(4,String.valueOf(array_map[t1][t2]));
    stat.execute();
    con.close();
    catch(Exception xd)
    JFrame ob2=new JFrame();
    JOptionPane.showMessageDialog(ob2,xd.toString(), "Message", JOptionPane.INFORMATION_MESSAGE);
    }Plz help.Thanx in advance.

    Have this stacktrace
    java.sql.SQLException: General error
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecute(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(Unknown Source)
    at Sudoko.throwtodatabase(Sudoko.java:1120)
    at Sudoko.generate_random_boards(Sudoko.java:1064)
    at Sudoko.actionPerformed(Sudoko.java:205)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknow
    n Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
    ce)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)

  • Plz. help with strange date insertions in access???

    HELLO all,
    i noted a strange thing, when i insert into access table the date it swaps the month and day part for some reason in some records .
    why is this happening,
    plz. help.
    code is as follows
    Calendar cal = Calendar.getInstance();
                                            cal.add(Calendar.DAY_OF_MONTH,-1);
                                            System.out.println(""+cal.getTime());
              //this swaps                         SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy")
    //this swaps too
         //SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
                                            String currentdate = dateFormat.format(cal.getTime()); // formats your date
    custom date is dd/mm/yyyy in table

    Hi vykalra1,
    As far as I know, the way dates (and times) are stored in a Micro$oft Access database has nothing to do with the display format. The format is only used for displaying the date that is stored in the Access table.
    A "field" with "Date/Time" datatype in an Access table maps to the "java.sql.Timestamp" class. Therefore, in order to insert a value into a "Date/Time" (Access) "field", you need to create a "java.sql.Timestamp" object. According to the javadoc, the "java.sql.Timestamp" constructor takes a parameter of type "long" (i.e. java primitive type) -- which represents the number of milliseconds since midnight, 1st January, 1970.
    Therefore, you don't really need to use "Calendar" or "SimpleDateFormat".
    As I understand it, you are trying to insert yesterday's date into your table. Below is an example using a sample table that has two fields -- 'name' and 'updated' -- which (hopefully) will help you. Note how I determine yesterday's date -- using millisecond calculations only.
    The below code was compiled and tested on Windows XP with J2SE SDK 1.4.1_02 and Micro$oft Access 2002.
    import java.sql.*;
    public class JdbcOdbc {
      public static void main(String[] args) {
        Connection dbConn = null;
        PreparedStatement stmt = null;
        String sql = "INSERT INTO Table1 (name, updated) VALUES (?, ?)";
        try {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          dbConn = DriverManager.getConnection("jdbc:odbc:db1");
          stmt = dbConn.prepareStatement(sql);
          stmt.setString(1,"vykalra1");
          long now = System.currentTimeMillis();
          long millisecondsInOneDay = 1000 * 60 * 60 * 24;
          long yesterday = now - millisecondsInOneDay;
          stmt.setTimestamp(2, new Timestamp(yesterday));
          stmt.executeUpdate();
        catch (SQLException sqlEx) {
          System.err.println("Database operation failed.");
          sqlEx.printStackTrace();
        catch (ClassNotFoundException cnfEx) {
          System.err.println("JDBC driver class not found");
          cnfEx.printStackTrace();
        finally {
          if (stmt != null) {
            try {
              stmt.close();
            catch (SQLException sqlEx) {
              System.err.println("ERROR: Failed to close statement");
              sqlEx.printStackTrace();
          if (dbConn != null) {
            try {
              dbConn.close();
            catch (SQLException sqlEx) {
              System.err.println("ERROR: Failed to close DB connection");
              sqlEx.printStackTrace();
    }Good Luck,
    Avi.

  • Plz help me friends i want it urgent

    i want to retrieve the the data from backend in the gird using JSP. can anyone plz say me how to do that.
    or plz help me with the links. plz help me friends...
    Thanx in advance

    manisha.thakur wrote:
    i want to retrieve the the data from backend in the gird using JSP. can anyone plz say me how to do that.Yes.
    You'll need to know JDBC: Google for 'sun jdbc tutorial'
    You'll need to know JSPs and JSTL. Google for 'jstl tutorial'.
    Good luck.
    or plz help me with the links. No links.
    plz help me friends...We're not your friends.
    Learn how to write out your words: it's "please".
    And we don't care how urgent it is for you. If it's urgent, you should stop wasting your time here and start learning.
    %

  • Classpath problem plz help me

    hi!
    i am unable to run my RMI server program .Name of My server class is SumServer.java,it implements SumInterface.java all the files(.class,.java and stub) are at location c:\javaprog\rmi\sum.
    I have not put them in any package.
    value of classpath is
    classpath=c:\jdk1.4\lib;.;c:\javaprog\rmi\sum
    i go in sum folder and run the program
    c:\javaprog\rmi\sum > SumServer
    it gives me following exception.plz help me out.
    Thx in advance.
    Exception occur.Unable to register serverjava.rmi.ServerException: RemoteExcepti
    on occurred in server thread; nested exception is:
    java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
    tion is:
    java.lang.ClassNotFoundException: SumServer_Stub

    Deepa lakshmi wrote:
    Hi,
    Am new to weblogic.
    Am using the tools are,
    Weblogic8.1 version
    MySql5.0,mysql-connector-java-3.1.12-bin.jar file
    While test configuration of connection pooling am getting the error is "JDBC Driver is not on the classpath".
    How can i solve this problem
    plz help me
    regards
    DeepaEdit the start-weblogic script. Near the bottom, you will see
    lines that create a CLASSPATH for the weblogic server. Add a
    script line that adds the mysql driver to the classpath there.
    Joe

Maybe you are looking for

  • How do I know if Apple emails are real

    II'm constantly getting emails from Apple telling me my account has expired, I need to update my iTunes account, my account will be suspended if I don't update deta, etc. how do I know if this it's real? It's been going on for years and I've always i

  • GConf error in Weblogic Server 10.3.6

    Hello, I am running Weblogic Server 10.3.6 under Oracle SOA Suite 11.1.1.6.0 with Java 1.7.0_09 on  SUSE Enterprise Linux 11 SP1, when I start web logic using the command: $ORACLE_SOA_HOME/MiddlewareHome/user_projects/domains/my_domain/startWebLogic.

  • Price in INFO Record should be mondatory

    HI ALL, The Price in the Info record is allowing to Put 0.00 price also. We want to make price mandatory to take Price value greater than 0.00 Price. Please suugest any setting available to make this price other than zero with mandatory case. Regards

  • Distorted aspect ratio of exported WMV clip

    This is truly bizarre. If I output from the timeline using Quicktime Conversion to a WMV file, the aspect ratio is wider than when I output to a Quicktime format. This also happens when I export to the AVI file type. Any clues?

  • My Iphone 4 8gb black starts roaming when near my signal booster!!??!!

    I'm very worried that this will hike up the bill! I noticed it was roaming and got really scared! I took my dog for a walk and periodically checked if it was still roaming. once i got out of the zone of my booster, what do you know! it wasn't roaming