Results 1 to 4 of 4
  1. #1
    mainy is offline Member
    Join Date
    Feb 2009
    Posts
    38
    Rep Power
    0

    Default [SOLVED] Getting the value inside a SQL Query into a String.

    Hi,

    Fairly simple question I guess to you guys. I have a SQL database and I want to take the value of something inside this database and place it into a string. I know the path to information inside the SQL database, I just have no idea how to get that record stored inside a string.

    I have tried:
    variable.getString(SQL Location);
    variable.getQuery(SQL Location);
    String variable = "SQL Location"; (this obviously doesnt work).
    + several other I've forgotten.

    I have looked inside the JSP API and online but can't really find the solution.

    thank you in advance

  2. #2
    mtyoung is offline Senior Member
    Join Date
    Dec 2008
    Location
    Hong Kong
    Posts
    473
    Rep Power
    6

    Default

    have you specify jdbc driver in your code?
    have you create a connection?
    have you use preparedStatement/Statement, executeQuery
    and get the resultSet?

  3. #3
    mainy is offline Member
    Join Date
    Feb 2009
    Posts
    38
    Rep Power
    0

    Default

    Ok,

    have you specify jdbc driver in your code?
    have you create a connection?
    have you use preparedStatement/Statement, executeQuery
    and get the resultSet?
    My jdbc driver is located inside my web.xml document on the server. The connection works fine as I am able to display on the webpage tables of information from the server.

    What I am trying to do is this (only part of my code):

    Java Code:
    <sql:query var="sqlPass" sql="SQL LOCATION" /> (Sql Location contains a real sql query.)
    
    <%
        String password = request.getParameter("passWord");
        if (password.equals(sqlPass)) {
    %>
    ++ More code
    Basically, I am trying to compare a password inputted from the user with a password inside the sql database, if they are the same, do something.

  4. #4
    mainy is offline Member
    Join Date
    Feb 2009
    Posts
    38
    Rep Power
    0

    Default

    Hey,

    Just to let you know that I've sorted out the problem. I tried something else and got it working. :rolleyes:

    Thanks anyway.

Similar Threads

  1. Java Popup Window & Url Query String Value
    By Rivelyn in forum New To Java
    Replies: 4
    Last Post: 01-20-2011, 06:03 AM
  2. Help!! how to turn query result to string
    By stefanybaez in forum Advanced Java
    Replies: 2
    Last Post: 12-11-2008, 12:42 PM
  3. Replies: 1
    Last Post: 08-22-2008, 07:28 PM
  4. [SOLVED] General string problem in my database query.....?
    By prabhurangan in forum New To Java
    Replies: 7
    Last Post: 06-25-2008, 09:55 AM
  5. string inside of a xml
    By Heather in forum XML
    Replies: 2
    Last Post: 03-28-2008, 06:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •