Record string indicator to mysql database

Hi experts, i have 3 string indicator and i want to record the data to mysql database. i already have a table with 3 column. how can i do that?
Thank you
Attachments:
test.vi ‏18 KB

attached is my vi. since i'm really new to programming and labview, can please somebody advise me about my vi. I will use this vi to record minutes of meeting to a mysql database. the dalog_resp.vi is used to fill the responsible string.
I need to display all mysql data into a table and i need to short the data based on project, meeting date, status and responsbile (i'm thinking to use combo box). e.q if i  choose "SAM" from responsible combo box, i want the table only show the data contain SAM value. And i have another problem...when i put the boolean button into a cluster, it won't call the dialog_resp.vi
Please advice me...
Thank you
Regards
Ijan
Attachments:
db.vi ‏534 KB
Dialog resp.vi ‏11 KB

Similar Messages

  • Inserting data into a MySQL database

    Hi. I am currently working on a group project and know very little about java to be honest
    I'm trying to insert records into a local MySQL database, but I'm having trouble.
    When the application is started, a connection is made to the database, which, as far as I can tell is successful. The user adds the data through a method in a console class which then passes the parameters to 'insertCustomer' method in class DatabaseIO.
    Connection code from DatabaseIO class
    public static void openDatabase(){
    //          start by making the connection
              try{
                   //System.out.println("setting up class");
                   Class.forName("com.mysql.jdbc.Driver");
              catch(Exception e){
                   System.out.println("Driver set up error" + e);
              try{
                   url="jdbc:mysql://localhost:3306/db0611426";
                   con=DriverManager.getConnection(url,"root","");
                   System.out.println("setting up database");
                   Opened = true;
              catch (Exception e){
                   System.out.println("database connection error"+ e);
         }Add customer form
    public void addCustomer() {
                        int customerID, depositPercentage;
                        String firstName, lastName, address, phoneNumber, add;
                        boolean purchaser;
                        double budget;
                        System.out.println("\n*** Enter Customer details: ***");
                        customerID = TextInputPrompt.getInteger("Customer ID Number: ");
                        firstName = TextInputPrompt.getString("First Name: ");
                        lastName = TextInputPrompt.getString("Last Name: ");
                        address = TextInputPrompt.getString("Address: ");
                        depositPercentage = TextInputPrompt.getInteger("Deposit Percentage");
                        budget = TextInputPrompt.getDouble("Budget");
                        purchaser = TextInputPrompt.getBoolean("Purchaser?");
                        phoneNumber = TextInputPrompt.getString("Phone Number: ");
                        add = TextInputPrompt.getString("Add Customer Y/N?: ");
                        if (!add.equalsIgnoreCase("y"))
                             return;
                        customers.addCustomers(new Customer(purchaser, customerID, firstName, lastName, address, phoneNumber, depositPercentage, budget));
                        DatabaseIO.insertCustomer(purchaser, customerID, firstName, lastName, address, phoneNumber, depositPercentage, budget);
              }Constructor in customer class
    public Customer(boolean purchaser,int customerID,String firstName,String lastName,String address,String phoneNumber,int depositPercentage,double budget) {
              super();
              this.purchaser = purchaser;
              this.customerID = customerID;
              this.firstName = firstName;
              this.lastName = lastName;
              this.address = address;
              this.phoneNumber = phoneNumber;
              this.depositPercentage = depositPercentage;
              this.budget = budget;
         }Code to insert customer into table (DatabaseIO class)
    //add a new customer to the customers table
         public static void insertCustomer(boolean purchaser,int customerID,String firstName,String lastName,String address,String phoneNumber,int depositPercentage,double budget){
             String query = "INSERT customer (purchaser,customerID,firstName,lastName,address,phoneNumber,depositPercentage,budget) VALUES ('"+purchaser+"','"+customerID+"','"+firstName+"','"+lastName+"','"+address+"','"+phoneNumber+"','"+depositPercentage+"','"+budget+"')";
             System.out.println("inserting "+ query);
             try{
                  Statement stmt = con.createStatement();
                  int rs = stmt.executeUpdate(query);
             catch (Exception e){
                  System.out.println("insert failed");
        }After entering the data, the 'insert failed' is displayed in the console. Any suggestions on how to solve the problem or any ways of finding out more about the exception would be very much appreciated, thanks in advance!

    Here's how to find out more about the exception:
    catch (Exception e){
      System.out.println("insert failed");
      e.printStackTrace();
    }

  • Update command overwrites 1st record in mysql database

    hi
    I'm having a bit of a problem with a form I created in livecycle designer.
    I have connected the form to a MySQL database.
    whenever I try to update a record , retrieved via navigation buttons or search box, the 1st record in the mysql database is overwritten.
    I'm using the xfa.sourceSet.DataConnection.update() with and an click event
    I have my Stay BOF and Stay EOF set on the data connections.
    I'm not sure what I am doing wrong.
    The forms Data connections are using sql select query because the table in the database has an auto incrementing column.
    any suggestions you guys provide will be appreciated.

    Guys, I am still racking my brain. I have taken some screenshots to show you how I have my database tables set up. I was able to get the tables over to the InnoDB type so I can make foreign keys. Here is how I currently have them setup, can someone check this out and see if it's correct?
    Table 1 (carinfo)
    Table 2 (images)
    Thanks

  • Mysql database, counting records

    Hi!
    I have to store measured data to MySQL database. During this process I would like to count a number of records in a database table. It is also necessary to filter records. I'm using the SQL statement as follows:
    SELECT COUNT (fieldname) AS cnt FROM table WHERE condition
    Because I haven't got any result I've created a small database "mysweetdb" and table "icecream" to test my VIs (see picture bellow).
    The VI is attached. The result of counting is a 2D array (DB Tools Fetch Recordset Data.VI output) with one element (one row and one column). This element contains no data.
    I usually don't give up easily so I've created a similar MS ACCESS database and counted data in it. I've got a correct answer: 3. So it might be possible that there is something wrong with MySQL driver. But I've created a small Delphi project and I've counted records in MySQL database and MS ACCESS database. Both results were correct.
    Can anyone explain where is the problem in communication between LabView and MySQL database?
    Versions: XAMPP for Windows 1.7.3, LabView Developer Suite 2010 SP1, MySQL 5.1 ODBC driver
    Thanks in advance for your suggestions.
    Attachments:
    Count records.vi ‏19 KB

    ContDivConsult,
    thank you for your answer. An updated version of my VI is attached. It uses two options: LabSQL library and DB Connectivity Toolkit. LabSQL gives correct results.
    Regards,
    Ljubo.
    Attachments:
    Count records.vi ‏25 KB

  • MySQL database record hits counter?

    Can I find out how many times a record from the MySQL databse was called and displayed on a web browser?Basically a MySQL database record hits counter. I’m using PHP/MySQL.
     

    >to the two files that were created
    >Two files?
    Yes 2 files. In Dreamweaver CS3 & CS4 When using the "Insertà Data Objectsà Master Detail Page Set" function you must create two files:
    1. results.php
    2. detail.php
    It appears that these two files work together hand in hand. You did not specify where nor how to include an update record set that gets executed every time another record set that I want to count fires. So I combined the two as one until it was clarified. 
      

  • Recording events in mySQL database?

    I am new to Java and would like to know if the following can be done:
    We have a web page where the user chooses to watch different Windows Media Files using a Java menu system (not written by me).
    Is it possible to record what the user is doing (i.e. which media files they are choosing) in a mySQL database? I would normally do this with PHP, but as all the action is happening once the page has loaded I don't think that will work.
    Thanks in advance!

    Sure it's possible if you notice the events and can pass on the actions to a component that does the writing.
    You can do it in PHP - unless it uses some magic to switch the embedded movies somehow, a new page has to be requested for a movie. If it all runs within the applet (I hope that this is what you mean, and not Javascript) and you can't modify it, then you can't, unless you can convince your webserver to log to the DB.

  • Php/MySQL database insert record issue...

    I have a php page that adds an "order" to a mysql database table (orders). One text field in the form is for tires/wheels. The description of the wheels often includes the " symbol for inches after a number....Everything submits fine, however when I look at the page that displays the orders all the data after the " symbol including the " symbol is gone... DOes anyone have any idea why this may be happening? It is requiring us to return and edit that area repeatedly. Any help is appreciated greatly. Thanks for your time.

    Ok, so just to summarize so I am understanding this correctly.  You have an ordering page for tires/wheels.  A customer places an order for tires/wheels and the data is submitted successfully and this includes a symbol for measurement (in.).  But on another summary page the symbol is returning a blank value.
    If this is correct we need to see:
    - First, the code that is inserting the symbol to the database table in question
    - Second, the query and code where you are printing the data to the screen.

  • Using MySQL database in Jdeveloper

    I am using MySQl database in my applicaion.I have successfully created connection to the database and have created entity beans from the tables and a session bean as well to use the entity beans
    now when i am trying to call persistEntity(object obj) of session bean, basically to insert records into tables.
    i am getting following exception :
    Internal Exception: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: 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 '"tdmce_approval_status" (APPROVALLEVEL, DOCREFNO, STATUS, COMMEError Code: 1064
    Call:INSERT INTO "tdmce_approval_status" (APPROVALLEVEL, DOCREFNO, STATUS, COMMENTS, DMCETYPE, ACTIONDATE) VALUES (?, ?, ?, ?, ?, ?)
         bind => [1, 12355, Approved, abcd, import, 12/03/2008]
    i believe this insert query is automatically generated by Jdeveloper. have tried executing the same query in sql sheet it has worked perfectly fine.
    Can any one please suggest on this ?

    Hi Frank,
    thanks for your response, there are only setters & getters method in my entity
    my entity look like this
    package buslogic;
    import java.io.Serializable;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.Id;
    import javax.persistence.IdClass;
    import javax.persistence.NamedQuery;
    import javax.persistence.Table;
    @Entity
    @NamedQuery(name = "TdmceApprovalStatus.findAll",
    query = "select o from TdmceApprovalStatus o")
    @Table(name = "\"tdmce_approval_status\"")
    @IdClass(TdmceApprovalStatusPK.class)
    public class TdmceApprovalStatus implements Serializable {
    @Column(nullable = false)
    private String actiondate;
    @Id
    @Column(nullable = false)
    private Integer approvallevel;
    private String comments;
    @Column(nullable = false)
    private String dmcetype;
    @Id
    @Column(nullable = false)
    private String docrefno;
    @Id
    @Column(nullable = false)
    private String status;
    public TdmceApprovalStatus() {
    public String getActiondate() {
    return actiondate;
    public void setActiondate(String actiondate) {
    this.actiondate = actiondate;
    public Integer getApprovallevel() {
    return approvallevel;
    public void setApprovallevel(Integer approvallevel) {
    this.approvallevel = approvallevel;
    public String getComments() {
    return comments;
    public void setComments(String comments) {
    this.comments = comments;
    public String getDmcetype() {
    return dmcetype;
    public void setDmcetype(String dmcetype) {
    this.dmcetype = dmcetype;
    public String getDocrefno() {
    return docrefno;
    public void setDocrefno(String docrefno) {
    this.docrefno = docrefno;
    public String getStatus() {
    return status;
    public void setStatus(String status) {
    this.status = status;
    & session bean class to call the same
    package buslogic;
    import buslogic.persistance.TdmceApprovalsFlow;
    import buslogic.persistance.TdmceApprovalsFlowPK;
    import buslogic.persistance.TdmceUserDetails;
    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    @Stateless(name = "FirstCheckFacade")
    public class FirstCheckFacadeBean implements FirstCheckFacade {
    @PersistenceContext(unitName = "SOAServices")
    private EntityManager em;
    public FirstCheckFacadeBean() {
    public Object mergeEntity(Object entity) {
    return em.merge(entity);
    public Object persistEntity(Object entity) {
    em.persist(entity);
    return entity;
    /** <code>select o from TdmceApprovalsFlow o</code> */
    public List<TdmceApprovalsFlow> queryTdmceApprovalsFlowFindAll() {
    return em.createNamedQuery("TdmceApprovalsFlow.findAll").getResultList();
    public void removeTdmceApprovalsFlow(TdmceApprovalsFlow tdmceApprovalsFlow) {
    tdmceApprovalsFlow =
    em.find(TdmceApprovalsFlow.class, new TdmceApprovalsFlowPK(tdmceApprovalsFlow.getApprovallevel(),
    tdmceApprovalsFlow.getDmcetype()));
    em.remove(tdmceApprovalsFlow);
    /** <code>select o from TdmceUserDetails o</code> */
    public List<TdmceUserDetails> queryTdmceUserDetailsFindAll() {
    return em.createNamedQuery("TdmceUserDetails.findAll").getResultList();
    public void removeTdmceUserDetails(TdmceUserDetails tdmceUserDetails) {
    tdmceUserDetails =
    em.find(TdmceUserDetails.class, tdmceUserDetails.getUserid());
    em.remove(tdmceUserDetails);
    Where else can i look for the query?or for mysql i have to configure some property.

  • Don't get a result set from a query to mySql database

    Hello everyone,
    I am writing a program in which i refer to a mySql database.
    I encountered a problem using the executeQuery in which i don't get a resultSet at the end of the run,
    instead i get a null.
    gust for the record, the api says that it will never return null(se 6), also i queried the DB with a mySql client and the data is there
    and when i use execute("") everything works fine.
    I just can't get my wished result.
    the peace of code I am referring to is here, please feel free to say if you need more code...
    public static ResultSet getAccountResSet(int id) throws SQLException {
             //String query = "SELECT acctNum, acctOwnerId, acctOwnerName, balance, acctType, creditLimit, yearlyInterest, duration, creationDate, relatedCheckingAccoun FROM accounts WHERE acctNum="+id;
             String query = "select * from accounts where id="+id;
             ResultSet rs = statement.executeQuery(query);//this line falls, rs is null and i get null pointer exception
             return rs;
        }thanks for you help :)
    Edited by: gizmokaka on Mar 29, 2008 8:37 AM

    Maybe it's not the function executeQuery(query) that gives you the nullpointer. I think it may be that there is no connection to the DB, in which case the statement variable is null. Call to a method through this variable will trigger a nullpointer. Could you please post the exception text here? It may tell you where the NullPointerException occurs.
    //Chris

  • Send form data via email after posting to MySQL database

    I have created a form in DreamweaverMX 2004 and then tied it to mySQL database so that on submit the data posts to the database.
    This works fine. It also goes to a "success" page just fine. I then added in some php code to also email a few of the fields from the form to a specific email address. This functions correctly using this code below (the email does go - the "from" email address has my login for MySQL database) EXCEPT that the data from the fields does not come through. The field labels are there as indicated below and the email is formatted correctly, but the data doesn't come through.
    mail( $to = "[email protected]", $subject = "Someone has submitted an application",
    $content= "Essay 1: ".$Essay1."\r\n"
    ."Essay 2: ".$Essay2."\r\n"
    ."Essay 3: ".$Essay3."\r\n"
    ."Essay 4: ".$Essay4."\r\n"
    ."Essay 5: ".$Essay5."\r\n");
    What am I doing wrong?
    That's problem #1 - then problem #2 is that I actually also need to send the ID code in this email for the specific record which has been created in my database so the end recipient can associate the email with that specific ID later for other purposes. So even if I figure out problem #1, I'm not sure that I can use this code for problem #2 because the field isn't on the html form, but actually created by the database upon submission.
    Any suggestions would be helpful!
    Thanks

    Moved to the Dreamweaver Application Development forum, which deals with PHP and other server-side issues.

  • 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>

  • 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, EJB in Jboss 4 with mySQL database. Error in connecting to database

    Hi, i using JBoss 4-0-1 with jsp and mySQL database. I get this example from a book using stateless session beans. However i modify it so it can connect to mySQL database.
    This is my code for jsp.
    <%@ page import="asg.MusicEJB.*,
    java.util.*,
    javax.naming.Context,
    javax.naming.InitialContext,
    javax.rmi.PortableRemoteObject" errorPage="error.jsp" %>
    <%--
         The following 3 variables appear in a JSP declaration.
         They appear outside the generated _jspService() method,
         which gives them class scope.
         Since we want to initialize our Music EJB object once
         and read the Music Collection database to get the
         recording titles once, we place this code inside
         method jspInit().
         The EJB business method getMusicList()
         returns a collection of RecordingVO objects which we
         store in ArrayList albums.
    --%>
    <%!
         MusicHome musicHome;
         Music mymusic;
         ArrayList albums;
         Properties properties=new Properties();
         public void jspInit() {
                   properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
                   properties.put(Context.PROVIDER_URL, "localhost:3306");
                   System.out.println("............................in properties");
              try {
                   //Context initial = new InitialContext();
                   InitialContext jndiContext = new InitialContext(properties);
                   //Object ref  = jndiContext.lookup("MusicEJB");
                   Object objref = jndiContext.lookup("java:comp/env/ejb/EJBMusic");
                   musicHome = (MusicHome)PortableRemoteObject.narrow(objref, MusicHome.class);
                   mymusic = musicHome.create();
                   albums = mymusic.getMusicList();
                   System.out.println(".............................in line 64");
              } catch (Exception ex) {
                   System.out.println("Unexpected Exception............: " +
                             ex.getMessage());
                   ex.printStackTrace();
    %>
    <%--
         The following scriptlet accesses the implicit
         request object to obtain the current URL
         and saves it to the session object for later retrieval. 
         It also saves variable mymusic, so we can
         make remote calls to our Music EJB, and the collection of
         RecordingVO objects.  These variables will all be available
         to other pages within the session.
    --%>
    <%
         String requestURI = request.getRequestURI();
         session.putValue("url", requestURI);
         session.putValue("mymusic", mymusic);
         session.putValue("albums", albums);
    %>
    <html>
    <head>
    <title>Music Collection Database Using EJB & JSP Version 9.7</title>
    </head>
    <body bgcolor=white>
    <h1><b><center>Music Collection Database Using EJB & JSP</center></b></h1>
    <hr>
    <p>
    There are <%= albums.size() %> recordings.
    <form method="post" action="musicPost.jsp">
    <p>
    Select Music Recording:
    <select name="TITLE">
    <%
         // Generate html <option> elements with the recording
         // titles stored in each RecordingVO element.
         // Obtain the current title from the session object
         // (this will be null the first time).
         String title;
         String currentTitle = (String)session.getValue("curTitle");
         if (currentTitle == null) currentTitle = "";
         RecordingVO r;
         Iterator i = albums.iterator();
         while (i.hasNext()) {
              r = (RecordingVO)i.next();
              title = r.getTitle();
              if (title.equals(currentTitle)) {
                   out.println("<option selected>" + title + "</option>");
              else {
                   out.println("<option>" + title + "</option>");
    %>
    </select><p><p>
    <%--
         Provide a "View Tracks" button to submit
         the requested title to page musicPost.jsp
    --%>
    <input TYPE="submit" NAME="View" VALUE="View Tracks">
    </form>
    </body>
    </html>Message was edited by:
    chongming

    This is the deployment descriptor for the .ear file.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' 'http://java.sun.com/dtd/application_1_3.dtd'>
    <application>
      <display-name>MusicDAOApp</display-name>
      <description>Application description</description>
      <module>
        <web>
          <web-uri>war-ic.war</web-uri>
          <context-root>music</context-root>
        </web>
      </module>
      <module>
        <ejb>ejb-jar-ic.jar</ejb>
      </module>
    <!--
      <module>
        <java>app-client-ic.jar</java>
      </module>
    -->
    </application>
    And this is the deployment for the ejb class files:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
    <ejb-jar>
      <display-name>MusicEJB</display-name>
      <enterprise-beans>
        <session>
          <display-name>MusicEJB</display-name>
          <ejb-name>MusicEJB</ejb-name>
          <home>asg.MusicEJB.MusicHome</home>
          <remote>asg.MusicEJB.Music</remote>
          <ejb-class>asg.MusicEJB.MusicBean</ejb-class>
          <session-type>Stateless</session-type>
          <transaction-type>Bean</transaction-type>
          <env-entry>
            <env-entry-name>MusicDAOClass</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>asg.MusicEJB.MusicDAOCloudscape</env-entry-value>
          </env-entry>
         <env-entry>
         <env-entry-name>dbUrl</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>jdbc:mysql://localhost/music</env-entry-value>
          </env-entry>
          <env-entry>
            <env-entry-name>dbUserName</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>chongming</env-entry-value>
          </env-entry>
          <env-entry>
            <env-entry-name>dbPassword</env-entry-name>
            <env-entry-type>java.lang.String</env-entry-type>
            <env-entry-value>kcm82</env-entry-value>
         </env-entry>
          <security-identity>
            <description></description>
            <use-caller-identity></use-caller-identity>
          </security-identity>
        </session>
      </enterprise-beans>
    </ejb-jar>I can combine the jar and war files into a ear file. deploying is alright without any errors.
    However when i run the jsp, it prompt this error:
    You Have Encountered an Error
    Stack Trace
    java.lang.NullPointerException
         at org.apache.jsp.musicGet_jsp._jspService(org.apache.jsp.musicGet_jsp:111)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
         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:810)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
         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.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
         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:856)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
         at java.lang.Thread.run(Thread.java:595)
    How to i solve the error? I look at he catch results in the command prompt of JBoss , i found that when running, the code will be caught by the exception and display this:int.java:527)
    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWor
    kerThread.java:112)
    at java.lang.Thread.run(Thread.java:595)
    13:55:21,375 INFO [STDOUT] Unexpected Exception............: EJBException:; nes
    ted exception is:
    javax.ejb.EJBException: getMusicList: SQLException during DB Connection:
    The url cannot be null
    13:55:21,375 INFO [STDOUT] java.rmi.ServerException: EJBException:; nested exce
    ption is:
    javax.ejb.EJBException: getMusicList: SQLException during DB Connection:
    The url cannot be null 13:55:21,375 INFO[STDOUT] at org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:352)
    13:55:21,375 INFO [STDOUT] at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:196)
    What can i do to solve the problem? please helpMessage was edited by:
    chongming
    Message was edited by:
    chongming
    Message was edited by:
    chongming

  • Can't connect a servlet to a mysql database (jdbc)

    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    public class LoginServletJDBC extends HttpServlet{
         public void doGet(HttpServletRequest request,HttpServletResponse response)
         throws ServletException,IOException{
              sendLoginForm(response,false);     }
         public void sendLoginForm(HttpServletResponse response,boolean error)
         throws ServletException,IOException{
              response.setContentType("text/html");
              PrintWriter out = response.getWriter();
              out.println("<html><head>");
              out.println("<title>Login</title>");
              out.println("</head>");
              out.println("<body>");
              out.println("<center>");
              if(error)
                   out.println("<b>Failed login. Please try again</b>");
              out.println("<br><br>");
              out.println("<h2>Login page</h2>");
              out.println("<br>Please enter your username and password");
              out.println("<br><br>");
              out.println("<form method=post>");
              out.println("<table>");
              out.println("<tr>");
              out.println("<td>Username : </td>");
              out.println("<td><input type=text name=userName></td>");
              out.println("</tr>");
              out.println("<tr>");
              out.println("<td>Password : </td>");
              out.println("<td><input type=password name=password></td>");
              out.println("</tr>");
              out.println("<tr>");
              out.println("<td align=right colspan=3>");
              out.println("<input type=submit value=Login></td>");
              out.println("</tr>");
              out.println("</table>");
              out.println("</form>");
              out.println("</center>");
              out.println("</body></html>");
    public void doPost(HttpServletRequest request,HttpServletResponse response)
         throws ServletException,IOException{
              String userName = request.getParameter("userName");
              String password = request.getParameter("password");
              if(login(userName,password)){
                   RequestDispatcher rd = request.getRequestDispatcher("AnotherServlet");
                   rd.forward(request,response);
              else{
                   sendLoginForm(response,true);
         boolean login(String userName,String password){
              try{
                   String url = "jdbc:mysql://localhost:3306/Users";
                   Class.forName("com.mysql.jdbc.Driver");
                   Connection con = DriverManager.getConnection(url,"root","");
                   //System.out.println("got connection");
                   Statement s = con.createStatement();
                   String sql = "select userName from Users where userName='"+userName+"and password='"+password+"';";
                   ResultSet rs = s.executeQuery(sql);
                   if(rs.next()){
                        rs.close();
                        s.close();
                        con.close();
                        return true;
                   rs.close();
                   s.close();
                   con.close();
              catch(ClassNotFoundException e){
                   System.out.println(e.toString());
              catch(SQLException e){
                   System.out.println(e.toString());
              catch(Exception e){
                   System.out.println(e.toString());
              return false;
    }so ...
    here i'm trying to connect to Users mysql database (i use Tomcat 4.1 and mysql servers and clients 4.0.1-alpha)
    where is the problem ? when i run this servlet (http://localhost:8080/example/servlet/LoginServletJDBC ) it works ;
    BUT when i type an username and a password (any user&pass) my servlet doesn't connect to the database (become a infinite loop without output ; i mean no any errors and exceptions)
    i try other think : i changed the database with unexisting database and the result was that i was expected (Unknow database 'unexistingdatabase' )
    what i miss ?
    please... can anyone help me...
    thank`s in advance

    The wireless security setting that the Actiontec modem/router is using may be different...and not compatible....than the setting that the Comcast product was using.
    If you think that might the case, and you have the time to troubleshoot......
    Temporarily, turn off the wireless security on the Actiontec modem/router
    Reset an AirPort Express back to default settings, then see if it will connect using no security and allow an Internet connection when you do the Ethernet port test in the post above again.
    If the AirPort Express cannot connect correctly using no security on the wireless network.....then it is a no brainer to know that it will never connect when security is enabled.  So, if the AirPort will not connect using no security, you may have an incompatibility issue between the Actiontec and Apple products.
    However, if the AirPort Express connects OK with no security, then this tells you that you will need to use a different setting for security on the Actiontec...the same that the Comcast router was using before.....so the Express will have a better chance of connecting.
    That setting would be something like WPA/WPA2 Personal, or the same setting stated another way would be WPA-PSK-TKIP.

  • Problem with inserting data into mySQL database with jsp

    I have a jsp page that collects infromation about a users vehicle and puts the data into a mySQL database. Iv'e been messing around with it for ages & i can't seem to get it to work even though i cannot see anything wrong with the code, which can be seen below.
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ include file="Connections/connection.jsp" %>
    <%
    // *** Restrict Access To Page: Grant or deny access to this page
    String MM_authorizedUsers="";
    String MM_authFailedURL="login_form.jsp";
    boolean MM_grantAccess=false;
    if (session.getValue("MM_Username") != null && !session.getValue("MM_Username").equals("")) {
      if (true || (session.getValue("MM_UserAuthorization")=="") ||
              (MM_authorizedUsers.indexOf((String)session.getValue("MM_UserAuthorization")) >=0)) {
        MM_grantAccess = true;
    if (!MM_grantAccess) {
      String MM_qsChar = "?";
      if (MM_authFailedURL.indexOf("?") >= 0) MM_qsChar = "&";
      String MM_referrer = request.getRequestURI();
      if (request.getQueryString() != null) MM_referrer = MM_referrer + "?" + request.getQueryString();
      MM_authFailedURL = MM_authFailedURL + MM_qsChar + "accessdenied=" + java.net.URLEncoder.encode(MM_referrer);
      response.sendRedirect(response.encodeRedirectURL(MM_authFailedURL));
      return;
    String vehicle_details__registration = null;
    if(request.getParameter("txt_registration") != null){ vehicle_details__registration = (String)request.getParameter("txt_registration");}
    String vehicle_details__make = null;
    if(request.getParameter("txt_make") != null){ vehicle_details__make = (String)request.getParameter("txt_make");}
    String vehicle_details__model = null;
    if(request.getParameter("txt_model") != null){ vehicle_details__model = (String)request.getParameter("txt_model");}
    String vehicle_details__colour = null;
    if(request.getParameter("txt_colour") != null){ vehicle_details__colour = (String)request.getParameter("txt_colour");}
    String vehicle_details__tax_class = null;
    if(request.getParameter("select_tax_class") != null){ vehicle_details__tax_class = (String)request.getParameter("select_tax_class");}
    String vehicle_details__chasis_num = null;
    if(request.getParameter("chasis_num") != null){ vehicle_details__chasis_num = (String)request.getParameter("chasis_num");}
    String vehicle_details__status = null;
    if(request.getParameter("radio_status") != null){ vehicle_details__status = (String)request.getParameter("radio_status");}
    String owner_details__MMColParam = "1";
    if (session.getValue("MM_Username") !=null) {owner_details__MMColParam = (String)session.getValue("MM_Username");}
    Driver Drivervehicle_details = (Driver)Class.forName(MM_connection_DRIVER).newInstance();
    Connection Connvehicle_details = DriverManager.getConnection(MM_connection_STRING,MM_connection_USERNAME,MM_connection_PASSWORD);
    PreparedStatement vehicle_details = Connvehicle_details.prepareStatement("INSERT INTO vehicle_man_db.vehicle_details (registartion, make, model, colour, tax_class, chasis_num) VALUES ('"+ String vehicle_details__registration + "', '"+ String vehicle_details__make + "', '"+ String vehicle_details__model + "', '"+ String vehicle_details__colour + "', '"+ String vehicle_details__tax_class + "', '"+ String vehicle_details__chasis_num + "', '"+ String vehicle_details__status + "')");
    vehicle_details.executeUpdate();
    %>
    <form name="add_vehicle_form" id="add_vehicle_form">
      <p>Registration mark:
        <input name="txt_registration" type="text" id="txt_registration">
    </p>
      <p>Make:
        <input name="txt_make" type="text" id="txt_make">
    </p>
      <p>Model:
        <input name="txt_model" type="text" id="txt_model">
    </p>
      <p>Colour:
        <input name="txt_colour" type="text" id="txt_colour">
      </p>
      <p>Tax Class:
        <select name="select_tax_class" id="select_tax_class">
          <option value="AAA">Band AAA (up to 100g/km)</option>
          <option value="AA">Band AA (101 - 120g/km)</option>
          <option value="A">Band A (121 - 150g/km)</option>
          <option value="B">Band B (151 - 165g/km)</option>
          <option value="C">Band C (166 - 185g/km)</option>
          <option value="D">Band D (Over 185g/km)</option>
        </select>
      </p>
      <p>Chasis Number:
        <input name="txt_chassis_num" type="text" id="txt_chassis_num">
    </p>
      <p>Status: active:
        <input name="radio_status" type="radio" value="1" checked>
        off-road
        <input name="radio_status" type="radio" value="0">
      </p>
      <p>
        <input type="submit" name="Submit" value="Submit">
    </p>
    </form>
    <%
    Connvehicle_details.close();
    %>This is the error I am getting from the server
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 3 in the jsp file: /add_vehicle_form.jsp
    Generated servlet error:
    C:\Servers\Tomcat 5.0\work\Catalina\localhost\Assignment\org\apache\jsp\add_005fvehicle_005fform_jsp.java:113: ')' expected
    PreparedStatement vehicle_details = Connvehicle_details.prepareStatement("INSERT INTO vehicle_man_db.vehicle_details (registartion, make, model, colour, tax_class, chasis_num) VALUES ('"+ String vehicle_details__registration + "', '"+ String vehicle_details__make + "', '"+ String vehicle_details__model + "', '"+ String vehicle_details__colour + "', '"+ String vehicle_details__tax_class + "', '"+ String vehicle_details__chasis_num + "', '"+ String vehicle_details__status + "')");
    ^
    1 error
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
         org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Any help would be much appreciated.
    Thanks

    use this ...
    PreparedStatement vehicle_details =
    Connvehicle_details.prepareStatement("INSERT INTO
    vehicle_man_db.vehicle_details (registartion, make,
    model, colour, tax_class, chasis_num) VALUES
    vehicle_details .setString(1,String
    vehicle_details__registration );
    vehicle_details setString(2,String
    vehicle_details__make );
    vehicle_details .setString(3,String
    vehicle_details__model );
    vehicle_details .setString(4,vehicle_details__colour
    vehicle_details .setString(5,String
    vehicle_details__tax_class);
    vehicle_details .setString(6,String
    vehicle_details__chasis_num );
    vehicle_details .executeQuery();Even you need a screwing up... what's the point putting that String inside. That's the bloody error.

Maybe you are looking for

  • Error while trying to run a compiled program

    Hi guys, I am new here and so is my experience in Java. I am taking Computer Science major in college right now. I have a problem trying to run a program that has compiled. I always receive an error message like this: C:\>javac A:\Grade.java C:\>java

  • Unable to configure webstack - SXDE - failed adding connection to postgreSQ

    Noob here. Firstly, feel free to redirect if this is the wrong forum. I just installed the current release of SXDE on VMware server. I am now trying to configure the webstack, as per the Getting Started guide (as per file:///opt/webstack/doc/html/p3.

  • Second display causing perpetual restarting

    For the last two years I have used my Mac Pro 2.8 Quad with two displays without any problems. A few weeks ago I had two blank screen after a restart which was only resolved after removing the second display. I changed the second display for a differ

  • Drill down in Cross tabs

    Is there any possibility to drill down in Crosstabs

  • Sitewide constants / variables

    Can I somehow define constants like SiteName = "Company XYZ" and then put in page titles expressions like SiteName + " - Welcome" - or - SiteName + " - Pricelist" etc? It seems strange to me that such a mighty tool like Dreamweaver would force design