Urgent Help: Cannot Connect to MySql Database


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Urgent Help: Cannot Connect to MySql Database

Hybrid View

  1. #1
    Join Date
    Jan 2006
    Location
    New York
    Posts
    9

    Urgent Help: Cannot Connect to MySql Database

    I desigend a J2EE Aplication using JSP and Servlets in MVC design.
    My system was working great untill i tried using filter for gzip compression for response output , after i used filter gzip, my whole application is destroyed, I cannot able to connect to my Mysql data base, my connection object always returns NULL, i tried every thing re-installing the mysql driver, re-installing the NetBeans ide , nothing is working, i am not able to connect with the database.

    This application was working perfect before i experimented with the Gzip filter.please any body can help me what i did wrong, did i corrupted tomcat server. My application is still on my laptop and is not have been loaded on internet yet. i am posting some errors it is showing on the tomcat log.

    I Want to mention i am using connection pooling which was working great,
    all the servlets are present in the application, the whole application and connection pooling was working great before i used this gzip filter.....Also i like to mention the main problem is when i try to load the driver for Mysql database in my java class it always returns a null connection object. I use Class.forName function in java to load a driver for mysql database.Following is the code where my appliacation returns null connection object

    public static Connection ConnectDB(String NameParm, String PasswordParm) {
    try {

    String url = "jdbc:mysql://localhost:3306/mysql";

    Class.forName("com.mysql.jdbc.Driver");
    conn = null;
    conn = DriverManager.getConnection(url, NameParm, PasswordParm);
    System.out.println("Database connection established");
    return conn;
    } catch (Exception e)
    {
    System.err.println("Cannot connect to database server ");
    return conn;
    }
    }

    please guilde me.. my application is totally stoped at this moment.


    =========== E R R O R S- ON TOMCAT LOG ============
    Jan 3, 2006 3:28:16 PM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@3a9bba')
    Jan 3, 2006 3:28:16 PM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@1c5ddc9')
    Jan 3, 2006 3:28:16 PM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: attributeReplaced('org.apache.catalina.WELCOME_FILES', '[Ljava.lang.String;@163f7a1')
    Jan 3, 2006 3:28:16 PM org.apache.catalina.core.ApplicationContext log
    INFO: SessionListener: contextDestroyed()
    Jan 3, 2006 3:28:16 PM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: contextDestroyed()
    Jan 3, 2006 3:28:32 PM org.apache.catalina.core.ApplicationContext log
    INFO: Marking servlet ShadiManager as unavailable
    Jan 3, 2006 3:28:32 PM org.apache.catalina.core.StandardContext loadOnStartup
    SEVERE: Servlet /CofeeAdvice threw load() exception
    javax.servlet.UnavailableException: Couldn't create connection pool
    at com.example.model.ServletController.init(ServletController.java:69)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:925)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3857)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4118)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:589)
    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:536)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:471)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
    at org.apache.catalina.core.StandardService.start(StandardService.java:450)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
    Jan 3, 2006 3:28:33 PM org.apache.catalina.core.ApplicationContext log
    INFO: ContextListener: contextInitialized()
    Jan 3, 2006 3:28:33 PM org.apache.catalina.core.ApplicationContext log
    INFO: SessionListener: contextInitialized()
    Jan 3, 2006 3:28:34 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Error configuring application listener of class com.sun.faces.config.ConfigureListener
    java.lang.NoClassDefFoundError: javax/faces/FacesException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
    at java.lang.Class.getConstructor0(Class.java:2640)
    at java.lang.Class.newInstance0(Class.java:321)
    at java.lang.Class.newInstance(Class.java:303)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3618)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4104)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:589)
    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:536)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:471)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
    at org.apache.catalina.core.StandardService.start(StandardService.java:450)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
    Jan 3, 2006 3:28:34 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Skipped installing application listeners due to previous error(s)

  2. #2
    Join Date
    Dec 2005
    Posts
    6
    check the url like

    jdbc:mysql://localhost:3306/ the database's name
    dont connect to the database as mysql.

    good luck
    tyshan
    WHO PAT MW,WHO HIRE ME ,Need a remote J2EE job if you have,contrac me via tyshanchn@hotmail.com

Similar Threads

  1. connect VB to mySql
    By jessy in forum Database
    Replies: 3
    Last Post: 12-14-2005, 12:10 PM
  2. Need help to connect to a database
    By harlequin2k5 in forum VB Classic
    Replies: 7
    Last Post: 09-20-2005, 04:20 AM
  3. Replies: 1
    Last Post: 05-10-2001, 09:30 AM
  4. connect to mysql
    By Robert in forum Database
    Replies: 0
    Last Post: 05-09-2001, 07:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center