473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)

283 100+
hi frnds,
im trying to convert my servlets database configuration from ms access to mysql database.however im getting some error like no driver found exception.
to verify this error ive made a simple database in jsp(just to check if my mysql is working smoothly otherwise) which access' the username.....but in the process im getting a error-->
java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)

i have no idea wat this error is as this is the first time im working with mysql.

my jsp code is-->
Expand|Select|Wrap|Line Numbers
  1. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  2.     pageEncoding="ISO-8859-1"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <%@page import="java.sql.*" %>
  5. <html>
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  8. <title>Insert title here</title>
  9. </head>
  10. <%! Connection conn=null;
  11. PreparedStatement pr=null;
  12. ResultSet rs=null;
  13. %>
  14. <body>
  15. <%
  16. try
  17. {
  18.     Class.forName("org.gjt.mm.mysql.Driver");
  19.     conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/TEST");
  20.     String uName=request.getParameter("userName");
  21.     pr=conn.prepareStatement("SELECT * FROM LOGIN WHERE name=?");
  22.     pr.setString(1,uName);
  23.     rs=pr.executeQuery();
  24.     while(rs.next())
  25.     {
  26.         String str=rs.getString(1);
  27.         out.println("<br>"+str);
  28.         str=rs.getString(2);
  29.         out.println("<br>" +str);
  30.     }
  31.     conn.close();
  32. }
  33. catch(Exception e)
  34. {
  35.     System.out.println(e);
  36. }
  37. %>
  38. </body>
  39. </html>
  40.  
and my stack trace is--->
Sep 3, 2007 6:09:24 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.5.0_10\bin;.;C:\WINDOWS\system32;C :\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOW S\System32\Wbem;C:\WINDOWS\Downloaded Program Files;C:\IBMTOOLS\Python22;C:\Program Files\PC-Doctor for Windows\services;C:\Program Files\Java\jdk1.5.0_10\bin;C:\PROGRA~1\IBM\SQLLIB\ BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IB M\SQLLIB\SAMPLES\REPL1;C:\logging-log4j-1.2.14\dist\lib\log4j-1.2.14.jar;C:\xerces\xml-apis.jar;C:\xerces\xercesImpl.jar
Sep 3, 2007 6:09:24 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Sep 3, 2007 6:09:24 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 875 ms
Sep 3, 2007 6:09:24 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Sep 3, 2007 6:09:24 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.23
Sep 3, 2007 6:09:24 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Sep 3, 2007 6:09:25 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
Sep 3, 2007 6:09:25 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
Sep 3, 2007 6:09:25 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='resources.application', returnNull=true
Sep 3, 2007 6:09:25 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
Sep 3, 2007 6:09:25 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
Sep 3, 2007 6:09:26 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='resources.application', returnNull=true
Sep 3, 2007 6:09:26 PM org.apache.struts.tiles.xmlDefinition.I18nFactoryS et initFactory
SEVERE: null : Can't find file '/WEB-INF/tiles-defs.xml'
Sep 3, 2007 6:09:26 PM org.apache.struts.tiles.TilesPlugin init
SEVERE: Can't create Tiles definition factory for module ''.
Sep 3, 2007 6:09:26 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /servintostruts1 threw load() exception
org.apache.struts.tiles.FactoryNotFoundException: null : Can't find file '/WEB-INF/tiles-defs.xml'
at org.apache.struts.tiles.xmlDefinition.I18nFactoryS et.initFactory(I18nFactorySet.java:224)
at org.apache.struts.tiles.definition.ComponentDefini tionsFactoryWrapper.init(ComponentDefinitionsFacto ryWrapper.java:139)
at org.apache.struts.tiles.TilesUtilImpl.createDefini tionsFactory(TilesUtilImpl.java:168)
at org.apache.struts.tiles.TilesUtil.createDefinition sFactory(TilesUtil.java:205)
at org.apache.struts.tiles.TilesPlugin.init(TilesPlug in.java:230)
at org.apache.struts.action.ActionServlet.initModuleP lugIns(ActionServlet.java:1158)
at org.apache.struts.action.ActionServlet.init(Action Servlet.java:473)
at javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1139)
at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:966)
at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:3956)
at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4230)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:736)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
at org.apache.catalina.core.StandardService.start(Sta ndardService.java:448)
at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalin a.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:433)
Sep 3, 2007 6:09:26 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Sep 3, 2007 6:09:26 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Sep 3, 2007 6:09:26 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/32 config=null
Sep 3, 2007 6:09:26 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Sep 3, 2007 6:09:26 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2328 ms
java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)
java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)
Sep 3 '07 #1
8 28391
r035198x
13,262 8TB
hi frnds,
im trying to convert my servlets database configuration from ms access to mysql database.however im getting some error like no driver found exception.
to verify this error ive made a simple database in jsp(just to check if my mysql is working smoothly otherwise) which access' the username.....but in the process im getting a error-->
java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)

i have no idea wat this error is as this is the first time im working with mysql.

my jsp code is-->
Expand|Select|Wrap|Line Numbers
  1. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  2.     pageEncoding="ISO-8859-1"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  4. <%@page import="java.sql.*" %>
  5. <html>
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  8. <title>Insert title here</title>
  9. </head>
  10. <%! Connection conn=null;
  11. PreparedStatement pr=null;
  12. ResultSet rs=null;
  13. %>
  14. <body>
  15. <%
  16. try
  17. {
  18.     Class.forName("org.gjt.mm.mysql.Driver");
  19.     conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/TEST");
  20.     String uName=request.getParameter("userName");
  21.     pr=conn.prepareStatement("SELECT * FROM LOGIN WHERE name=?");
  22.     pr.setString(1,uName);
  23.     rs=pr.executeQuery();
  24.     while(rs.next())
  25.     {
  26.         String str=rs.getString(1);
  27.         out.println("<br>"+str);
  28.         str=rs.getString(2);
  29.         out.println("<br>" +str);
  30.     }
  31.     conn.close();
  32. }
  33. catch(Exception e)
  34. {
  35.     System.out.println(e);
  36. }
  37. %>
  38. </body>
  39. </html>
  40.  
and my stack trace is--->
Sep 3, 2007 6:09:24 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.5.0_10\bin;.;C:\WINDOWS\system32;C :\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOW S\System32\Wbem;C:\WINDOWS\Downloaded Program Files;C:\IBMTOOLS\Python22;C:\Program Files\PC-Doctor for Windows\services;C:\Program Files\Java\jdk1.5.0_10\bin;C:\PROGRA~1\IBM\SQLLIB\ BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IB M\SQLLIB\SAMPLES\REPL1;C:\logging-log4j-1.2.14\dist\lib\log4j-1.2.14.jar;C:\xerces\xml-apis.jar;C:\xerces\xercesImpl.jar
Sep 3, 2007 6:09:24 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Sep 3, 2007 6:09:24 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 875 ms
Sep 3, 2007 6:09:24 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Sep 3, 2007 6:09:24 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.23
Sep 3, 2007 6:09:24 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Sep 3, 2007 6:09:25 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
Sep 3, 2007 6:09:25 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
Sep 3, 2007 6:09:25 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='resources.application', returnNull=true
Sep 3, 2007 6:09:25 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
Sep 3, 2007 6:09:25 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
Sep 3, 2007 6:09:26 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='resources.application', returnNull=true
Sep 3, 2007 6:09:26 PM org.apache.struts.tiles.xmlDefinition.I18nFactoryS et initFactory
SEVERE: null : Can't find file '/WEB-INF/tiles-defs.xml'
Sep 3, 2007 6:09:26 PM org.apache.struts.tiles.TilesPlugin init
SEVERE: Can't create Tiles definition factory for module ''.
Sep 3, 2007 6:09:26 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /servintostruts1 threw load() exception
org.apache.struts.tiles.FactoryNotFoundException: null : Can't find file '/WEB-INF/tiles-defs.xml'
at org.apache.struts.tiles.xmlDefinition.I18nFactoryS et.initFactory(I18nFactorySet.java:224)
at org.apache.struts.tiles.definition.ComponentDefini tionsFactoryWrapper.init(ComponentDefinitionsFacto ryWrapper.java:139)
at org.apache.struts.tiles.TilesUtilImpl.createDefini tionsFactory(TilesUtilImpl.java:168)
at org.apache.struts.tiles.TilesUtil.createDefinition sFactory(TilesUtil.java:205)
at org.apache.struts.tiles.TilesPlugin.init(TilesPlug in.java:230)
at org.apache.struts.action.ActionServlet.initModuleP lugIns(ActionServlet.java:1158)
at org.apache.struts.action.ActionServlet.init(Action Servlet.java:473)
at javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1139)
at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:966)
at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:3956)
at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4230)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:736)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
at org.apache.catalina.core.StandardService.start(Sta ndardService.java:448)
at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalin a.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:433)
Sep 3, 2007 6:09:26 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Sep 3, 2007 6:09:26 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Sep 3, 2007 6:09:26 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/32 config=null
Sep 3, 2007 6:09:26 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Sep 3, 2007 6:09:26 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2328 ms
java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)
java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)
The error simply means that your log in details are incorrect.
Wrong password/username/database name. Verify that they are correct.
Sep 3 '07 #2
ajos
283 100+
The error simply means that your log in details are incorrect.
Wrong password/username/database name. Verify that they are correct.
hi,
i suppose that my username and password is root and my db name is TEST2...can u tell me how to check my username and password???im using the command prompt for this particular database problem...
regards
ajos
Sep 3 '07 #3
r035198x
13,262 8TB
hi,
i suppose that my username and password is root and my db name is TEST2...can u tell me how to check my username and password???im using the command prompt for this particular database problem...
regards
ajos
To test on the command prompt with username "root" and password called "password" you do

Expand|Select|Wrap|Line Numbers
  1. mysql -u root -p
  2. password:                           /you type "password" here
From the Java program you do

Expand|Select|Wrap|Line Numbers
  1. conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/TEST", "root", "password");
Sep 3 '07 #4
ajos
283 100+
To test on the command prompt with username "root" and password called "password" you do

Expand|Select|Wrap|Line Numbers
  1. mysql -u root -p
  2. password:                           /you type "password" here
From the Java program you do

Expand|Select|Wrap|Line Numbers
  1. conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/TEST", "root", "password");
hey,
u know wat this is the 2 nd time u r helping me out and successfully though...thank u very much for this help...i appreciate it very much...now that ive come to know that i have a successful connection with mysql also, then why im getting an No Suitable Driver Exception....im my servlet which goes like this--->
Expand|Select|Wrap|Line Numbers
  1. // Decompiled by DJ v3.4.4.74 Copyright 2003 Atanas Neshkov  Date: 7/4/2003 12:37:00 PM
  2. // Home Page : http://members.fortunecity.com/neshkov/dj.html  - Check often for new version!
  3. // Decompiler options: packimports(3)
  4. // Source File Name:   BdgtMaster.java
  5. package publicity;
  6.  
  7. import java.io.*;
  8. import java.sql.*;
  9. import javax.servlet.*;
  10. import javax.servlet.http.*;
  11.  
  12. public class BdgtMaster extends HttpServlet
  13. {
  14.  
  15.     public synchronized void service(HttpServletRequest httpservletrequest, HttpServletResponse httpservletresponse)
  16.         throws ServletException, IOException
  17.     {
  18.         //httpservletrequest.setAttribute(arg0, arg1);
  19.         //HttpSession session=request.getSession();
  20.         Object obj = null;
  21.         String s3 = "";
  22.         String s4 = "";
  23.         out = httpservletresponse.getOutputStream();
  24.         String s = "";
  25.         String s1 = "";
  26.         String s2 = httpservletrequest.getParameter("option");
  27.         s3 = httpservletrequest.getParameter("branch");
  28.         s4 = httpservletrequest.getParameter("publicity_code");
  29.         String s5 = httpservletrequest.getParameter("budget");
  30.          try
  31.         {
  32.             String s6 = "0";
  33.             String s7 = "0";
  34.             String s8 = "INSERT INTO Budget_Master(Branch,Publicity_Code,Budget_Alloted,Work_In_Progress,Amount_Paid) VALUES (?,?,?,?,?)";
  35.             String s9 = "update budget_master set old_budget = budget_alloted where branch='" + s3 + "' and publicity_code=" + s4;
  36.             String s10 = "UPDATE Budget_Master set budget_alloted=" + s5 + " where Branch='" + s3 + "' and publicity_code=" + s4;
  37.             String url="jdbc:mysql://localhost:3306/";
  38.             String dbName="test";
  39.             String Driver="com.mysql.jdbc.Driver";
  40.             //datasource = "jdbc:odbc:budget";
  41.             String userName="root";
  42.             String passWord="root";
  43.             con = DriverManager.getConnection("jdbc.mysql://localhost:3306/test","root","root");
  44.             int i = con.getTransactionIsolation();
  45.             con.setTransactionIsolation(2);
  46.             con.setAutoCommit(false);
  47.             if("new".equalsIgnoreCase(s2))
  48.             {
  49.                 PreparedStatement preparedstatement = con.prepareStatement(s8);
  50.                 preparedstatement.setString(1, s3);
  51.                 preparedstatement.setString(2, s4);
  52.                 preparedstatement.setString(3, s5);
  53.                 preparedstatement.setString(4, s7);
  54.                 preparedstatement.setString(5, s6);
  55.                 preparedstatement.executeUpdate();
  56.                 con.commit();
  57.                 preparedstatement.close();
  58.             }
  59.             if("update".equalsIgnoreCase(s2))
  60.             {
  61.                 Statement statement = con.createStatement();
  62.                 statement.executeUpdate(s9);
  63.                 statement.executeUpdate(s10);
  64.                 con.commit();
  65.             }
  66.             con.setTransactionIsolation(0);
  67.             htmlStart(out, "BUDGET MASTER");
  68.             out.println("<p>&nbsp;</p><div align=\"left\">");
  69.             out.println("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"50%\">");
  70.             out.print("<tr>");
  71.             out.println("<td width=\"50%\"><strong><small><font face=\"Tahoma\">Branch </font></small></strong></td>");
  72.             out.println("<td width=\"50%\"><small><font color=\"#004080\" face=\"Tahoma\">" + s3 + "</font></small></td></tr><tr>");
  73.             out.println("<td width=\"50%\"><strong><small><font face=\"Tahoma\">Budget Alloted </font></small></strong></td>");
  74.             out.println("<td width=\"50%\"><small><font color=\"#004080\" face=\"Tahoma\">" + s5 + "</font></small></td></tr><tr>");
  75.             out.println("<td width=\"50%\"><small><strong><font face=\"Tahoma\">Publicity Code</font></strong></small></td>");
  76.             out.println("<td width=\"50%\"><small><font color=\"#004080\" face=\"Tahoma\">" + s4 + "</font></small></td></tr></table></div>");
  77.             htmlEnd(out);
  78.             con.close();
  79.         }
  80.         catch(SQLException sqlexception)
  81.         {
  82.             cleanUp();
  83.             printSQLException(sqlexception, out);
  84.         }
  85.         out.flush();
  86.     }
  87.     public void doGet(HttpServletRequest request,HttpServletResponse response)
  88.     throws ServletException,IOException
  89.     {
  90.  
  91.     }
  92.  
  93.     public void init(ServletConfig servletconfig)
  94.         throws ServletException
  95.     {
  96.         super.init(servletconfig);
  97.         try
  98.         {
  99.             Class.forName("com.mysql.jdbc.Driver");
  100.             System.out.println("database connection established");
  101.         }
  102.         catch(Exception e)
  103.         {
  104.             System.out.println("error in database connection");
  105.             System.out.println(e);
  106.         }
  107.         /*try
  108.         {
  109.             try {
  110.                 Class.forName("com.mysql.jdbc.Driver").newInstance();
  111.             } catch (InstantiationException e) {
  112.                 // TODO Auto-generated catch block
  113.                 e.printStackTrace();
  114.             } catch (IllegalAccessException e) {
  115.                 // TODO Auto-generated catch block
  116.                 e.printStackTrace();
  117.             }
  118.             System.out.println("conn est");
  119.             return;
  120.         }
  121.         catch(ClassNotFoundException classnotfoundexception)
  122.         {
  123.             log("Couldn't load class com.mysql.jdbc.Driver");
  124.             throw new ServletException(classnotfoundexception.getMessage());
  125.         }*/
  126.     }
  127.  
  128.     static void printSQLException(SQLException sqlexception, ServletOutputStream servletoutputstream)
  129.         throws IOException
  130.     {
  131.         servletoutputstream.print("<b>SQLException</b>\n<p>\n\n");
  132.         for(; sqlexception != null; sqlexception = sqlexception.getNextException())
  133.         {
  134.             servletoutputstream.print("<b>SQLState:</b> " + sqlexception.getSQLState() + "<br>\n");
  135.             servletoutputstream.print("<b>Message:</b> " + sqlexception.getMessage() + "<br>\n");
  136.             servletoutputstream.print("<b>Vendor:</b> " + sqlexception.getErrorCode() + "<br>\n");
  137.         }
  138.  
  139.     }
  140.  
  141.     private static boolean checkForWarning(SQLWarning sqlwarning)
  142.         throws SQLException
  143.     {
  144.         boolean flag = false;
  145.         if(sqlwarning != null)
  146.         {
  147.             System.out.println("\n *** Warning ***\n");
  148.             flag = true;
  149.             for(; sqlwarning != null; sqlwarning = sqlwarning.getNextWarning())
  150.             {
  151.                 System.out.println("SQLState: " + sqlwarning.getSQLState());
  152.                 System.out.println("Message:  " + sqlwarning.getMessage());
  153.                 System.out.println("Vendor:   " + sqlwarning.getErrorCode());
  154.                 System.out.println("");
  155.             }
  156.  
  157.         }
  158.         return flag;
  159.     }
  160.  
  161.     void htmlStart(ServletOutputStream servletoutputstream, String s)
  162.         throws IOException
  163.     {
  164.         servletoutputstream.println("<html><head><title>" + s + "</title></head>");
  165.         servletoutputstream.println("<body topmargin=\"0\" leftmargin=\"0\" bgproperties=\"fixed\">");
  166.         servletoutputstream.println("<div align=\"left\"><table border=\"0\" width=\"100%\">");
  167.         servletoutputstream.println("<tr><td width=\"100%\" bgcolor=\"#DFDFFF\">");
  168.         servletoutputstream.println("<font face=\"Tahoma\" color=\"#000000\"><strong>B u d g e t&nbsp;&nbsp; M a s t e r - D e t a i l s&nbsp;&nbsp; E n t e r e d</strong></font></td>");
  169.         servletoutputstream.println("</tr></table>");
  170.     }
  171.  
  172.     void htmlEnd(ServletOutputStream servletoutputstream)
  173.         throws IOException
  174.     {
  175.         servletoutputstream.print("<hr>");
  176.         servletoutputstream.print("</body></html>\n");
  177.     }
  178.  
  179.     String link(String s, String s1)
  180.     {
  181.         return "<a href=\"" + s + "\">" + s1 + "</a>";
  182.     }
  183.  
  184.     public String getServletInfo()
  185.     {
  186.         return "Display and SQL manipulate JDBC databases on the server.";
  187.     }
  188.  
  189.     public void cleanUp()
  190.         throws IOException
  191.     {
  192.         if(con != null)
  193.             try
  194.             {
  195.                 out.print("Closing database connection");
  196.                 con.setTransactionIsolation(0);
  197.                 con.close();
  198.                 return;
  199.             }
  200.             catch(SQLException _ex)
  201.             {
  202.                 return;
  203.             }
  204.         else
  205.             return;
  206.     }
  207.  
  208.     public BdgtMaster()
  209.     {
  210.     }
  211.  
  212.     private Connection con;
  213.     private String datasource;
  214.     private String user;
  215.     private String password;
  216.     private String base;
  217.     private ServletOutputStream out;
  218. }
  219.  
is it bcoz of the access queryy that ive not changed....but atleast it shud run,isnt it???

herz the stack trace--->
Sep 3, 2007 7:07:49 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.5.0_10\bin;.;C:\WINDOWS\system32;C :\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOW S\System32\Wbem;C:\WINDOWS\Downloaded Program Files;C:\IBMTOOLS\Python22;C:\Program Files\PC-Doctor for Windows\services;C:\Program Files\Java\jdk1.5.0_10\bin;C:\PROGRA~1\IBM\SQLLIB\ BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\PROGRA~1\IB M\SQLLIB\SAMPLES\REPL1;C:\logging-log4j-1.2.14\dist\lib\log4j-1.2.14.jar;C:\xerces\xml-apis.jar;C:\xerces\xercesImpl.jar
Sep 3, 2007 7:07:49 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Sep 3, 2007 7:07:49 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 875 ms
Sep 3, 2007 7:07:49 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Sep 3, 2007 7:07:49 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.23
Sep 3, 2007 7:07:49 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Sep 3, 2007 7:07:49 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
Sep 3, 2007 7:07:49 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
Sep 3, 2007 7:07:50 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='resources.application', returnNull=true
Sep 3, 2007 7:07:50 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
Sep 3, 2007 7:07:50 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
Sep 3, 2007 7:07:50 PM org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='resources.application', returnNull=true
Sep 3, 2007 7:07:50 PM org.apache.struts.tiles.xmlDefinition.I18nFactoryS et initFactory
SEVERE: null : Can't find file '/WEB-INF/tiles-defs.xml'
Sep 3, 2007 7:07:50 PM org.apache.struts.tiles.TilesPlugin init
SEVERE: Can't create Tiles definition factory for module ''.
Sep 3, 2007 7:07:50 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /servintostruts1 threw load() exception
org.apache.struts.tiles.FactoryNotFoundException: null : Can't find file '/WEB-INF/tiles-defs.xml'
at org.apache.struts.tiles.xmlDefinition.I18nFactoryS et.initFactory(I18nFactorySet.java:224)
at org.apache.struts.tiles.definition.ComponentDefini tionsFactoryWrapper.init(ComponentDefinitionsFacto ryWrapper.java:139)
at org.apache.struts.tiles.TilesUtilImpl.createDefini tionsFactory(TilesUtilImpl.java:168)
at org.apache.struts.tiles.TilesUtil.createDefinition sFactory(TilesUtil.java:205)
at org.apache.struts.tiles.TilesPlugin.init(TilesPlug in.java:230)
at org.apache.struts.action.ActionServlet.initModuleP lugIns(ActionServlet.java:1158)
at org.apache.struts.action.ActionServlet.init(Action Servlet.java:473)
at javax.servlet.GenericServlet.init(GenericServlet.j ava:212)
at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1139)
at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:966)
at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:3956)
at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4230)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:736)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:443)
at org.apache.catalina.core.StandardService.start(Sta ndardService.java:448)
at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalin a.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:433)
Sep 3, 2007 7:07:51 PM org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Sep 3, 2007 7:07:51 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Sep 3, 2007 7:07:51 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/47 config=null
Sep 3, 2007 7:07:51 PM org.apache.catalina.storeconfig.StoreLoader load
INFO: Find registry server-registry.xml at classpath resource
Sep 3, 2007 7:07:51 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2313 ms
database connection established

after making some changes in the servlet code ive got this exception
-->Closing database connectionSQLException
SQLState: null
Message: Transaction isolation level NONE not supported by MySQL
Vendor: 0
Sep 3 '07 #5
r035198x
13,262 8TB
Here are some important tips.
1.) If you are using "root" as root's password, then change your root password immediately
user instead and give them appropriate permission
2.) Do not post stacktraces that contain your system info in public forums
3.) Variable names like s1, s2, s3 ... are a good source for debugging headaches. Give meaningful names to your variables that easily relate to what the variable is pointing to.
4.) As for that stacktrace, I've never used tomcat before by I suspect your problem is on this line of the stacktrace

Expand|Select|Wrap|Line Numbers
  1. Can't find file '/WEB-INF/tiles-defs.xml'
Have you tried restarting the application/server?
Sep 3 '07 #6
ajos
283 100+
Here are some important tips.
1.) If you are using "root" as root's password, then change your root password immediately
user instead and give them appropriate permission
2.) Do not post stacktraces that contain your system info in public forums
3.) Variable names like s1, s2, s3 ... are a good source for debugging headaches. Give meaningful names to your variables that easily relate to what the variable is pointing to.
4.) As for that stacktrace, I've never used tomcat before by I suspect your problem is on this line of the stacktrace

Expand|Select|Wrap|Line Numbers
  1. Can't find file '/WEB-INF/tiles-defs.xml'
Have you tried restarting the application/server?
hey,
ive tried restarting and the stuff that is required...as for the password root..i'll make the necessary changes, the exception that i caught was--->

Closing database connectionSQLException
SQLState: null
Message: Transaction isolation level NONE not supported by MySQL
Vendor: 0

and the problem of tiles-def.xml arises in all the problems that i do...but that hasnt caused any problems when i was using access database....i think the problem is in the queries.....the queries above that i mentioned are access queries.....im not sure abt this(query thing).
regards,
ajos
Sep 3 '07 #7
r035198x
13,262 8TB
hey,
ive tried restarting and the stuff that is required...as for the password root..i'll make the necessary changes, the exception that i caught was--->

Closing database connectionSQLException
SQLState: null
Message: Transaction isolation level NONE not supported by MySQL
Vendor: 0

and the problem of tiles-def.xml arises in all the problems that i do...but that hasnt caused any problems when i was using access database....i think the problem is in the queries.....the queries above that i mentioned are access queries.....im not sure abt this(query thing).
regards,
ajos
When setting transaction isolation levels, use the constants defined in the docs here, not hardcoded int values.
The exception is probably because you're setting transaction isolation level to none (Connection.TRANSACTION_NONE) which as the docs explain there should not be used.

Edit: It's always a good idea to test to see if the database supports the isolation level first using DatabaseMetadata.supportsTransactionIsolationLevel
Sep 3 '07 #8
ajos
283 100+
When setting transaction isolation levels, use the constants defined in the docs here, not hardcoded int values.
The exception is probably because you're setting transaction isolation level to none (Connection.TRANSACTION_NONE) which as the docs explain there should not be used.

Edit: It's always a good idea to test to see if the database supports the isolation level first using DatabaseMetadata.supportsTransactionIsolationLevel
hey,
ive got ur point and done the necessary changes...and "IT WORKED" thanx for taking all the time for helping me out with my problems...u have been very kind and patient with me....i want to thank u for this.....hope to hear from u in the future posts..
regards ajos.....:)
Sep 3 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ike_strong | last post by:
Can anyone help me to figure out why each time I try to access my database using: c:\mysql\bin\inmysql -root -p and afterwards:(i.e. after inputting my at the password prompt) Enter...
0
by: | last post by:
I get Access Denied (System.Runtime.InteropServices.COMException) When trying to use DirectoryEntry on IIS via ASP.NET application. The same code I use is not generating this Exception while...
1
by: Saifee | last post by:
hi, I am using Microsft Outlook library in aspx.vb page, but when i run the function i get error of access denied and some user accounts. Please help!!!!!!!!! rgds, Saifee.
2
by: SKB | last post by:
Hi, I am absolutely new to this area. I am getting the following difficulty : Access denied for user 'ODBC'@'localhost' (using password: NO) when I try the mysql command from within the...
7
by: rajbala.3399 | last post by:
Hi , I want to download sql in my linux system........... # rpm -ivh MySQL-server-5.0.24a-0.glibc23.i386.rpm MySQL-cl ient-5.0.24a-0.glibc23.i386.rpm Preparing... ...
1
usafshah
by: usafshah | last post by:
Hi I'm using linux with mysql , when i type mysql in terminal it says like: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) i'm logged in as root but...
1
by: whitey | last post by:
hi all, is there any other reason for this message to be displayed? other than incorrect username, password, database name?
4
by: pearl15 | last post by:
Hello All I have successfully installed the following IIS ver 6 php ver 4.4.9 MYSQL ver 5.0.67 when i tested through command line i get no error and i am view the php pages on the browser...
1
by: pearl15 | last post by:
Hello All I have successfully installed the following IIS ver 6 php ver 4.4.9 MYSQL ver 5.0.67 when i tested through command line i get no error and i am view the php pages on the browser...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.