Mysql-jdbc applet connection issue

I am developing a user interface for a mysql database. I am able to successfully access the db and execute queries through a java APPLICATION.
I need to do the same (access the db (mysql)) through a java APPLET. When I compile the applet it complies fine. When I try to run the applet I'm getting the following error message:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
I tied running the applet using appletviewer and through a web browser, same result. I can run the application from the same command prompt it works fine.
Please help.
Relevant info:
OS: Linux, Fedora4
Classpath: export set CLASSPATH=/home/xyz/Java/mysql-connector-java-5.0.5/:$CLASSPATH;
JDK: PATH=/usr/java/jdk1.6.0/bin
Program:
import java.sql.*;
public class b extends java.applet.Applet
     int y = 0;
public void paint(java.awt.Graphics g)
          y = y + 10;
Connection conn = null;
String driver = "com.mysql.jdbc.Driver";     
String url = "jdbc:mysql://localhost:3306/testdb?user=usr1234&password=xyzxyz";
try {
     Class.forName(driver).newInstance();
     conn = DriverManager.getConnection(url);
     System.out.println("Connected to the database.");
     System.out.println(" ");
     //*********BLOCK TO RETRIEVE RECORDS FROM TABLE*********          
               try{
                    Statement st = conn.createStatement();
                    ResultSet res = st.executeQuery("SELECT * FROM table1");
                    System.out.println("Name: " + "\t" + "Age: ");
                    while (res.next()) {
                         String s = res.getString("name");
                         int i = res.getInt("age");
                         System.out.println(s + "\t" + i);
               catch (SQLException s){
          y = y + 20;
g.drawString("******* s: "+s,50,y);
     //*********END OF BLOCK TO RETRIEVE RECORDS FROM TABLE*********          
     conn.close();
     System.out.println("Disconnected from database");
     }      catch (Exception e) {
          y = y + 20;
g.drawString("******* e: "+e,50,y);
               e.printStackTrace();
Thanks for the help in advance.
--Mat                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

First, accessing a database from an applet is a horrendous idea.
Having said that, did you add the mysql jar to the applet tag in the html page (in the archive property)?

Similar Messages

  • JDBC-ORACLE CONNECTIVITY ISSUE WITYH OCI8 DRIVER using oracle 11g client..

    JDBC-ORACLE CONNECTIVITY ISSUE WITYH OCI8 DRIVER using oracle 11g client..
    I am getting below error when i m trying to access oracle db using oracle 11g client. It works with earlier oracle client versions. how do i resolve this. is there any issue with version of ojdbc6.jar that i am using??? I cant use thin driver since its an old application for which i dont have source files.
    Apr 6, 2013 1:00:59 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
    at java.lang.Runtime.loadLibrary0(Runtime.java:822)
    at java.lang.System.loadLibrary(System.java:992)
    at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:262)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:346)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at PettyCash.SysDate.getSysSubSys(SysDate.java:232)
    at org.apache.jsp.PettyCash.index_jsp._jspService(org.apache.jsp.PettyCash.index_jsp:186)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Code is as follow for reference
    import oracle.jdbc.driver.*;
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    conn = DriverManager.getConnection ("jdbc:oracle:oci8:@" + database,db_user, db_pass);
    eNVIRONMENT VARIABLES set are as follows:
    classpath
    C:\Program Files\apache-tomcat-5.5.12\common\lib\servlet-api.jar;C:\Program Files\apache-tomcat-5.5.12\webapps\ROOT\WEB-INF\lib\classes12.jar;C:\Program Files\apache-tomcat-5.5.12\webapps\ROOT\WEB-INF\lib\ojdbc6.jar;
    JAVA_HOME
    C:\Program Files\Java\jdk1.5.0_04
    PATH
    C:\Program Files\Java\jdk1.5.0_04\bin
    ORACLE_HOME
    D:\Oracle11\product\11.2.0\client_1\BIN

    Apr 8, 2013 5:24:06 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.lang.NullPointerException
         at org.apache.jsp.abc.index_jsp._jspService(org.apache.jsp.abc.index_jsp:280)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)

  • MySQL to DreamWeaver connectivity issue specific to Stored Procedures

    Hi there,
    I have a MySQL to DreamWeaver connectivity issue specific to
    Stored Procedures.
    The driver I am currently using is
    mysql-connector-java-5.1.5-bin.jar.
    Although basic row and column tree is exposed in Adobe
    DreamWeaver 8's Application Pallette, my stored procedure is not.
    My serverside technology is Coldfusion(MX7).
    My environment is:
    Server: MS Windows 2003 (Small Business Server) using IIS.
    Client: MS Window XP-Pro.
    According to the driver documentation
    mysql-connector-java-5.1.5-bin.jar appears to be capable of
    handling stored procedures:
    http://dev.mysql.com/doc/refman/5.1/en/connector-j-useagenotes-basic.html#connector-j-exam ples-stored-procedure
    I could be wrong but the evidence suggests that support for
    this feature is not available from Adobe.
    I have already invested a certain amount of time in this
    sub-project. I would, therefore, be most grateful to anyone who can
    provide me with a solution to this.

    OK.
    Figured out the 'stored proceedure' problem. I had two 'Connection' folders, one of which was a sub-folder, that pointed to the same database but with slightly different configuration details. Removed the 'wrong' folder and all seems to be sorted.
    P

  • Oracle 8i jdbc/Tomcat connection issues

    Tomcat 4.1.8
    Oracle 8i JDBC Driver
    I have been able to create the DataSource as a global resource and as a local resource inside the context of the application.
    The code hangs when it attempts to create a connection. I have been able to connect to the database and perform the necessary query in a standalone application to ensure that I actually can connect.
    JSP Code:
    <html>
    <head>
    <title>VTW App</title>
    </head>
    <body>
    <%
    vtw.VTWApp tst = new vtw.VTWApp();
    tst.init();
    %>
    <h2>Results</h2>
    <%= tst.getList() %>
    </body>
    </html>
    Java Code (Class called by JSP):
    package vtw;
    import javax.naming.*;
    import javax.sql.*;
    import java.sql.*;
    public class VTWApp {
    String list = "EMPTY";
    public void init() {
    try{
    Context ctx = new InitialContext();
    if(ctx == null )
    throw new Exception("Boom - No Context");
    System.out.println("Context Created ...");
    DataSource ds =
    (DataSource)ctx.lookup(
    "java:comp/env/jdbc/oracleDB");
    if (ds != null) {
              System.out.println("DataSource Created ...");
    Connection conn = ds.getConnection();
    System.out.println("Connection Pulled");
    if(conn != null) {
                   System.out.println("Connection Good");
                   Statement st = conn.createStatement();
                   String query = "";
                   query += "select grpid, to_char(min(dtlastendtime),'mm-dd-yyyy hh24:mi:ss') ";
                   query += "from calc_table where equipmentsernum in (";
                   query += "'888000','888001'";
                   query += ") group by grpid";
                   ResultSet rs = st.executeQuery(query);
                   if(rs != null) {
                        list = "";
                        while(rs.next()) {
                             list += (rs.getString(1) + "," + rs.getString(2));
                   rs.close();
                   conn.close();
                   System.out.println("Connection Closed");
              } else {
                   System.out.println("Connection Not Established");
    }catch(Exception e) {
    e.printStackTrace();
    public String getList() { return list; }
    }

    I figured out the issue ...
    In the server.xml file the resource & resource params needed to be modified..
    1. Set type to oracle.jdbc.pool.OracleDataSource
    2. Set factory to oracle.jdbc.pool.OracleDataSourceFactory
    3. In the Java code cast the context lookup to an OracleDataSource instead of a java.sql.DataSource
    Oracles DataSource does not subclass the jdbc DataSource for its OracleDataSource class everything works fine now.
    <Resource name="jdbc/mydb" scope="Shareable" type="oracle.jdbc.pool.OracleDataSource"/>
    <ResourceParams name="jdbc/mydb">
    <parameter>
    <name>validationQuery</name>
    <value></value>
    </parameter>
                   <parameter>
                        <name>factory</name>
                        <value>oracle.jdbc.pool.OracleDataSourceFactory</value>
                   </parameter>
    <parameter>
    <name>driverClassName</name>
    <value>oracle.jdbc.driver.OracleDriver</value>
    </parameter>
    <parameter>
         <name>url</name>
         <value>jdbc:oracle:thin:@server.company.com:1521:dbname</value>
    </parameter>
    <parameter>
    <name>password</name>
    <value>guest</value>
    </parameter>
                   <parameter>
                        <name>maxWait</name>
                        <value>10000</value>
                   </parameter>
                   <parameter>
                        <name>maxActive</name>
                        <value>100</value>
                   </parameter>
    <parameter>
    <name>user</name>
    <value>guest</value>
    </parameter>
    <parameter>
    <name>maxIdle</name>
    <value>2</value>
    </parameter>
    </ResourceParams>

  • JDBC Adapter Connection Issue

    Hi Experts,
    The scenario is file to JDBC, the messages are getting failed in XI MDT with the following error "JDBC Message processing failed ,reason when attempting to get processing resources: com.sap.aii.af.service.utill.concurrent.ResourcePoolException: Unable to create new pooled resource: DriverManagerException: Cannot establish connection to URL<JDBC Connection details maintained in CC>: SQLException: Io exception: The Network Adapter could not establish the connection".
    We got this error after changing the IP addreass of the Oralce system. we did maintained in all the communication channels with new IP Address, previously the data is updating to the Oralce table with old IP addreass.
    IP address is also maintained in XI Host file. We are able to ping the Oralce from XI with new IP.
    Can any body suggest how to rectify the issue.
    Thanks in Advance
    Bhaskar

    Hi,
    have you checked cache status. It is possbile that the change hasn't been applied yet. That would explain, why the database can't be reached.
    Stop/Start of communication channel might also help. Sometimes it si necessary to restart the whole JDBC Adapter.
    If all this fails, you should get yourself a free copy of DBVisualizer, use the same database driver as is installed on PI, provide credentials and try to reach database. Might also be a driver issue.
    Regards
    Sven

  • JDBC - Sybase Connectivity Issue

    I'm a Java beginner.When using the java JDBC i'm experiencing the following issues
    Connection string used - jdbc:sybase:Tds:<Serverip>:<ServerPort>
    Driver File - com.sybase.Jdbc2.Jdbc.SybDriver
    Initially when i tried using these values i'm able to establish the database connection.But recently i changed the machine name.I'm using the same machine for both Database and Java.After the machine name changes i'm getting the following error
    SQLException:Jz006:caught IOException:java.net.connect Exception.
    Please help me...

    Just rename back the host. Do it work?
    See [http://tmaj.pathology.jhmi.edu/doc/manual/FAQs.html#DATABASE_TROUBLESHOOTING]
    I found somewhere that
    Note: The following exception occurs when you click Test Connection to connect a Sybase data source from the administrative console.
    Test connection failed for data source isagent on server server1 at node
    svtaix24Node01 with the following exception: java.lang.Exception:
    java.sql.SQLException: JZ006: Caught IOException: java.net.ConnectException: A
    remote host refused an attempted connect operation.DSRA0010E: SQL State = JZ006,
    Error Code = 0
    This exception occurs when the Sybase data source port number is not matched to the port configured in Sybase server.
    The default port number is 5000.
    Check the port number of your Sybase server in the interfaces file under /<sybase install directory>.

  • Jdbc odbc connectivity issue

    I have made one system dsn ...in some folder..then in my jsp page my
    Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    Connection myConn = DriverManager.getConnection."jdbc:odbc:Employee");im getting error like no data source...and its finding in root directory like c:/document seting etc etc ..not where my db lies
    if i put my db in root directory .then code wrks fine..but is it taking that root directory

    well well the code would not consider nothing here the microsoft native bridge driver has to find appropriate database.
    Are you sure u have created an entry in Odbc Data Source Administrator --> System DSN -> and you have a name called "Employee" out their pointing to appropriate database which you are trying to connect.

  • MySQL/JDeveloper JDBC - Losing Connection

    I am working on a Java Web Application project using JDeveloper (9.0.5.1 Build 1605) while connecting to a mySQL database (4.0.18-max-nt). My application works fine up a certain number of connection. After that, I receive the following error message:
    -<snip>-
    java.sql.SQLException: Unable to connect to any hosts due to exception: java.lang.NullPointerException
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:1719)
    at com.mysql.jdbc.Connection.<init>(Connection.java:432)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:400)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:193)
    at model.NodeSummary.makeConnection(NodeSummary.java:229)
    at model.NodeSummary.getIDs(NodeSummary.java:391)
    -<snip>-
    Based on some testing I've done, I can make up to a certain number of connections, than the next one fails. I've searched the web and it appears others have had this same problem. One person fixed the problem by switching to Tomcat.
    Is there a solution to this? Do I also have to switch to Tomcat?
    Thanks,
    Mark

    I'd check the bug reports for the mysql jdbc driver to see if this is a known issue, if not send them a bug report, it sounds like one.
    Rob
    Team JDev

  • JDBC connection issue's HELP!

    import java.sql.*;
    public class test{
         public static void main(String args[]){
              Statement stmt;
              ResultSet rs;
                   try{
                        Class.forName("com.mysql.jdbc.Driver");
              Connection conn = DriverManager.getConnection("jdbc:mysql://h50mysql3.secureserver.net/insurance_bdc", "user", "password");
              Statement stmt = conn.createStatement();
              ResultSet rs = stmt.executeQuery("SELECT * FROM employees");
              while(rs.next())
                   System.out.println(rs.getString("name") + rs.getString("address"));
              catch (SQLException exception)
                   System.out.println("\nSQL Exception " + exception.getMessage() + "\n");
              stmt.close();
              rs.close();
    Can someone please help with this?

    try this instead:
    import java.sql.*;
    public class test{
    static Statement stmt=null;
    static ResultSet rs=null;
    public static void main(String args[])throws ClassNotFoundException, SQLException{
    try{
    Class.forName("com.mysql.jdbc.Driver");
    Connection conn = DriverManager.getConnection("jdbc:mysql://h50mysql3.secureserver.net/insurance_bdc", "user", "password");
    stmt = conn.createStatement();
    rs = stmt.executeQuery("SELECT * FROM employees");
    while(rs.next())
    System.out.println(rs.getString("name") + rs.getString("address"));
    catch (SQLException exception)
    System.out.println("\nSQL Exception " + exception.getMessage() + "\n");
    }finally{
       try{
      if(rs!=null) 
    rs.close();
    if(stmt!=null) 
      stmt.close();
      }catch(Exception e){
    }

  • Connect Forms to MySQL JDBC

    Hi,
    I need help connecting to a MySQL db through oracle reports using a jdbc connection.
    I have downloaded the MySQL JDBC driver:mysql-connector-java-3.0.17-ga-bin.jar.
    I can succesfully use it to connect if I write a simple java program. So I know the driver works.
    I have set it in my classpath & edited the jdbcpds.conf file by adding the following:
    <driver name = "mysql-merant"
    sourceDatabase = "other"
    subProtocol = "mysql"
    connectString = "mainProtocol:subProtocol://databaseName"
    class = "com.mysql.jdbc.Driver"
    connection = "oracle.reports.plugin.datasource.jdbcpds.JDBCConnectionHandling">
    </driver>
    When I try to connect, I get the following error, ERR 62002 failed to connect to the data source.
    What do I have to do to connect? Is there a way to directly give the connect string?
    I can connect to an oracle DB using a the Oracle drivers no problem, why does forms not accept the MySQL driver? What can I do to make this work?
    Any help would be appreciated.
    Michael Baran
    [email protected]

    With Reports 9i the mysql-connector-java doesn´t work for that. You don´t have to edit the jdbcpds.conf. mysql-merant doesn´t exist. Just download MyODBC conector and then stand up your database in your DSN system. Use the wizard to make a report, then use JDBC Query and using jdbc-odbc driver, fill the fields
    then you have connected MySQL
    very easy.
    I hope this help you

  • MySQL - JDBC Connectivity

    Hello,
    I built a small web app that reads and writes to a MySQL db via a servlet. This application worked fine on my dev box, but when I moved it to a staging machine it would not connect to the MySQL server on the staging box. After much frustration and not being able to figure up from down, I wrote another test app that did nothing but connect to a MySQL db and return success/fail message. I got the same behavior from this app -- it will connect to a local MySQL db on my dev system (WinXP), on another linux box but not on the staging server.
    Now, the kicker is that if I run either of these applications on one of the other systems, and set the db URL to the staging server instance of MySQL, I can connect and update/read the database there. So, it's just something wrong with my configuration in my deployment on the staging server that prevents the apps from connecting to the MySQL server locally on that one system.
    The exception that is returned from a failed connection is "Communication link failure." I can't find anything useful about my case through searches.
    AFAICS, the installations of MySQL on the two linux systems are identical -- both canned installs for Ubuntu 7.1 via package manager. Yet, one works, the other doesn't.
    Test system: MySQL 5.0.45-Debian_1ubuntu3.3-log (works), Tomcat 6.0.16 (also tested with 6.0.14)
    Staging: MySQL 5.0.45-Debian_1ubuntu3.3-log (doesn't work), Tomcat 5.5
    OS on both: Linux 2.6.22-15-generic/Ubuntu 7.1
    I guess the summary is,
    dbUrl="jdbc:mysql://ellen:3306/fundraiser" will work for db connectivity if I am running the application on any system other than ellen. (Also, note that I tried deploying with a substitution of "localhost" for "ellen" in the URL and it did not work.)
    I'm hoping somebody can point me in the right direction, as I'm out of ideas for troubleshooting.
    Thanks.
    mp

    Hello,
    Following is the output from getStackTrace().
    Thanks.
    mp
    sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
    com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2104)
    com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:729)
    com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:46)
    sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)
    com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:283)
    java.sql.DriverManager.getConnection(DriverManager.java:582)
    java.sql.DriverManager.getConnection(DriverManager.java:185)
    net.homelinux.servlet.JdbcTest.processRequest(JdbcTest.java:55)
    net.homelinux.servlet.JdbcTest.doGet(JdbcTest.java:92)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    sun.reflect.GeneratedMethodAccessor77.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:262)
    org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:192)
    org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:171)
    java.security.AccessController.doPrivileged(Native Method)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:167)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
    org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    java.lang.Thread.run(Thread.java:619)

  • MySQL -- JDBC Connection help !!!

    Hi everybody...Well I have MySQL Server and Java, I get the JDBC and tried this:
    import java.sql.*;
    public class JdbcE {
    public static void main(String args[]) {
    Connection con = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql://localhost/test", "user", "pass");
    if(!con.isClosed())
    System.out.println("Successfully connected to MySQL server...");
    } catch(Exception e) {
    System.err.println("Exception: " + e.getMessage());
    } finally {
    try {
    if(con != null)
    con.close();
    } catch(SQLException e) {}
    And with that code all works fine...but when I change the Host from LOCALHOST to [ROUTER IP] like this:
    con = DriverManager.getConnection("jdbc:mysql://182.185.145.12/test", "user", "pass");
    I got this exception:
    Exception: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection timed out: connect
    STACKTRACE:
    java.net.SocketException: java.net.ConnectException: Connection timed out: conne
    ct
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
    va:156)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
    :266)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at JdbcE.main(JdbcE.java:11)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 16 ms ago.
    I don't know how to solve it...
    I have a 2wire 1700HG router, maybe it would be a problem of the firewall can anyone help me to solve this problem??

    Well I sorry...I am very new in this kind of things...I just know that I have a 2wire 1700HG, I have installed MySQL Server, Java and mysql-connector-java...
    When I try this in the connection statement:
    con = DriverManager.getConnection("jdbc:mysql://localhost/test", "user", "test");
    Everything works fine...but when I try this to connect from a remote PC
    con = DriverManager.getConnection("jdbc:mysql://189.145.185.182/test", "user", "test");
    This error comes out on screen:
    Exception: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection timed out: connect
    STACKTRACE:
    java.net.SocketException: java.net.ConnectException: Connection timed out: conne
    ct
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
    va:156)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
    :266)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at JdbcE.main(JdbcE.java:11)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 16 ms ago.
    I don't know what can I do :S please help!! :D

  • Why my MySQL JDBC Connect fail??

    Dear friends:
    I have following code:
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class JdbcExample2 {
      public static void main(String args[]) {
        Connection con = null;
        try {
          Class.forName("com.mysql.jdbc.Driver").newInstance();
          //jdbc:mysql://host_name:port/dbname
    //     con = DriverManager.getConnection("jdbc:MySQL:///test","admin", "admin");
          con = DriverManager.getConnection("jdbc:MySQL://localhost:3306/test","admin", "admin");
          if(!con.isClosed())
            System.out.println("Successfully connected to " +
              "MySQL server using TCP/IP...");
        } catch(Exception e) {
          System.err.println("Exception: " + e.getMessage());
        } finally {
          try {
            if(con != null)
              con.close();
          } catch(SQLException e) {}
    }But when I run , I got following error:
    Exception: com.mysql.jdbc.Driver
    My question is:
    [1]. when I connect to MySQL Server through mySQL Client, I got
    Enter password: *****
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 18 to server version: 4.1.21-community-nt
    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    mysql>
    how Can I determine MySQL Server name?? I forgot when I install, maybe MySQL is my SQL Server name
    [2]. Do I need to creat a user DSN name or System DSN name for MySQL Server?? which one is best??
    How to do it??
    [3]. How to make above simple JDBC program runnable??
    Thanks
    sunny
    Message was edited by:
    sunnymanman

    Thanks, see new errors:
    C:\Project\java>java Jdbc11
    Copyright 2004, R.G.Baldwin
    java.sql.SQLException: Access denied for user 'admin'@'localhost' (using password: YES)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2941)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:868)
    at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3340)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1238)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2743)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at Jdbc11.main(Jdbc11.java:23)
    C:\Project\java>
    any idea??
    here Jdbc11.java:23 is:
    Connection con = DriverManager.getConnection(
    url,"admin", "YES");
    my userID/Password = admin/admin;
    sunny
    Message was edited by:
    sunnymanman

  • Mysql JDBC error

    <%@ page import = "java.io.*, java.util.*,java.net.URL,java.awt.*,java.lang.*,java.sql.*" %>
    <HTML>
    <head></head>
    <body>
    <%
        ResultSet rs;
         Statement stmt;
         try {
              Class.forName("com.mysql.jdbc.Driver").newInstance();
              Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/petrofed?user=petrofed&password=petro");
         String sql = "SELECT * FROM sample";
         stmt = conn.createStatement();
         rs = stmt.executeQuery(sql);
         while (rs.next())
              out.println(rs.getString(1));
              out.println(rs.getString(2));
                 // Do something with the Connection
             } catch (SQLException ex) {
                 // handle any errors
                 out.println("SQLException: " + ex.getMessage());
                 out.println("SQLState: " + ex.getSQLState());
                 out.println("VendorError: " + ex.getErrorCode());
             catch (ClassNotFoundException cnfex)
                           out.println("SQLException: " + cnfex.getMessage());
    %>
    </body>
    </html>
    Getting following error after uploading it on the Server
    SQLException: Communications link failure due to underlying exception: ** BEGIN NESTED EXCEPTION ** java.security.AccessControlException MESSAGE: access denied (java.net.SocketPermission localhost resolve) STACKTRACE: java.security.AccessControlException: access denied (java.net.SocketPermission localhost resolve) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:269) at java.security.AccessController.checkPermission(AccessController.java:401) at java.lang.SecurityManager.checkPermission(SecurityManager.java:524) at java.lang.SecurityManager.checkConnect(SecurityManager.java:1023) at java.net.InetAddress.getAllByName0(InetAddress.java:1000) at java.net.InetAddress.getAllByName0(InetAddress.java:981) at java.net.InetAddress.getAllByName(InetAddress.java:975) at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:133) at com.mysql.jdbc.MysqlIO.(MysqlIO.java:281) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1696) at com.mysql.jdbc.Connection.(Connection.java:408) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:270) at java.sql.DriverManager.getConnection(DriverManager.java:512) at java.sql.DriverManager.getConnection(DriverManager.java:193) at org.apache.jsp.mysqldb2_jsp._jspService(mysqldb2_jsp.java:59) at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.jasper.servlet.JspServletWrapper.service(Unknown Source) at org.apache.jasper.servlet.JspServlet.serviceJspFile(Unknown Source) at org.apache.jasper.servlet.JspServlet.service(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown Source) at org.apache.catalina.core.ApplicationFilterChain.access$0(Unknown Source) at org.apache.catalina.core.ApplicationFilterChain$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source) at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContext.invoke(Unknown Source) at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.valves.ErrorReportValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619) at java.lang.Thread.run(Thread.java:534) ** END NESTED EXCEPTION ** SQLState: 08S01 VendorError: 0

    Tomcat is running with a Java security manager that doesn't let your application connect via sockets to applications outside Tomcat. You could perhaps fix this by configuring Tomcat with a security policy that does permit that, but don't ask me how to do that. I would fix the problem by using connection pools that are (I believe) built into Tomcat.

  • Problem connecting to MySQL thro Applet using JDBC

    Hi,
    I'm trying to use an applet to connect to MySQL thro JDBC. The applet, the IE client that loads the HTML, and MySQL all reside on the same machine. But I'm getting the following error:"ClassNotFoundException: com.mysql.jdbc.Driver". But I'm able to connect using a Java application and run and display SQL query results. Any ideas are highly appreciated. Here're are the two pieces of code:
    /****** Java Application *****/
    import java.sql.*;
    public class MySQL_App {
    public static void main(String args[]) {
              String url = "jdbc:mysql://localhost/test";
         try {
                   Class.forName("com.mysql.jdbc.Driver");
         catch(java.lang.ClassNotFoundException e) {
                   System.err.print("ClassNotFoundException: ");
                   System.err.println(e.getMessage());
    /****** Java Applet *****/
    import java.awt.*;
    import javax.swing.*;
    import netscape.javascript.*;
    import java.sql.*;
    public class MySQL_Applet extends JApplet {
         JSObject win;
         public void init() {
              win = JSObject.getWindow(this);
         public void callShowMessage() {
              String url = "jdbc:mysql://" + this.getDocumentBase().getHost() + "/test";
              String[] args = new String[1];
         args[0] = "" ;
         try {
              Class.forName("com.mysql.jdbc.Driver");
         catch(java.lang.ClassNotFoundException e) {
                   args[0] += "ClassNotFoundException " + e.getMessage() ;
         win.call("showMessage", args);
    }

    mmm i, think that may here we've 2 possibles answers:
    1) Did u read about "Applet Security"? my point is that you haven't acces to your local var "path" or "classpath".
    2) Maybe u didn't especificate the MySQl path in ur classpath;
    Check this 2 points

Maybe you are looking for

  • No longer have a Mac, Now only boots to Windows 7

    So I partitioned the MAC OS drive so that part of it would be for Windows, and it told me to insert my Windows 7 disk. When Windows Install started up, it said that disk 1 partion 2 (Bootcamp) was not NFTS formatted, so to proceed, I formated just th

  • How do you import media and metadata from Windows Photo Gallery database?

    How do you import videos and photos and their metadata from a Windows Photo Gallery database into the Elements Organizer, especially metadata that is only contained in the Photo Gallery database file (pictures.pd6) and not embedded in the video and p

  • Wrong persistent unit

    Dear sdn members, I am using NetBeans 5.5 , database PostgreSQL 8.1, Sun Application Server 9, and hibernate.I copied following jars from Hibernate to lib directory of my application server # From hibernate entitymanager 3.2.0 cr2 * hibernate-entitym

  • I've inherited an old eMac with no install disks

    I have inherited an eMac (ATI Graphics) 1GHz Power PC. I don't, however, have any install disks and the HD is wiped. My question is, does anyone know if I can use an eMac install disk from a later eMac design? I see some on Craigslist and/or eBay and

  • The import "java.util.scanner" is not vaild

    I am experiment with the java.util.scanner API after compiling the code below I received the following error: The import "java.util.Scanner" is not valid, since it does not name a type in a package. I declared a string variable should that suffice? i