Error in mysql database connection

hi
this ramesh again........
i tried to run below code :
import java.sql.*;
public class MysqlConnect{
     public static void main(String[] args) {
          System.out.println("MySQL Connect Example.");
          Connection conn = null;
          String url = "jdbc:mysql://localhost:3306/";
          String dbName = "lux1";
          String driver = "com.mysql.jdbc.Driver";
          String userName = "luxmi";
          String password = "luxmi";
          try {
               Class.forName(driver).newInstance();
               conn = DriverManager.getConnection(url+dbName,userName,password);
               System.out.println("Connected to the database");
               conn.close();
               System.out.println("Disconnected from database");
          } catch (Exception e) {
               e.printStackTrace();
but getting error message like:
C:\Documents and Settings\Luxmi\My Documents\db vehiclefiles>java MysqlConnect
MySQL Connect Example.
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at MysqlConnect.main(MysqlConnect.java:13)
C:\Documents and Settings\Luxmi\My Documents\db vehiclefiles>
plz help me out..........
thanks............
ramesh

your error means that your program can not load the class specified.
you have to put the driver jar file (in mysql case it named "mysql-connector-java-3.1.12-bin.jar") put it in your class path.
the easiest and famous class path is:
%JAVA_INSTALLATION_PATH%\jre\lib\extGood Luck
Ahmad Elsafty

Similar Messages

  • Error in Mysql database connectivity

    hello,
    there is problem in Mysql database connectivity.
    when i connect JSP program to Mysql database it gives error :
    Server configuration denied access to data source
    please help me asap
    kuldip jain
    [email protected]

    i m also working on Mysql Java but on Window 2000 platform
    here is the Java code which successfully runing on my machine
    import java.sql.*;
    public class TestMySql
         public static void main(String[] Args)
              try
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    Connection C = DriverManager.getConnection(
    "jdbc:mysql://server2:3306/Db?user=root");
    Statement Stmt = C.createStatement();
    ResultSet RS = Stmt.executeQuery("SELECT * from T1");
    while (RS.next()) {
                             System.out.println(RS.getString(1));
    catch (Exception E)
    System.out.println("SQLException: " + E.getMessage());

  • How to establish a MYSQL Database connection in JSP page.

    Hi People,
    Tell me how to establish mysql database connection in JSP page.
    Needed details on:
    1) what are all the mysql drivers need to be included.
    2) what is the syntax for establish a database connection

    hi,
    http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.htmlsee down for mysql config with tomcat

  • Workspace Error 8001: The Database Connection could not be found

    We had to reboot all our windows servers recently and since then all the database connections in the database base manager in workspace are gone.
    I can see all the existing reports but cannot use any of them as I dont have any connections.
    Also I cannot create any new connections
    I get the error 8001: The Database Connection could not be found: 13cbd63_12b5e2a8b73_-7f8f when I try to create a new connection.
    Not sure what the problem is.
    Any suggestions?

    Hi Pat,
    It loks like your Biplus relational DB is corrupted, try with those steps:
    1. De-register BI+ from Shared Services (Config Utility->Hyperion Reporting and Analysis > Deregister from Shared Services)
    2. Configure against the backup database (Drop and recreate tables option).
    3. Re-register BI+ with Shared Services.
    4. Re-deploy BI+.
    5. Test Workspace and add new connections.
    Regards.

  • MySQL Database Connection (two databases at the same time)

    I have never had to open more than one MySQL database from within the same website before, but I do now.  The website I have is designed where all the content comes from within the main database.  I am building an Inventory system that I want within it's own database, in the event I would ever need to move the application to another server or something, I don't want this data residing in the main database.
    Currently, I open the database connection from within a file called "common.php" that resides in a directory called "lib" that can be accessed from the root directory.  Below is the proposed code that would be placed within the "common.php" file:
    // Define Database Variables
    $dbserver = "127.0.0.1";
    $dbuser  = array('clevelan_user1', 'clevelan_user2');
    $dbpass  = array('P@ssw0rd', 'P@ssw0rd2');
    $dbname  = array('clevelan_database1', 'clevelan_database2');
    // Start Session
    session_start();
    // Connect to Databases
    connectdb($dbserver, $dbuser[0], $dbpass[0], $dbname[0]);
    connectdb2($dbserver, $dbuser[1], $dbpass[1], $dbname[1]);
    // Database 1 Connection
    function connectdb($dbserver, $dbuser, $dbpass, $dbname) {
    // connects to db
      global $connection;
      $connection = @mysql_connect($dbserver, $dbuser, $dbpass) or die ("could not connect to server");
      $db = @mysql_select_db($dbname, $connection) or die ("could not select databsase");
      return $connection;
    // Database 2 Connection
    function connectdb2($dbserver, $dbuser, $dbpass, $dbname) {
    // connects to db
      global $connection2;
      $connection2 = @mysql_connect($dbserver, $dbuser, $dbpass) or die ("could not connect to server");
      $db2 = @mysql_select_db($dbname, $connection2) or die ("could not select databsase");
      return $connection2;
    //End of Code Within the "common.php"
    From within any page of the website, I want to access both connections by placing an include at the top of each page:
    include_once("lib/common.php");
    Currently, when I run the code above, any page within the website (the home page) provides error messages with regards to database connectivity (the pages are looking for there content from within the second database.  It's as if the second database is the only database seen by the website.
    I need help figuring out how I can have two MySQL databases open at the same time (the second database will only be open for short periods of time and then closed).  But the main database is always open.

    Create one project using one copy of the exact tables.
    create 2 different sessions.xml files each pointing to the same project. Set the login information in the sessions.xml files.
    That should work fine.
    Peter

  • MySQL database connection from Custom JSP

    I am trying to connect MySQL database from my custom JSP. I am getting following error which says that the connector JAR (mysql-connector-java-5.1.7) is not in CLASS PATH.
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    Where should I need to add to get by custom JSP during run time of BPM Studio or Workspace?
    I have tried in adding to External resources. But didn't work that way. even I tried adding to "lib" folder in resource view.
    My Custom JSP code:_
    <%@ page language="java" import="java.sql.*" %>
    <html>
    <head></head>
    <body>
    <%     
    System.out.println("MySQL Connect Example.");
    Connection conn = null;
    String url = "jdbc:mysql://localhost:3306/";
    String dbName = "aboo";
    String driver = "com.mysql.jdbc.Driver";
    String userName = "monty";
    String password = "some_pass";
    try {
    Class.forName(driver).newInstance();
    conn = DriverManager.getConnection(url+dbName,userName,password);
    System.out.println("Connected to the database");
    String query = "Select * FROM employeee";
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(query);
    while (rs.next()) {
    System.out.println(rs.getInt(1));
    System.out.println(rs.getString(2));
    conn.close();
    System.out.println("Disconnected from database");
    } catch (Exception ee) {
    ee.printStackTrace();
    %>
    </body>
    </html>
    Edited by: sideeque on Jul 7, 2009 9:38 AM
    Edited by: sideeque on Jul 7, 2009 9:39 AM

    I got it working by just adding JAR to C:\OraBPMStudioHome\webapps\workspace\lib

  • Error accessing mysql database from a remote host

    Hi all,
    I'm running the following PL/SQL script and encountered some errors. The MySQL server is hosted off campus by a hosting company. However, when I run the same script against a MySQL database server hosted on campus, the script works fine. Here's the error:
    ERROR at line 3:
    ORA-04052: error occurred when looking up remote object
    cmswhit_odbc13.mdl_user@RLTEST
    ORA-00604: error occurred at recursive SQL level 1
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    [MySQL][ODBC 5.1 Driver][mysqld-4.1.22-standard]SELECT command denied to user
    'cmswhit_odbc13'@'192.160.216.13' for table 'mdl_user'
    ORA-02063: preceding 2 lines from RLTEST
    Here's the script:
    sqlplus -s <<endofit
    $USERPASS
    set serveroutput on;
    DECLARE
    user_name varchar2(30);
    moo_user_name varchar2(300);
    routine VARCHAR2(40);
    cntr NUMBER(8);
    CURSOR read_saradap is
    select gobtpac_external_user
    from gobtpac
    where gobtpac_external_user in ('greenup','yfeng');
    CURSOR read_mdl_user is
    select "username" from "mdl_user"@rltest where "username" = user_name;
    -- E N D O F C U R S O R S --
    BEGIN
    dbms_output.enable(1000000000);
    -- STEP 1: Read through Banner
    cntr := 0;
    OPEN read_saradap;
    LOOP
    routine := 'Read applicant';
    -- Read an applicant record
    dbms_output.put_line('Reading Banner user');
    FETCH read_saradap INTO user_name;
    EXIT WHEN read_saradap%NOTFOUND;
    dbms_output.put_line('Read Banner username=' || user_name);
    cntr := cntr + 1;
    -- Read the Moodle user;
    routine := 'Read moodle user';
    OPEN read_mdl_user;
    FETCH read_mdl_user INTO moo_user_name;
    IF read_mdl_user%NOTFOUND THEN
    dbms_output.put_line('Moodle user not found');
    ELSE
    dbms_output.put_line('Read Moodle username=' || moo_user_name);
    END IF;
    CLOSE read_mdl_user;
    END LOOP;
    rollback;
    CLOSE read_saradap;
    dbms_output.put_line('Total processed: ' || cntr);
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line(SQLCODE);
    dbms_output.put_line(SQLERRM);
    dbms_output.put_line('Error user=' || user_name);
    dbms_output.put_line(routine);
    END;
    EXIT;
    endofit

    The error seems to be quite clear: the user 'cmswhit_odbc13'@'192.160.216.13' lacks the SELECT privilege on the 'mdl_user' table...
    Max
    http://oracleitalia.wordpress.com

  • Getting 'unidentified error occured' while database connecting on local computer

    I have downloaded CS5 Dreamweaver trial version on my c
    omputer, with windows 7.
    I have also downloaded easy php as php-mysql-apache server on the same computer.
    While creating a databse connection, I get following message
    'Undefined error ocurred'.
    and the connection does not take place.
    If I close the connection wizard, with giving database name, connection is shown on the applications pane, but when tables icon is clicked, no tables are show.
    Also when I try to create a recordset, it shows that there are no tables in the databse.
    I have insertd screen shots of the connection wizard.
    Kindly help.

    I'm not familiar with EasyPHP, but it should work the same as any other local testing environment.
    In the Servers panel, deselect the Remote checkbox. Leave only the Testing checkbox selected.
    Something unusual about the Local Info panel is that the Web URL, although grayed out, is accessing http://127.0.0.1:8888. Localhost is an alias for 127.0.0.1, so that's not a problem, but the colon followed by 8888 is a non-standard port. Does EasyPHP run Apache on port 8888? If so, you need to change the Web URL in the Server Basic panel to http://localhost:8888/InventaEnqFrm/.
    Also, if Apache is running on port 8888, it's very likely that MySQL is running on port 8889, so you would need to use localhost:8889 in the MySQL Connection dialog box.
    The other obvious thing to check is that both Apache and MySQL are running.
    By the way, it's normal practice to put the local files in the same location as the testing server.

  • MySql database  Connection failure

    Hi,
    I have following code. I am using MySql database. and Tomcat server and MySql jdbc driver. I am able to get the Datasource but when I call getConnection on ds, I get Connection object as null. Any help here?
                   ctx = new InitialContext();
                   if( ctx == null ) throw new Exception("ERROR - No Context");
                   // ESTABLISH THE DataSource //
                                  ds = (DataSource)ctx.lookup("java:comp/env/jdbc/xmediaDB");
                   if( ds == null ) throw new Exception("ERROR - DataSource is null");
                   // ESTABLISH THE Connection //
                   con = ds.getConnection();
                   if( con == null ) throw new Exception("ERROR - Failed to get connection");

    Yes database is running...
    Here are my server.xml and web.xml anything wrong here?
    Hi sherbir,
    Pl let me know if anything wrong.
    Here is my server.xml :
    <!-- Example Server Configuration File -->
    <!-- Note that component elements are nested corresponding to their
         parent-child relationships with each other -->
    <!-- A "Server" is a singleton element that represents the entire JVM,
         which may contain one or more "Service" instances.  The Server
         listens for a shutdown command on the indicated port.
         Note:  A "Server" is not itself a "Container", so you may not
         define subcomponents such as "Valves" or "Loggers" at this level.
    -->
    <Server port="8005" shutdown="SHUTDOWN" debug="0">
      <!-- Uncomment these entries to enable JMX MBeans support -->
      <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"
                debug="0"/>
      <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"
                debug="0"/>
      <!-- Global JNDI resources -->
      <GlobalNamingResources>
        <!-- Test entry for demonstration purposes -->
        <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
        <!-- Editable user database that can also be used by
             UserDatabaseRealm to authenticate users -->
        <Resource name="UserDatabase" auth="Container"
                  type="org.apache.catalina.UserDatabase"
           description="User database that can be updated and saved">
        </Resource>
        <ResourceParams name="UserDatabase">
          <parameter>
            <name>factory</name>
            <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
          </parameter>
          <parameter>
            <name>pathname</name>
            <value>conf/tomcat-users.xml</value>
          </parameter>
        </ResourceParams>
      </GlobalNamingResources>
      <!-- A "Service" is a collection of one or more "Connectors" that share
           a single "Container" (and therefore the web applications visible
           within that Container).  Normally, that Container is an "Engine",
           but this is not required.
           Note:  A "Service" is not itself a "Container", so you may not
           define subcomponents such as "Valves" or "Loggers" at this level.
       -->
      <!-- Define the Tomcat Stand-Alone Service -->
      <Service name="Tomcat-Standalone">
        <!-- A "Connector" represents an endpoint by which requests are received
             and responses are returned.  Each Connector passes requests on to the
             associated "Container" (normally an Engine) for processing.
             By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
             You can also enable an SSL HTTP/1.1 Connector on port 8443 by
             following the instructions below and uncommenting the second Connector
             entry.  SSL support requires the following steps (see the SSL Config
             HOWTO in the Tomcat 4.0 documentation bundle for more detailed
             instructions):
             * Download and install JSSE 1.0.2 or later, and put the JAR files
               into "$JAVA_HOME/jre/lib/ext".
             * Execute:
                 %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
                 $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA  (Unix)
               with a password value of "changeit" for both the certificate and
               the keystore itself.
             By default, DNS lookups are enabled when a web application calls
             request.getRemoteHost().  This can have an adverse impact on
             performance, so you can disable it by setting the
             "enableLookups" attribute to "false".  When DNS lookups are disabled,
             request.getRemoteHost() will return the String version of the
             IP address of the remote client.
        -->
        <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8081 -->
        <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
                   port="8080"
                   minProcessors="5" maxProcessors="75"
                   enableLookups="true" redirectPort="8443"
                   acceptCount="100" debug="0" connectionTimeout="20000"
                   useURIValidationHack="false" disableUploadTimeout="true" />
        <!-- Note : To disable connection timeouts, set connectionTimeout value
         to 0 -->
        <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->
        <!--
        <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
                   port="8443" minProcessors="5" maxProcessors="75"
                   enableLookups="true"
                acceptCount="100" debug="0" scheme="https" secure="true"
                   useURIValidationHack="false" disableUploadTimeout="true">
          <Factory className="org.apache.coyote.tomcat4.CoyoteServerSocketFactory"
                   clientAuth="false" protocol="TLS" />
        </Connector>
        -->
        <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->
        <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
                   port="8009" minProcessors="5" maxProcessors="75"
                   enableLookups="true" redirectPort="8443"
                   acceptCount="10" debug="0" connectionTimeout="20000"
                   useURIValidationHack="false"
                   protocolHandlerClassName="org.apache.jk.server.JkCoyoteHandler"/>
        <!-- Define an AJP 1.3 Connector on port 8009 -->
        <!--
        <Connector className="org.apache.ajp.tomcat4.Ajp13Connector"
                   port="8009" minProcessors="5" maxProcessors="75"
                   acceptCount="10" debug="0"/>
        -->
        <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
        <!-- See proxy documentation for more information about using this. -->
        <!--
        <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
                   port="8082" minProcessors="5" maxProcessors="75"
                   enableLookups="true" disableUploadTimeout="true"
                   acceptCount="100" debug="0" connectionTimeout="20000"
                   proxyPort="80" useURIValidationHack="false" />
        -->
        <!-- Define a non-SSL legacy HTTP/1.1 Test Connector on port 8083 -->
        <!--
        <Connector className="org.apache.catalina.connector.http.HttpConnector"
                   port="8083" minProcessors="5" maxProcessors="75"
                   enableLookups="true" redirectPort="8443"
                   acceptCount="10" debug="0" />
        -->
        <!-- Define a non-SSL HTTP/1.0 Test Connector on port 8084 -->
        <!--
        <Connector className="org.apache.catalina.connector.http10.HttpConnector"
                   port="8084" minProcessors="5" maxProcessors="75"
                   enableLookups="true" redirectPort="8443"
                   acceptCount="10" debug="0" />
        -->
        <!-- An Engine represents the entry point (within Catalina) that processes
             every request.  The Engine implementation for Tomcat stand alone
             analyzes the HTTP headers included with the request, and passes them
             on to the appropriate Host (virtual host). -->
        <!-- Define the top level container in our container hierarchy -->
        <Engine name="Standalone" defaultHost="localhost" debug="0">
          <!-- The request dumper valve dumps useful debugging information about
               the request headers and cookies that were received, and the response
               headers and cookies that were sent, for all requests received by
               this instance of Tomcat.  If you care only about requests to a
               particular virtual host, or a particular application, nest this
               element inside the corresponding <Host> or <Context> entry instead.
               For a similar mechanism that is portable to all Servlet 2.3
               containers, check out the "RequestDumperFilter" Filter in the
               example application (the source for this filter may be found in
               "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").
               Request dumping is disabled by default.  Uncomment the following
               element to enable it. -->
          <!--
          <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
          -->
          <!-- Global logger unless overridden at lower levels -->
          <Logger className="org.apache.catalina.logger.FileLogger"
                  prefix="catalina_log." suffix=".txt"
                  timestamp="true"/>
          <!-- Because this Realm is here, an instance will be shared globally -->
          <!-- This Realm uses the UserDatabase configured in the global JNDI
               resources under the key "UserDatabase".  Any edits
               that are performed against this UserDatabase are immediately
               available for use by the Realm.  -->
          <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
                     debug="0" resourceName="UserDatabase"/>
          <!-- Comment out the old realm but leave here for now in case we
               need to go back quickly -->
          <!--
          <Realm className="org.apache.catalina.realm.MemoryRealm" />
          -->
          <!-- Replace the above Realm with one of the following to get a Realm
               stored in a database and accessed via JDBC -->
          <!--
          <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
                 driverName="org.gjt.mm.mysql.Driver"
              connectionURL="jdbc:mysql://localhost/authority"
             connectionName="test" connectionPassword="test"
                  userTable="users" userNameCol="user_name" userCredCol="user_pass"
              userRoleTable="user_roles" roleNameCol="role_name" />
          -->
          <!--
          <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
                 driverName="oracle.jdbc.driver.OracleDriver"
              connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"
             connectionName="scott" connectionPassword="tiger"
                  userTable="users" userNameCol="user_name" userCredCol="user_pass"
              userRoleTable="user_roles" roleNameCol="role_name" />
          -->
          <!--
          <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"
                 driverName="sun.jdbc.odbc.JdbcOdbcDriver"
              connectionURL="jdbc:odbc:CATALINA"
                  userTable="users" userNameCol="user_name" userCredCol="user_pass"
              userRoleTable="user_roles" roleNameCol="role_name" />
          -->
          <!-- Define the default virtual host -->
          <Host name="localhost" debug="0" appBase="webapps"
           unpackWARs="true" autoDeploy="true">
            <!-- Normally, users must authenticate themselves to each web app
                 individually.  Uncomment the following entry if you would like
                 a user to be authenticated the first time they encounter a
                 resource protected by a security constraint, and then have that
                 user identity maintained across *all* web applications contained
                 in this virtual host. -->
            <!--
            <Valve className="org.apache.catalina.authenticator.SingleSignOn"
                       debug="0"/>
            -->
            <!-- Access log processes all requests for this virtual host.  By
                 default, log files are created in the "logs" directory relative to
                 $CATALINA_HOME.  If you wish, you can specify a different
                 directory with the "directory" attribute.  Specify either a relative
                 (to $CATALINA_HOME) or absolute path to the desired directory.
            -->
            <!--
            <Valve className="org.apache.catalina.valves.AccessLogValve"
                     directory="logs"  prefix="localhost_access_log." suffix=".txt"
                     pattern="common" resolveHosts="false"/>
            -->
            <!-- Logger shared by all Contexts related to this virtual host.  By
                 default (when using FileLogger), log files are created in the "logs"
                 directory relative to $CATALINA_HOME.  If you wish, you can specify
                 a different directory with the "directory" attribute.  Specify either a
                 relative (to $CATALINA_HOME) or absolute path to the desired
                 directory.-->
            <Logger className="org.apache.catalina.logger.FileLogger"
                     directory="logs"  prefix="localhost_log." suffix=".txt"
                 timestamp="true"/>
            <!-- Define properties for each web application.  This is only needed
                 if you want to set non-default properties, or have web application
                 document roots in places other than the virtual host's appBase
                 directory.  -->
            <!-- Tomcat Root Context -->
            <!--
              <Context path="" docBase="ROOT" debug="0"/>
            -->
            <!-- Tomcat Examples Context -->
            <Context path="/examples" docBase="examples" debug="0"
                     reloadable="true" crossContext="true">
              <Logger className="org.apache.catalina.logger.FileLogger"
                         prefix="localhost_examples_log." suffix=".txt"
                   timestamp="true"/>
              <Ejb   name="ejb/EmplRecord" type="Entity"
                     home="com.wombat.empl.EmployeeRecordHome"
                   remote="com.wombat.empl.EmployeeRecord"/>
              <!-- If you wanted the examples app to be able to edit the
                   user database, you would uncomment the following entry.
                   Of course, you would want to enable security on the
                   application as well, so this is not done by default!
                   The database object could be accessed like this:
                   Context initCtx = new InitialContext();
                   Context envCtx = (Context) initCtx.lookup("java:comp/env");
                   UserDatabase database =
                        (UserDatabase) envCtx.lookup("userDatabase");
              -->
    <!--
              <ResourceLink name="userDatabase" global="UserDatabase"
                            type="org.apache.catalina.UserDatabase"/>
    -->
              <!-- PersistentManager: Uncomment the section below to test Persistent
                     Sessions.
                   saveOnRestart: If true, all active sessions will be saved
                     to the Store when Catalina is shutdown, regardless of
                     other settings. All Sessions found in the Store will be
                     loaded on startup. Sessions past their expiration are
                     ignored in both cases.
                   maxActiveSessions: If 0 or greater, having too many active
                     sessions will result in some being swapped out. minIdleSwap
                     limits this. -1 means unlimited sessions are allowed.
                     0 means sessions will almost always be swapped out after
                     use - this will be noticeably slow for your users.
                   minIdleSwap: Sessions must be idle for at least this long
                     (in seconds) before they will be swapped out due to
                   maxActiveSessions. This avoids thrashing when the site is
                     highly active. -1 or 0 means there is no minimum - sessions
                     can be swapped out at any time.
                   maxIdleSwap: Sessions will be swapped out if idle for this
                     long (in seconds). If minIdleSwap is higher, then it will
                     override this. This isn't exact: it is checked periodically.
                     -1 means sessions won't be swapped out for this reason,
                     although they may be swapped out for maxActiveSessions.
                     If set to >= 0, guarantees that all sessions found in the
                     Store will be loaded on startup.
                   maxIdleBackup: Sessions will be backed up (saved to the Store,
                     but left in active memory) if idle for this long (in seconds),
                     and all sessions found in the Store will be loaded on startup.
                     If set to -1 sessions will not be backed up, 0 means they
                     should be backed up shortly after being used.
                   To clear sessions from the Store, set maxActiveSessions, maxIdleSwap,
                   and minIdleBackup all to -1, saveOnRestart to false, then restart
                   Catalina.
              -->
                <!--
              <Manager className="org.apache.catalina.session.PersistentManager"
                  debug="0"
                  saveOnRestart="true"
                  maxActiveSessions="-1"
                  minIdleSwap="-1"
                  maxIdleSwap="-1"
                  maxIdleBackup="-1">
                    <Store className="org.apache.catalina.session.FileStore"/>
              </Manager>
                -->
              <Environment name="maxExemptions" type="java.lang.Integer"
                          value="15"/>
              <Parameter name="context.param.name" value="context.param.value"
                         override="false"/>
              <Resource name="jdbc/EmployeeAppDb" auth="SERVLET"
                        type="javax.sql.DataSource"/>
              <ResourceParams name="jdbc/EmployeeAppDb">
                <parameter><name>user</name><value>sa</value></parameter>
                <parameter><name>password</name><value></value></parameter>
                <parameter><name>driverClassName</name>
                  <value>org.hsql.jdbcDriver</value></parameter>
                <parameter><name>driverName</name>
                  <value>jdbc:HypersonicSQL:database</value></parameter>
              </ResourceParams>
              <Resource name="mail/Session" auth="Container"
                        type="javax.mail.Session"/>
              <ResourceParams name="mail/Session">
                <parameter>
                  <name>mail.smtp.host</name>
                  <value>localhost</value>
                </parameter>
              </ResourceParams>
              <ResourceLink name="linkToGlobalResource"
                        global="simpleValue"
                        type="java.lang.Integer"/>
            </Context>
            <!--
                Review Production Web Application Context
                NOTE: this set of connection params points to the development database because we're on the developement server.
            -->
            <Context
         path="/review"
         debug="0"
         reloadable="true"
         docBase="C:\download\eclipse\eclipse\workspace\review"
         workDir="C:\download\eclipse\eclipse\workspace\review\work\org\apache\jsp" >
                <Logger className="org.apache.catalina.logger.FileLogger" prefix="localhost_review_log." suffix=".txt" timestamp="true"/>
                <!-- JNDI entries for xmedia db -->
                <Resource name="jdbc/xmediaDB"
                    auth="Container"
                    type="javax.sql.DataSource">
                </Resource>
                <ResourceParams name ="jdbc/xmediaDB">
                    <parameter>
                        <name>factory</name>
                        <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
                    </parameter>
                    <parameter>
                        <name>maxActive</name>
                        <value>50</value>
                    </parameter>
                    <parameter>
                        <name>maxIdle</name>
                        <value>30</value>
                    </parameter>
                    <parameter>
                        <name>maxWait</name>
                        <value>80</value>
                    </parameter>
                    <parameter>
                        <name>username</name>
                        <value>root</value>
                    </parameter>
                    <parameter>
                        <name>password</name>
                        <value>admin</value>
                    </parameter>
                    <parameter>
                        <name>driverClassName</name>
                        <value>com.mysql.jdbc.Driver</value>
                    </parameter>
                    <parameter>
                        <name>url</name>
                        <value>jdbc:mysql://153.32.143.96:3306/xmedia_dev?autoReconnect=true</value>
                    </parameter>
                </ResourceParams>
            </Context>
          </Host>
        </Engine>
      </Service>
      <!-- The MOD_WEBAPP connector is used to connect Apache 1.3 with Tomcat 4.0
           as its servlet container. Please read the README.txt file coming with
           the WebApp Module distribution on how to build it.
           (Or check out the "jakarta-tomcat-connectors/webapp" CVS repository)
           To configure the Apache side, you must ensure that you have the
           "ServerName" and "Port" directives defined in "httpd.conf".  Then,
           lines like these to the bottom of your "httpd.conf" file:
             LoadModule webapp_module libexec/mod_webapp.so
             WebAppConnection warpConnection warp localhost:8008
             WebAppDeploy examples warpConnection /examples/
           The next time you restart Apache (after restarting Tomcat, if needed)
           the connection will be established, and all applications you make
           visible via "WebAppDeploy" directives can be accessed through Apache.
      -->
      <!-- Define an Apache-Connector Service -->
    <!--
      <Service name="Tomcat-Apache">
        <Connector className="org.apache.catalina.connector.warp.WarpConnector"
         port="8008" minProcessors="5" maxProcessors="75"
         enableLookups="true" appBase="webapps"
         acceptCount="10" debug="0"/>
        <Engine className="org.apache.catalina.connector.warp.WarpEngine"
         name="Apache" debug="0">
          <Logger className="org.apache.catalina.logger.FileLogger"
                  prefix="apache_log." suffix=".txt"
                  timestamp="true"/>
          <Realm className="org.apache.catalina.realm.MemoryRealm" />
        </Engine>
      </Service>
    -->
    </Server>and Here is my web.xml :
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <!-- BEGIN: icon section -->
    <!-- END: icon section -->
    <!-- BEGIN: display-name section -->
        <display-name>Cross-Media Review Server</display-name>
    <!-- END: display-name section -->
    <!-- BEGIN: description section -->
      <description>
      Cross-Media Review Server
      </description>
    <!-- END: description section -->
    <!-- BEGIN: distributable section -->
    <!-- END: distributable section -->
    <!-- BEGIN: context-param section -->
        <context-param>
            <param-name>javax.servlet.jsp.jstl.fmt.locale</param-name>
            <param-value>en-US</param-value>
        </context-param>
        <context-param>
            <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
            <param-value>messages</param-value>
        </context-param>
    <!-- END: context-param section -->
    <!-- BEGIN: listener section -->
    <!-- END: listener section -->
    <!-- BEGIN: error-page section -->
    <!-- END: error-page section -->
    <!-- BEGIN: filter section -->
        <filter>
            <filter-name>ReviewAuthenFilter</filter-name>
            <filter-class>com.adobe.xmtech.review.BeamAuthenticationFilter</filter-class>
        </filter>
    <!-- END: filter section -->
    <!-- BEGIN: filter-mapping section -->
        <filter-mapping>
            <filter-name>ReviewAuthenFilter</filter-name>
            <servlet-name>ReviewHandler</servlet-name>
        </filter-mapping>
    <!-- END: filter-mapping section -->
    <!-- BEGIN: servlet section -->
        <servlet>
            <servlet-name>ReviewHandler</servlet-name>
            <servlet-class>com.adobe.review.ReviewHandler</servlet-class>
            <init-param>
                <param-name>AcrobatFeedback</param-name>
                <param-value>none</param-value> <!-- console, alert, none -->
            </init-param>
            <init-param>
                <param-name>FDFLogging</param-name>
                <param-value>file</param-value> <!-- file, none -->
            </init-param>
        </servlet>
        <servlet>
            <servlet-name>Image</servlet-name>
            <servlet-class>com.adobe.review.util.ImageServer</servlet-class>
        </servlet>
        <servlet>
            <servlet-name>Precompile</servlet-name>
            <servlet-class>com.adobe.review.util.Precompile</servlet-class>
        </servlet>
        <servlet>
            <servlet-name>Login</servlet-name>
            <servlet-class>com.adobe.xmtech.review.Login</servlet-class>
        </servlet>
        <servlet>
            <servlet-name>Logout</servlet-name>
            <servlet-class>com.adobe.xmtech.review.Logout</servlet-class>
        </servlet>
        <servlet>
            <servlet-name>FetchPDF</servlet-name>
            <servlet-class>com.adobe.review.beam.misc.FetchPDF</servlet-class>
        </servlet>
    <!-- END: servlet section -->
    <!-- BEGIN: servlet-mapping section -->
        <servlet-mapping>
            <servlet-name>Image</servlet-name>
            <url-pattern>/acrobat/img/*</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>Precompile</servlet-name>
            <url-pattern>/acrobat/jsp/*</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>Login</servlet-name>
            <url-pattern>/acrobat/misc/Login</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>Logout</servlet-name>
            <url-pattern>/acrobat/misc/Logout</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>FetchPDF</servlet-name>
            <url-pattern>/acrobat/misc/FetchPDF/*</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>ReviewHandler</servlet-name>
            <url-pattern>/acrobat/*</url-pattern>
        </servlet-mapping>
        <servlet-mapping>
            <servlet-name>ReviewHandler</servlet-name>
            <url-pattern>*.fdf</url-pattern>
        </servlet-mapping>
    <!-- END: servlet-mapping section -->
    <!-- BEGIN: session-config section -->
        <session-config>
            <session-timeout>86400</session-timeout>
        </session-config>
    <!-- END: session-config section -->
    <!-- BEGIN: mime-mapping section -->
        <mime-mapping>
            <extension>pdf</extension>
            <mime-type>application/pdf</mime-type>
        </mime-mapping>
        <mime-mapping>
            <extension>fdf</extension>
            <mime-type>application/fdf</mime-type>
        </mime-mapping>
    <!-- END: mime-mapping section -->
    <!-- BEGIN: welcome-file-list section -->
        <welcome-file-list>
            <welcome-file>login.jsp</welcome-file>
            <welcome-file>index.jsp</welcome-file>
            <welcome-file>index.html</welcome-file>
            <welcome-file>index.htm</welcome-file>
        </welcome-file-list>
    <!-- END: welcome-file-list section -->
    <!-- BEGIN: error-page section -->
    <!-- END: error-page section -->
    <!-- BEGIN: taglib section -->
    <!-- END: taglib section -->
    <!-- BEGIN: resource-ref section -->
        <!-- krs added for JNDI db connection -->
        <resource-ref>
            <description>DB Connection</description>
            <!-- For JBoss, use java:/jdbc/xmediaDB as the res-ref-name -->
            <!-- For Tomcat, use jdbc/xmediaDB as the res-ref-name -->
            <res-ref-name>java:comp/env/jdbc/xmediaDB</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
        </resource-ref>
    <!-- END: resource-ref section -->
    <!-- BEGIN: security-constriaint section -->
    <!-- END: security-constriaint section -->
    <!-- BEGIN: login-config section -->
    <!-- END: login-config section -->
    <!-- BEGIN: security-role section -->
    <!-- END: security-role section -->
    <!-- BEGIN: env-entry section -->
    <!-- END: env-entry section -->
    <!-- BEGIN: ejb-ref section -->
    <!-- END: ejb-ref section -->
    </web-app>

  • MySQL database connections supported?

    Hi,
    I am trying to connect to mysql database using the 'write to database' and 'query database' activities of utilities.
    I have used it successfully for MS SQL but am not able to work with MySQL. I have created the ODBC connection to MySQL database and am able to successfully test connection to mysql database from the 'odbc datasource administrator' window of administrative
    tools.Also able to retrieve the databse names in this window.
    However when I run the write to DB activity to use this ODBC connection, i get the below error (tkt is the name of the 'table').
    Database error has occurred. [MySQL][ODBC 5.3(a) Driver][mysqld-5.6.21]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''tkt'' at line 1
     Code = 80040e14
     Code meaning = IDispatch error #3092
     Source = Microsoft OLE DB Provider for ODBC Drivers
     Description = [MySQL][ODBC 5.3(a) Driver][mysqld-5.6.21]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''tkt'' at line 1
    Any compatibility issues or anything else?

    Hello,
    I can reproduce the issue with exactly the same error code. Query database ran without problem except write to database. I also tried to use SQL server instead, and it succeeded.
    I saw the same error with SQL server at first because I used the wrong database. So I’m not sure if we need additional implement with MySQL.
    As suggested, run the same task with script should be a good workaround.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • CS3 mysql database connection using php

    Hi, this is my first time trying to connect to a database.  I have created a mysql database with my hosting provider.  I am also configured to use php. I have ready numerous threads on this topic, but am still confused.
    I am getting the following error message:
    When I enter the following information into the connection string, I get the following error Error http error code 404 file not found. The site does not map to ftp.readyhosting.com/_mmserverscripts/mmhttdb.php Is the location of mysql server correct? Connection name ? user defined ?aosprod?
    Mysql server = aoswebeditor.readyhostingmysql.com.  Also, this is not the same location as the web server. 
    The hosting company provides the following php code to connect to the database. 
    <?php
    $link = mysql_connect('aoswebeditor.readyhostingmysql.com', 'aosweb', '*password*');
    if (!$link) {
        die('Could not connect: ' . mysql_error());
    echo 'Connected successfully';
    mysql_select_db(aos);
    ?>
    Because of the connection dialog boxes in CS3, I have not used this php code but only used the mysql server aoswebeditor.readyhostingmysql.com.
    My requirements are very simple, I want to use the same remote database for the dreamweaver connection for the remote and testing server.
    Any ideas would be appreciated.
    Thanks. George

    First of all, you seem to be mixed up about terminology. ASP stands for Active Server Pages, and is a type of server technology similar to PHP. I think you mean ISP (Internet Service Provider). However, this is not correct, either. An ISP provides your connection to the internet. Although some ISPs also host websites for their customers, your website is normally located at a hosting company. You need to get that mixup out of the way. Otherwise, you might confuse people with future questions about ASP, when you actually mean something completely different.
    OK, lecture over...
    Your hosting company is following standard procedure by preventing remote access to MySQL databases. However, Dreamweaver does make it possible to use your remote database and website for testing purposes. It does so by uploading a hidden folder called _mmServerScripts to your remote server. This performs a local connection with your database, and then sends the results back to your local computer. When setting up your testing server definition in Dreamweaver, you need to provide the details as I indicated before. When creating a MySQL connection in Dreamweaver, fill in the server name and account details as given to you by your hosting company. If everything is set up correctly, you should be able to use your remote server and database for testing.
    Having said that, it is much better to install a local testing environment. You'll find it faster, and it also lets you make mistakes (an essential part of the learning process) in the security of a closed environment. For details of how to set up a local testing environment, see this article in the Adobe Developer Connection.

  • Jsp JST MySQL - database connection

    Hello
    I am facing a database connection problem. I want to connect to mysql database fro a jsp page that uses JSTL taglibs.
    I am using Tomcat 5.x, JSTL 1.1. MySQL 5x
    I have copied jstl.jar, standard.jar and mysql driver in the \WEB-INF\lib dir of my application.
    If I connect to the database using scriptlet it works. But If I connect using the sql taglib, it gives me the error
    2008-01-22 14:20:12 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
    javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"
    my jsp file is as follows
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <c:set var="firstName">request.getParameter("name")</c:set>;
    <%= request.getParameter("name") %>
    <sql:setDataSource
    var="myDS"
    scope="request"
    driver="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/contact_db"
    user="root"
    password=""
    />
    <sql:query var="phone_book" dataSource="$(myDS)">
    Select last_name, home, cell, office from phone_book where first_name = ?
    <sql:param value="firstName"/>
    </sql:query>
    <HTML>

    hi thanks
    please let me know whats the better approach for getting an database connection if this is not recommended.
    after some modifications i am not getting the no suitable driver error. I also updated the code as per your comments. ...yet am not seeing any results.
    I have modified the file as follows.
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%
    String firstName = request.getParameter("name");
    %>
    <%= firstName %>
    <sql:setDataSource
    var = "firstDS"
    scope="request"
    driver="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/contact_db"
    user="root"
    password=""
    />
    <sql:query var="phone_book" dataSource="${firstDS}">
         Select * from phone_book where first_name = ?
         <sql:param value="${firstName}"/>
    </sql:query>
    <c:forEach var="phone_book" items="${user.rows}">
         <tr>
    <td><c:out value="${row.no}"/></td>
    <td><c:out value="${row.first_name}"/></td>
    <td><c:out value="${row.last_title}"/></td>
    <td><c:out value="${row.home}"/></td>
    <td><c:out value="${row.cell}"/></td>
    <td><c:out value="${row.office}"/></td>
    </tr>
    </c:forEach>
    <HTML>
    <BODY>
         Hello
    </BODY>
    </HTML>

  • Mysql database connection with Labwindows/CVI 2009 sql toolkit

    Dear experienced users,
    I am using the following software/hardware:
    Windows 7/ Mysql database 5.6.15 64-bit with MySql ODBC 5.2 Ansi driver installed
    Labwindows/CVI 2009 with sql toolkit
    The user DSN of ODBC Data source administrator have been confiugred to one of mysql database. The test MYSQL Connector/ODBC is succesful.
    The Labwindows/CVI build setting is configure to debug64 after trying debug (32)
    The source code is from the example readtab.c with changes to the dsn I am testing
        hdbc = DBConnect ("DSN=dvd_collection");   
    The error message I have is confusing me.
    (it is in the attachd png)
    I thought it was due to the 64 bit mysql database. That's why I tried the 64 bit build from Labwiondws/CVI. I alsow tried Labview DB tools open connect.vi. It shows me the same error.
    Any suggestion is appreciated.
    Thanks,
    Jimmy
    Attachments:
    Capture.PNG ‏24 KB

    Jimmy
    I always use connection strings of the form "DSN=datasourcename;UID=database_user_id; PWD=database_user_password".
    Where:
    datasourcename = The name of the connection defined in the ODBC connection.
    database_user_id = One of the user identities created by the database administrator. Obviously the administrator will lock down the permissions appropriate to the task in hand.
    database_user_password = The password that identifies database_user_id, again set by the database administrator.
    Note that while it is obviously desireable to lock the permissions down as far as possible on the MySQL server, the more you do so, the slower the database will run, because of the way mySQL searches the permissions tables.

  • MySQL database connection: Communications link failure Last packet sent to the server was 0 ms ago.

    Hello,
    I am trying to connect to an external MySQL database from within a bundle.
    But I keep getting this error:
    Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Communications link failure Last packet sent to the server was 0 ms ago.)
    These are the details of my bundle:
    1)          Spring bundle(using Spring DM)
    2)          MySQL database is at port 7046 so my bean is as below:
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
                        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
                        <property name="url"  value="jdbc:mysql://instance13550.db.xeround.com:7046/jas" />
                        <property name="username" value="mysql" />
                        <property name="password" value="mysql" />
    </bean>
    My bundle connects to the mysql database from withina  local  felix installation. But when I put the same bundle within CQ I get the error.
    Please help.
    Karan

    I dont know the answer, but if you google for this, some articles listed might help:
    re: "Communications link failure Last packet sent to the server was"
    Note: I use 're:' which is short for 'reply',
    I think you will also be better off using preparedStatements. Dont forget to use preparedStatement.clearParameters() just before preparedStatements.setString() items in the loop
    Also, I question why you need to test having 1000 test users all banging away at your application at once. Chances are, most will be staring at your web page and only a few will ever hit the update/insert button
    within the same 100 milliseconds or so that your process takes to update.

  • Error in odbc database connection

    Hi All,
    I have created database connection from SAP system to another no sap system (Radar) using the tcode DBCO and maintained the following parameters
    DB connection: RADAR_DEV
    DBMS            : MSS
    user Name : RADAR_DVLP
    Db password : **********
    conn info : msql_server=hostname of SQL server msql_dbname=DB name object_source=DB name
    It is gives a below short dump when this db connection (DB connection name) is used in a program by ABAPer
    error message
                                                                                    The error occurred in the current database connection "RADAR_DEV".                                                                               
    What can you do?                                                                               
    Print out the error message (using the "Print" function)                          
    and make a note of the actions and input that caused the                          
    error.                                                                               
    To resolve the problem, contact your SAP system administrator.                    
    You can use transaction ST22 (ABAP Dump Analysis) to view and administer          
    termination messages, especially those beyond their normal deletion              
    date.                                                                               
    Error analysis                                                                               
    An exception occurred. This exception will be dealt with in more detail           
    below. The exception, assigned to the class 'CX_SY_NATIVE_SQL_ERROR', was not     
    caught, which                                                                    
    led to a runtime error. The reason for this exception is:                                                                               
    How to correct the error                                                                               
    Database error text........: "Line 1: Incorrect syntax near '.'."         
    Triggering SQL statement...: "FETCH NEXT "                                
    Internal call code.........: "[DBDS/NEW DSQL]"                            
    Please check the entries in the system log (Transaction SM21).                                                                               
    You may able to find an interim solution to the problem                   
    in the SAP note system. If you have access to the note system yourself,   
    use the following search criteria:                                                                               
    "DBIF_DSQL2_SQL_ERROR" CX_SY_NATIVE_SQL_ERRORC                            
    "ZRADAR_EXTRACT" or "ZRADAR_EXTRACT"                                      
    "START-OF-SELECTION"                                                      
    Can you please help me on resolving this issue
    Thanks,
    Vadi

    Hello Vadivambal,
    Could you please provide the syntax of line, on which the dump occurs.
    Is user RADAR_DVLP able to fetch same data without an ABAP program?
    Regards,
    Ammey Kesarkar

Maybe you are looking for