Help with mysql URGENT!!

i get the error....
warning: supplied argument is not a valid MySQL result resource in /var/www/html/php/db1.php on line 18
line 18 being....
while ($row = mysql_fetch_row($resultID)
code for printing data is here
none of my data prints
PLEASE HELP ME, THANKS IN ADVANCE FOR YOUR HELP.
htnaks,
ELVIS

are you sure this is your code?
while ($row = mysql_fetch_row($resultID)
code for printing data is here
It misses a right ) at the first line.
PC

Similar Messages

  • Help with mySQL Connection string

    Here is hoping someone can help & once I get it down I promise I'll post all my work on this list so some other newbie can benefit.
    I'm simply trying to run a very very straightforward JDBC test with mySQL & I keep getting the "Server configuration denies access to data source" error. But before you tell me that I must simply look at what my mysql.db & mysql.user table allows - I'VE TRIED THAT. I realize that the error is probably there somewhere - but I can't see it.
    I've tried connecting with 2 different accounts - the provided "root" & a user I created "deep" to 2 different databases the provided "test" & "testdb" which I created) . Here is what mysql says about the two different databases
    mysql> select * from db;
    Host  | Db         | User |.......
    -----+------------+-------
    | %         | test    |       | ......
    | %         | test\_% |     | ........
    | localhost | testdb  | deep |........Note that "root" should have access to "test" & deep@localhost should have access to "testdb" right?
    So here are all the connection strings I have tried - all return the same error below
            Connection conn = DriverManager.getConnection(
                "jdbc:mysql://localhost:3306/test", "root", "mypass"
    //            "jdbc:mysql://localhost:3306/testdb", "deep", "mypass"
    //            "jdbc:mysql://localhost/testdb?user=deep&password=mypass"
    //            "jdbc:mysql://localhost/testdb", "deep", "mypass"
    //            "jdbc:mysql://localhost:3306/testdb?user=deep@localhost&password=mypass"
    //            "jdbc:mysql://localhost:3306/testdb?user=deep&password=mypass"
    //            "jdbc:mysql://localhost/testdb", "deep@localhost", "mypass"
    //            "jdbc:mysql:///test", "root", "mypass"
    //            "jdbc:mysql://localhost/test", "root@localhost", "mypass"
    );My Error:
    Exception in thread "main" java.sql.SQLException: Server configuration denies access to data source
            at org.gjt.mm.mysql.MysqlIO.init(MysqlIO.java:193)
            at org.gjt.mm.mysql.Connection.connectionInit(Connection.java:261)
            at org.gjt.mm.mysql.jdbc2.Connection.connectionInit(Connection.java:89)
            at org.gjt.mm.mysql.Driver.connect(Driver.java:167)
            at java.sql.DriverManager.getConnection(DriverManager.java:517)
            at java.sql.DriverManager.getConnection(DriverManager.java:199)
            at TestMySQL4.main(TestMySQL4.java:76)BTW:
    I am using MacOSX 10.1
    MySQL 3.23.42
    The driver is: mm.mysql-2.0.6.jar
    Please help!
    'deep

    hi amandeep
    well i m getting the same error message when trying to connect MYSQL using mm.jdbc driver.
    java.sql.SQLException : Server configuration denies access to data base source.
    query.jdbcDriver org.gjt.mm.mysql.Driver
    query.databaseURL jdbc:mysql://aaa.bbb.com/pluto
    query.databaseUserName samin
    query.databasePwd samin
    query.summaries true
    i hve installed mysql on server aaa.bbb.com network 1
    and trying to run application on network 2
    Thanks
    samir

  • Need help with MySQL connection error _mmServerScripts

    Trying to create insert a recordset I got the message:
    "The files from the _mmServerScripts folder are for the server model PHP-MySQL. You try to connect to a database using a different server model .Please remove this folder outside the Dreamweaver environment on both local and testing machines and try again."
    I've searched the net and have seen this message hunting people since dw8...
    I could not find a "cure".
    Things to notice:
    0 - Yes the whole thing is apache/php/mysql... just DW thinks it's not.
    1 - Both the connection and the Recordset actualy works. I have a whole site based on this connection and the recorsets I've created manualy based on it.
    2 - It does not matter if we erase or not the _mmServerScripts folder the message stands still allover.
    3 - The problem seems to show up when you split servers...
    3.1 - If I test in a WAMP environment where apache and mysql are in the same machine I can use DW to create data objects for me.
    3.2 - If I test in my real test environment which have web server and db server separated from each other then I can't use DW to create data objects, see bindings, behaviours etc... all I get is this message.... while the code itself runs fine anyway.
    Does any one already knows how to work around or fix this?
    Thanks,
    Julio

    Thanks PZ,
    Yes everything is fine with the site definition.
    everything works. I can upload, run, test all ok.
    The only thing that does not work is to insert any sort of data object through DW interface. If I declare my reordsets by hands or even If I use the ones DW created in my local test server all works fine.
    Then if I use the site definition and try to see any bindings or create a recordset or create a new connection using dw... then the messages come up and dw can't go any further in that task.
    By spli servers I mean one phisical linux server with apache/php but without mySQL + one physical Linux server with mySQL but without apache/php.
    So when I use a site definition that points either to a WAMP or LAMP i.e. when everything is in the same machine DW goes happy and does whatever it's asked to do.
    When I try that on the real mccoy environment (with the two separated servers)... It looks like DW gets confused...

  • Need Help with mysql admin for Mac

    Hello all.
    I am new to cold fusion and databases all together. Infact I
    am doing an online tutorial to get me started, my problem is the
    tutorial really just scratches the surface for the mac side and in
    some cases sorta explains how to do but no visual help and I am
    very visual.
    I am searching for software that is really idiot proof to
    start my knowledge with then make the transition when I learn more
    and more to hard coding. The tutorial suggests Navicat for Mysql
    admin and it is nice but he is setting up basic databases in Access
    which looks really easy and I am trying to follow along with
    navicat but I am just not getting it specifically when it comes to
    setting up relationships between tables. Can I use a software like
    FileMaker Pro and just convert to mysql or is their other software
    that makes it a little more easy to understand how to set up
    relationships like access does.
    I am totally new to this stuff and I am looking for the
    easiest product to use. Thanks again for your help and time.
    Chris

    As for the database part, before you write your first query,
    you should become grounded in the concepts of data modeling. Then
    find a good source (book, books-on-line, etc. ) for the particular
    "flavor" of SQL used by your database of choice, then start writing
    your queries. Data model first (entities, relationships,
    attributes), then SQL.
    Couple of fairly good online tutorials for data modeling.
    Introduction
    to Data Modeling and
    Data Model
    Reference
    Master this and you will save yourself many hours of grief,
    trust me.
    Phil

  • Help with MySQL/PHP Connection

    Hi,
    I'm making a site that requires the storage of information via MySQL.  I've set up my testing server, and it connects fine.  When I try to add a MySQL connection, however, I keep getting the "HTTP Error Code 404: File Not Found" error.  I've tried using both the MySQL server provided by my web host and one hosted on my own computer (using "localhost" as the server), but both give me the same error.  The error box says that perhaps:
    1) There is no testing server running on the server machine.
    2) The testing server specified for this site does not map to the http://**mywebsite**.com/_mmServerScripts/MMHTTPDB.php URL.  Verify that the URL Prefix maps to the root of the site.
    I'm certain it's not #1, because both of my MySQL servers work fine outside of Dreamweaver.  But I'm not quite sure what #2 is saying.  Any help?
    Thanks in advance.

    nickf77 wrote:
    I have my testing server set up at my FTP account that came with my hosting package.  Should it not be?
    It's not ideal, but you can do it that way. The principle is still the same.
    When using a remote connection, the value of Host directory is the same as you use for FTP connections to your remote site. In many cases, this is left blank, is simply a forward slash, or is something like public_html. In any event, it's the root level of your website.
    URL prefix is also the root level of your site, but expressed as a URL: http://www.example.com/.
    Host directory and URL prefix must both point to the same place. The first is a path, the second is a web address.

  • New Bie help with MySQL & servlet

    Hi,
    I am trying to execute a small action... some how my code does not work. All it shows is a blank page with no error....
    Can any one help me to optimize this code so that it works?
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package oneword;
    import com.mysql.jdbc.Connection;
    import com.mysql.jdbc.Statement;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.util.Random;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class Register extends HttpServlet {
        private String name = null;
        private String emailID = null;
        private String nameDB = "jdbc:mysql://localhost:3306/register";
        private String mysqlUser = "root";
        private String mysqlPassword = "abc";
        private String mySqlJdbcDriver = "com.mysql.jdbc.Driver";
        private Connection conn = null;
         * Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException, ClassNotFoundException, SQLException {
            response.setContentType("text/html;charset=UTF-8");
            PrintWriter out = response.getWriter();
            name = request.getParameter("_name");
            emailID = request.getParameter("_email");
            try {
                Random generator = new Random();
                int activationPassword = generator.nextInt(100000);
                Class.forName(mySqlJdbcDriver);
                conn = (Connection) DriverManager.getConnection(nameDB,mysqlUser,mysqlPassword);
                Statement statement = (Statement) conn.createStatement();
                String sqlCommand = "INSERT INTO userdata(name, email, validation, " +
                        "banned, activatepassword, password)values("+name+", "+emailID+", 0, 0,"+activationPassword+", 'ddd')";
                statement.executeQuery(sqlCommand);
                out.println(name);
                out.println("<br>"+emailID);
                out.println("rows affected:");
                conn.close();
            } catch (SQLException ex) {
            // handle any errors
            System.out.println("SQLException: " + ex.getMessage());
            System.out.println("SQLState: " + ex.getSQLState());
            System.out.println("VendorError: " + ex.getErrorCode());
            } finally {
                out.close();
        // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
         * Handles the HTTP <code>GET</code> method.
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
        @Override
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            try {
                processRequest(request, response);
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);
         * Handles the HTTP <code>POST</code> method.
         * @param request servlet request
         * @param response servlet response
         * @throws ServletException if a servlet-specific error occurs
         * @throws IOException if an I/O error occurs
        @Override
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            try {
                processRequest(request, response);
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(Register.class.getName()).log(Level.SEVERE, null, ex);
    }Thank you

    A blank page usually indicate that an exception is been thrown but cannot be displayed because the response is already started/committed/processed. Just read the appserver's logs as usual for the details.
    Your servlet class does way too much. You're mingling all the processing steps together in one class. This is simply asking for trouble. Use a DAO class for accessing the DB. Use a JSP file for presentation. Use a business object to process the input/output data. Use a servlet for controlling the request. To start off, you may get some ideas out of this article and the JSP/Servlet follow-up: [http://balusc.blogspot.com/2008/07/dao-tutorial-data-layer.html].
    Oh, your JDBC code is not safe against SQL injection attacks either.

  • HELP with mySQL!!

    Im trying to connect to Mysql using MySQL Connector/J , but always found this error message when executing it
    "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver".
    i have the JAR file in C:\JDBC and C:\jdk1.5.0\jre\lib\!
    i set my CLASSPATH like below
    C:\jdk1.5.0\jre\lib\mysql-connector-java-bin.jar;c:\jdk1.5.0\lib\tools.jar;c:\jdk1.5.0\lib\dt.jar;C:\Program Files\Apache Software Foundation\Tomcat 5.5\classes;C:\Program Files\Apache Software Foundation\Tomcat 5.5\lib;C:\JDBC;
    codes are below
    import java.sql.*;
    public class main {
    /** Creates a new instance of main */
    static final String JDBC_DRIVER = "com.mysql.jdbc.Driver";
    public static void main(String[] args) {
    try {
    Class.forName(JDBC_DRIVER).newInstance();
    System.out.println("Driver loaded");
    } catch (Exception ex) {
    System.out.println(ex.toString());
    HELP PLEASE!!!!!!!

    Look at some of these I got from the search - I am sure you will determine the problem.
    http://search.sun.com/search/developers/index.jsp?and=%22java.lang.ClassNotFoundException%3A+com.mysql.jdbc.Driver&nh=10&phr=&qt=&not=&field=&since=&col=devforums&rf=0&Search.x=15&Search.y=8
    It looks like a classpath problem.

  • Please help with an urgent purchase issue

    Hello all
    I have finally decided that since I am planning a trip to US it would be a wonderful opportunity to purchase a Mac and fulfill my dream!
    Despite the fact that I was thinking of purchasing an iMac for a desktop computer (my office laptop is a windows 8) I ended up in selecting a MacBook Pro 15 retina as a desktop replacement combining increased portability and enhanced specifications. The use is strictly personal meaning transferring and listening to music, home movies editing, watching movies, Internet and generally transferring all my home staff to apple ecosystem using also external drives.
    Now the serious staff: since  I have a one time opportunity ( the trip is not repetitive) I would extremely appreciate your help in the following:
    - my current selection is with 2,7 ghz quad core i7 with 8  gb ram and 512 flash. How is this configuration compared to the basic one? Basically I chose the 2.7 because of the relatively small price difference and the increased hard drives because of future programs installations (all storage will be done in time capsule and external drives)
    - since I have to purchase it now when Mavericks are released will the update require payment (based on your experience from the past)
    - how do the above compare to the new MacBook Air (if it is worthwhile I would go to an enhanced version of the 13")
    My true apologies for the length of my message but any help is invaluable to solve my confusion
    Many thanks in advance. 

    - my current selection is with 2,7 ghz quad core i7 with 8  gb ram and 512 flash. How is this configuration compared to the basic one? Basically I chose the 2.7 because of the relatively small price difference and the increased hard drives because of future programs installations (all storage will be done in time capsule and external drives)
    - since I have to purchase it now when Mavericks are released will the update require payment (based on your experience from the past)
    - how do the above compare to the new MacBook Air (if it is worthwhile I would go to an enhanced version of the 13")
    My true apologies for the length of my message but any help is invaluable to solve my confusion
    Many thanks in advance. 
    We do not know yet what Mavericks will cost or what machines Apple will update for free but based on past experience it will probably not be a free update unless you purchase the computer after Mavericks has been released to the public. As recent operating system upgrades have been relatively inexpensive - Mountain Lion was $20 - I wouldn't worry a lot about this.
    I agree with your choice of the 512GB SSD. The bigger the better as application files and data are only going to get larger. The faster processor may not make enough difference for your intended uses to make it worth the extra money however.
    The retina display on the MacBook Pro is quite a bit better than the MacBook Air.
    Best of luck.

  • Help with an urgent application please

    algier please recommend me I need a web application that meets the characteristics of a forum system and database must be Oracle 10g or 11g
    I hope I'll be able to help many grasias pendiende and those who can help me

    We do not use urgent applications.

  • Need some help with threads, urgent!!

    Hi I am really new to threads and I cannot figure out why the code below will not work. After my thread goes into a wait, it never wakes up. Can someone please help me? When stepping through the code, I get an invalid stack frame message as well. Thanks in Advance!!!
    Colin
    import java.io.*;
    import java.util.*;
    public class XMLInputCompression extends InputStream implements Runnable
    private InputStream in;
    private ByteArrayOutputStream baos = new ByteArrayOutputStream();
    private boolean closed = false;
    private boolean foundDTD = false;
    private Vector elementsList = new Vector();
    private Vector attributesList = new Vector();
    private BufferedReader br = null;
    private StringTokenizer st = null;
    final static int BUFF_SIZE = 500;
    final static String HEADER = "<?xml version=\"1.0\"?><!DOCTYPE Form SYSTEM ";
    final static char CLOSE_ELEMENT = '>';
    final static String END_ELEMENT = ">";
    final static char START_ELEMENT = '<';
    final static char START_ATTRIBUTE = '[';
    final static String ATTLIST = "<!ATTLIST";
    final String XMLTAG ="<?xml";
    final String ELEMENTTAG = "<!ELEMENT";
    public static void main(String[] args)
         try
    FileInputStream fis = new FileInputStream("c:/Dump.txt");
    XMLInputCompression compress = new XMLInputCompression(fis);
    int r = 0;
    while(r != -1)
    byte b[] = new byte[200];
    r = compress.read(b);
    System.out.println("r is: " + r);
    if( r == -1)
    compress.close();
    }catch(Exception e)
    e.printStackTrace();
    } // end main
    public XMLInputCompression(InputStream is) throws IOException
    this.in = is;
    baos.write(HEADER.getBytes());
    new Thread(this).start();
    public void run()
    try
    Vector elementNames = new Vector();
    //Vector attributeNames = new Vector();
    StringBuffer sb = new StringBuffer(BUFF_SIZE);
    char c = (char)in.read();
    switch (c)
    case START_ELEMENT:
    if (!foundDTD)
    wakeUp(sb.toString().getBytes());
    //populate the elements and atrributes vectors
    FileInputStream fis = new FileInputStream("C:/form.dtd");
    processDTDElements(fis);
    foundDTD = true;
    sb.setLength(0);
    else
    sb.append("<");
    String element = (String)elementsList.get((int)in.read());
    elementNames.addElement(element);
    sb.append(element);
    wakeUp(sb.toString().getBytes());
    //baos.write(sb.toString().getBytes());
    sb.setLength(0);
    break;
    case START_ATTRIBUTE:
    sb.append("[");
    sb.append(attributesList.get((int)in.read()));
    wakeUp(sb.toString().getBytes());
    //baos.write(sb.toString().getBytes());
    sb.setLength(0);
    break;
    case CLOSE_ELEMENT:
    wakeUp(sb.toString().getBytes());
    //baos.write(sb.toString().getBytes());
    sb.setLength(0);
    sb.append(elementNames.get(0));
    elementNames.remove(0);
    sb.append(">");
    break;
    default:
    sb.append(c);
    synchronized (baos)
    baos.notify();
    System.out.println(" in run method*****");
    }catch(Exception e)
    e.printStackTrace();
    } // end run
    private void wakeUp(byte b[])
    System.out.println(" in wakeup method*****");
    synchronized (baos)
    try
    baos.write(b);
    catch(Exception e)
    System.out.println("exception caught");
    e.printStackTrace();
    baos.notify();
    public boolean markSupported()
    return false;
    public int read(byte[] b1, int off, int len) throws IOException
    return readData(b1, off, len);
    public int read() throws IOException
    return readData(null, 0, 1);
    public int read(byte[] b1) throws IOException
    return readData(b1, 0, b1.length);
    private int readData(byte[] b1, int off, int len) throws IOException
    String s = null;
    while(true)
    if (closed && baos.size() == 0)
    return -1;
    int size = baos.size();
    if (baos.size() > 0) // Have at least one byte
    if( b1 == null)
    byte b[] = baos.toByteArray();
    baos.reset();
    baos.write(b, 1, b.length-1); // baos contains all data except b[0]
    return b[0];
    else
    int minLen = Math.min(baos.size(), len);
    //System.out.println(" baos contents are: " + baos.toString());
    byte b[] = baos.toByteArray();
    s = b.toString();
    int length = baos.size() - minLen;
    baos.reset();
    baos.write(b, 0, length );
    System.arraycopy(b, 0, b1, off, minLen);
    return minLen;
    try
    synchronized (baos)
    if (!closed)
    baos.wait();
    catch(java.lang.InterruptedException ie)
    ie.printStackTrace();
    }// end read data
    private boolean hasMoreTokens()
    String s = null;
    try
    if (br != null)
    if (st == null || !st.hasMoreTokens())
    // read in a line, create a st
    s = br.readLine();
    st = new StringTokenizer(s,"\n\r\t ");
    }catch(Exception e)
    e.printStackTrace();
    return st.hasMoreTokens();
    private String nextToken() throws Exception
    String token = null;
    if(st.hasMoreTokens())
    token = st.nextToken();
    }else
    String s = br.readLine();
    st = new StringTokenizer(s,"\n\r\t ");
    token = st.nextToken();
    return token;
    private void processDTDElements(FileInputStream is)
    try
         // get the file desriptor from the input Stream
         FileDescriptor fd = is.getFD();
         // create a new buffered reader
    br = new BufferedReader(new FileReader(fd));
    boolean lookForEndTag=false;
    boolean lookForEndAtt=false;
    while (hasMoreTokens())
    String token = nextToken();
    if (lookForEndTag)
    if (!token.endsWith(END_ELEMENT))
    continue;
    }else
    lookForEndTag = false;
    continue;
    if (token.startsWith(XMLTAG))
    lookForEndTag = true;
    else if (token.startsWith(ELEMENTTAG))
    token = nextToken();
    if ( elementsList.indexOf(token)<0)
    elementsList.addElement(token);
    lookForEndTag = true;
    else if (token.startsWith(ATTLIST))
    String dummy = nextToken(); // discard element name
    do
    token = nextToken();
    if (token.endsWith(">"))
    break;
    if (attributesList.indexOf(token)<0 )
    attributesList.addElement(token);
    token = nextToken();
    if ( token.startsWith("CDATA") || token.startsWith("ID") )
    token = nextToken();
    if (token.equals("#FIXED "))
    token = nextToken();
    lookForEndAtt = token.endsWith(END_ELEMENT);
    else if ( token.startsWith("(") )
    do
    token = nextToken();
    }while ( token.indexOf (")") == -1);
    token = nextToken();
    lookForEndAtt = token.endsWith(END_ELEMENT);
    } while (!lookForEndAtt);
    }//end if
    }//end while
    }catch(Exception e)
    e.printStackTrace();
    }finally
    try
    br.close();
    }catch(Exception e)
    e.printStackTrace();
    }// end process elements
    public void close() throws IOException
    closed = true;
    synchronized(baos)
    baos.notify();
    }// end XMLinputCompression class

    Your problem probably has something to do with where you tell baos (or rather, the thread that it is in) to wait. You have:synchronized (baos)
        if (!closed)
            baos.wait();
    }Which acquires a lock on baos, then tells its own thread to wait without ever relinquishing its lock on baos. So when your main method calls the read method, it hangs immediately when it tries to access baos because it is still locked. So what you're seeing is a basic deadlock condition.
    Really, you're not gaining anything with your multithreading in this case. But that's a different issue.

  • Help with mysql query plz anyone i am begging!!!

    Hi everyone pls forgive me i am new to java. can someone pls tel me where i am going wrong wit this mysql query?
    <sql:query var="parish" maxRows="1" dataSource="jdbc/gav">
    SELECT ParishName, OwnerOccupierHousehold, OwnerOccupierPercOfOverall, OwnerOccupierCo2Emissions,
    SocialRentedHousehold, SocialRentedPercOfOverall, SocialRentedCo2Emissions, PrivateRentedHousehold,
    PrivateRentedPercOfOverall, PrivateRentedCo2Emission, TotalHouseholds, TotalPerc, Average,
    Total2001, TotalEstimatedTotal2006, EmissionsPerPerson, EmissionPerHousehold, EmissionsPerParish,
    EnergyChampionsNeeded, NumberOfPeopleAtWork, NumberOfSchoolAgeChildren
    FROM base_data as b
    WHERE b.id = ? <sql:param value="${param.id}"/>
    <sql:param value="${param.id}"/>
    </sql:query>
    <c:set var="parish" scope="request" value="${parish.rows[0]}"/>
    here is the error i get:
    java.sql.SQLException: Parameter index out of range (2 > number of parameters, which is 1).
    please any help would be appreciated!!! Thanks in advance guys .

    here is my code for the form on the index page:
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
    <sql:query var="parish" dataSource="jdbc/gav">
    SELECT id, ParishName FROM base_data
    </sql:query>
    <form action="response.jsp">
    Select a Parish: <select name="id">
    <c:forEach var="parish" items="${parish.rows}">
    <option value="${parish.id}">${parish.ParishName}</option>
    </c:forEach>
    </select><br><input type="submit" value="submit" name="submit" /></form>
    here is the code for the response page:
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%>
    <sql:query var="parish" maxRows="1" dataSource="jdbc/gav">
    SELECT b.id, b.ParishName, b.OwnerOccupierHousehold, b.OwnerOccupierPercOfOverall, b.OwnerOccupierCo2Emissions,
    b.SocialRentedHousehold, b.SocialRentedPercOfOverall, b.SocialRentedCo2Emissions, b.PrivateRentedHousehold,
    b.PrivateRentedPercOfOverall, b.PrivateRentedCo2Emission, b.TotalHouseholds, b.TotalPerc, b.Average,
    b.Total2001, b.TotalEstimatedTotal2006, b.EmissionsPerPerson, b.EmissionPerHousehold, b.EmissionsPerParish,
    b.EnergyChampionsNeeded, b.NumberOfPeopleAtWork, b.NumberOfSchoolAgeChildren
    FROM base_data as b
    WHERE b.id = ? <sql:param value="${param.id}"/>
    </sql:query>
    <c:set var="parish" scope="request" value="${parish.rows[0]}"/>
    i display the results like this : ${parish.EmissionsPerParish}
    the user should be able to select a parish from a form and then sql query created and then i want to show the row results on the response page.
    could you tell me where so should be a simple process although not simple enough as it may seem.
    thanks for the advice keith

  • Help with mysql class (Japplet)

    Hi,I have found program that exactly what i want in Japplet ,but its not clean i wana use it on my other classes . Here is what i tired from changing .After all,i am not professionnel in java.
    The ORGINAL HERE :
      http://forum.java.sun.com/thread.jsp?forum=4&thread=197844
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.net.URL;
    import java.sql.*;
    import java.util.*;
    import java.util.Properties;
    import java.net.URL;
    import java.sql.*;
    public class Sql extends JApplet
        public String  tfDrv = null, tfSQL = null;
        //public String dbUser,dbPass;
        Connection conn = null;
        private Statement stmt =null;
        /*public Sql() {
        public void init() {
        private void initialize( String dbUser,String dbPass,String tfDrv ) {
                initDB("jdbc:mysql://localhost/mysql",dbUser,dbPass,tfDrv);
        private void initDB(String connect,String user,String pass,String tfDrv) {
        try {
            String url = connect;
            this.tfDrv=tfDrv;
            Class.forName("org.gjt.mm.mysql.Driver");
            conn = DriverManager.getConnection( url, user, pass );//should get name, pwd
        } catch( Exception e ) {
            e.printStackTrace();
        public ResultSet executeSQL( String sql )  throws Exception {
        System.out.println( "DS exSQL " + sql );
        int irs = 0;
        ResultSet rs = null;
        try {
            stmt = conn.createStatement();
            boolean bo = stmt.execute("use "+ this.tfDrv);
            if( sql.startsWith( "select" ) ) {
            rs = stmt.executeQuery( sql );
            System.out.println( "xq rs: " + rs );
            else if( sql.startsWith( "delete" ) ||
                 sql.startsWith( "insert" ) ) {
            irs = stmt.executeUpdate( sql );
            else if( sql.startsWith( "update" ) ) {
            irs = stmt.executeUpdate( sql );
        catch( Exception e ) {
            System.out.println(e.getMessage());
            e.printStackTrace();
            throw e;
        return rs;
        private DefaultTableModel doSQL( String sql ) {
        DefaultTableModel m = new DefaultTableModel();
        java.util.Vector data = new java.util.Vector();
        java.util.Vector headers = new java.util.Vector();
        try {
            String s = "";
            ResultSet rs = executeSQL( sql );
            System.out.println( "rs " + rs );
            ResultSetMetaData rsmd = rs.getMetaData();
            ////List datas  = new LinkedList();   
            ////datas = new ArrayList();
            for( int c = 1, cc = rsmd.getColumnCount(); c <= cc; c++ ) {
            headers.addElement( rsmd.getColumnName( c ) );
            java.util.Vector datum = null;
            while( rs.next() )
                datum = new java.util.Vector();
                for( int c = 1, cc = rsmd.getColumnCount(); c <= cc; c++ ) {
                s = rs.getString( c );
                datum.addElement( s );
                data.addElement( datum );
        } catch( Exception e ) {
            e.printStackTrace();
        m.setDataVector( data, headers );
        System.out.println( "d: " + data );
        return m;
        public static void main( String[] args )   throws Exception{
        Sql rb = new Sql();
        ResultSet rs;
        rb.initialize( "root","root","test" );
         //rb.doSQL("DELETE FROM `oop` WHERE `oop`.`java` = 2");
        rs = rb.executeSQL("DELETE FROM `oop` WHERE `oop`.`java` = 2");
        System.out.println(rs.getString("1"));
    }

    Ok Sorry
    This the same program after edditing and its works great
    but the problem i don't want GUI I want to use it in other classes to connect to mysql database .So please Help.
      http://forum.java.sun.com/thread.jsp?forum=4&thread=197844
            permission java.lang.RuntimePermission "accessClassInPackage.sun.jdbc.odbc";
         permission java.util.PropertyPermission "file.encoding", "read";
            permission java.net.SocketPermission "*:*", "connect,listen,resolve,accept";
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.net.URL;
    import java.sql.*;
    import java.util.*;
    import java.util.Properties;
    import java.net.URL;
    import java.sql.*;
    public class yesSql extends JApplet
        private JTextField tfDrv = null, tfSQL = null;
        Connection conn = null;
        private Statement stmt =null;
        public yesSql() {
        public void init() {
         initialize( (JPanel) getContentPane() );
        private void initialize( JPanel p ) {
         p.setLayout( new BorderLayout() );
         JLabel lDrv = new JLabel( "DB Name: " );
         tfDrv = new JTextField( 25 );
         tfDrv.setText( "mysql" );
         JPanel pp = new JPanel();
         pp.setLayout( new GridLayout( 6, 2 ) );
         pp.add( lDrv );
         pp.add( tfDrv );
         JLabel lSQL = new JLabel( "SQL" );
         tfSQL = new JTextField( 25 );
         tfSQL.setText( "select * from " );
         pp.add( lSQL );
         pp.add( tfSQL );
         JButton b = new JButton( "Submit" );
         b.addActionListener( new ActionListener() {
              public void actionPerformed( ActionEvent ev ) {
                 initDB("jdbc:mysql://localhost/mysql","root","root");
                  initTable( (JPanel) getContentPane() );
         pp.add( b );
         p.add( "North", pp );
        private void initDB(String connect,String user,String pass) {
         try {
             String url = connect;
             String drv = tfDrv.getText();
    //         DriverManager.registerDriver( new sun.jdbc.odbc.JdbcOdbcDriver() );
            Class.forName("org.gjt.mm.mysql.Driver");
             conn = DriverManager.getConnection( url, user, pass );//should get name, pwd
             System.out.println( "d: " + drv + ", u: " + url );
         } catch( Exception e ) {
             e.printStackTrace();
        public ResultSet executeSQL( String sql ) throws Exception {
         System.out.println( "DS exSQL " + sql );
         int irs = 0;
         ResultSet rs = null;
         try {
             stmt = conn.createStatement();
             boolean bo = stmt.execute("use "+ tfDrv.getText());
             if( sql.startsWith( "select" ) ) {
              rs = stmt.executeQuery( sql );
              System.out.println( "xq rs: " + rs );
             else if( sql.startsWith( "delete" ) ||
                   sql.startsWith( "insert" ) ) {
              irs = stmt.executeUpdate( sql );
             else if( sql.startsWith( "update" ) ) {
              irs = stmt.executeUpdate( sql );
         catch( Exception e ) {
             System.out.println(e.getMessage());
             e.printStackTrace();
             throw e;
         return rs;
        private DefaultTableModel doSQL( String sql ) {
         DefaultTableModel m = new DefaultTableModel();
         java.util.Vector data = new java.util.Vector();
         java.util.Vector headers = new java.util.Vector();
         try {
             String s = "";
             ResultSet rs = executeSQL( sql );
             System.out.println( "rs " + rs );
             ResultSetMetaData rsmd = rs.getMetaData();
             for( int c = 1, cc = rsmd.getColumnCount(); c <= cc; c++ ) {
              headers.addElement( rsmd.getColumnName( c ) );
             java.util.Vector datum = null;
             while( rs.next() )
                  datum = new java.util.Vector();
                  for( int c = 1, cc = rsmd.getColumnCount(); c <= cc; c++ ) {
                   s = rs.getString( c );
                   datum.addElement( s );
                  data.addElement( datum );
         } catch( Exception e ) {
             e.printStackTrace();
         m.setDataVector( data, headers );
         System.out.println( "d: " + data );
         return m;
        private void initTable( JPanel p ) {
         DefaultTableModel dtm = doSQL( tfSQL.getText() );
         JTable tb = new JTable( dtm );
         JScrollPane sp = new JScrollPane( tb );
         JFrame fr = new JFrame();
         fr.getContentPane().add( sp );
         fr.pack();
         fr.show();
        public static void main( String[] args ) {
         JFrame f = new JFrame();
         yesSql rb = new yesSql();
         JPanel p = (JPanel) f.getContentPane();
         rb.initialize( p );
         f.pack();
         f.show();
    }

  • Need help with VBScript Urgent

    Hi, I am working on a specific project which requires a file to be updated on all users machine before deployment. I have tried a script which is not working and does not give any error either. Please check this for me urgently as I am running short of time. 
    Requirement: Script should force copy a file located on a common file share to a folder in users machine. I am not deploying this script via any GP or SCCM due to certain reason. I will be sending mail to users with a hyperlink which should trigger the script
    and perform the action. I would be delighted if there is a way if users can get a pop up window stating "Successfully Copied" or some sort. 
    Here is my incomplete script.
    Set objFso=createObject("scripting.fileSystemObject")
    set objWShell=wScript.createObject("WScript.Shell")
    usrName=objWShell.expandEnvironmentStrings("%USERNAME%")
    strFileToCopy="\\ja-rfzitd\INSTDIR\000 Sephora - UAT\Foundation\test.fcf"
    strFolder="C:\Users\%USERNAME%\AppData\Roaming\Test\"
    if objFso.folderExists(strFolder) then
    objFso.copyFile strFileToCopy,strFolder&"\",true
    end if

    Try changing this line:
    strFolder="C:\Users\%USERNAME%\AppData\Roaming\Test\"
    to this:
    strFolder="C:\Users\" & usrName & "\AppData\Roaming\Test"
    Environment variable expansion is not automatic in VBScript strings (evidenced by the fact that you had to call the ExpandEnvironmentStrings method of the WshShell object on the previous line). I also removed the trailing "\" from the string because
    you're already adding it when you call the CopyFile method.
    -- Bill Stewart [Bill_Stewart]

  • Need help with mysql-connector-j setup!

    I have downloaded and installed Tomcat 5.5 and MySQL Server 5.0 and have both up and running. I then downloaded the MySQL-Connector-J and the folder is located at:
    C:\Program Files\Java\jre1.5.0_06\lib\ext\mysql-connector-java-3.1.12
    My JSP code looks like this:
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ page import="java.net.*" %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="java.sql.*" %>
    <%
         try{
         Class.forName("com.mysql.jdbc.Driver").newInstance();
         catch (Exception E) {
         out.println("Unable to load driver. " + E);
    %>And I am getting the folowing error:
    java.lang.ClassNotFoundException: com.mysql.jdbc.DriverNow, before anyone tells me to go read other posts, I have already done this and I have tried changing my classpath with no luck. I have tried these locations as my classpath:
    C:\Program Files\Java\jre1.5.0_06\lib\ext\mysql-connector-java-3.1.12
    C:\Program Files\Java\jre1.5.0_06\lib\ext\mysql-connector-java-3.1.12\mysql-connector-java-3.1.12-bin.jar
    Neither of which seem to work. Can anyone figure out what's happening here?

    Ok, I copied it to the <tomcat dir>/common/lib, but I copied the entire folder (which I'm assuming is necessary), with no luck. So, now the location is:
    C:\Program Files\Apache Software Foundation\Tomcat 5.5\common\lib\mysql-connector-java-3.1.12\mysql-connector-java-3.1.12-bin.jar
    Any other suggestions?
    Thanks.
    null

  • NEED HELP WITH BLACKBERRY Urgent!! Please

    Hey guys well when I plugged in my blackberry into my desktop manager it told me to update the device software and I did and it started installing it. But then towards the end its just stopped all of a sudden and said fatal error and my phone was left like this.  I didn't touch it all while it was installing it please help!!
    [IMG]http://i296.photobucket.com/albums/mm173/elsantaclause/DSCN0474.jpg[/IMG]
    [IMG]http://i296.photobucket.com/albums/mm173/elsantaclause/DSCN0474.jpg[/IMG]

    Hi and Welcome to the Forums!
    Wow -- I've never seen that screen. Not at all sure what it even means. But, here's a process that I once found for recovering a bricked device...I've never had to use it, so I can't vouch for it's correctness...but at this point, what have you got to lose?
    http://adlen45.activeboard.com/index.spark?forumID=123568&p=3&topicID=18834966
    Hope it helps.
    Occam's Razor nearly always applies when troubleshooting technology issues!
    If anyone has been helpful to you, please show your appreciation by clicking the button inside of their post. Please click here and read, along with the threads to which it links, for helpful information to guide you as you proceed. I always recommend that you treat your BlackBerry like any other computing device, including using a regular backup schedule...click here for an article with instructions.
    Join our BBM Channels
    BSCF General Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

Maybe you are looking for