Results 1 to 6 of 6
  1. #1
    hadesflames is offline Member
    Join Date
    Apr 2009
    Posts
    7
    Rep Power
    0

    Default JDBC data retrieval with MySQL

    Ok I have a server with 5+ columns and 5+ rows (the actual amount doesn't matter)

    I have the data from column 2, row 4 stored in a variable, how do i then store the data in column 4 row 4 in another variable?

    I don't know any MySQL syntax, nor how to use it in java much so if someone could show me a coded example i'd really appreciate it.

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

    Default

    server with 5+ columns and 5+ rows
    table or server?

    I have the data from column 2, row 4 stored in a variable, how do i then store the data in column 4 row 4 in another variable?
    is that means you want to get data at row4 column 4 from the databases table?

    read MySQL :: MySQL 5.0 Reference Manual :: 12.2.8 SELECT Syntax
    and Trail: JDBC(TM) Database Access (The Java™ Tutorials)

    it is difficult to get data by rowX, columnX
    you should use Select select_expr(may be entity name) from table_name where conditions
    why you wants data at row4 column 4? it may be data in row4 column1, column 2 etc show that data you want in row4
    use where where_condition to get row4
    Last edited by mtyoung; 04-22-2009 at 06:44 AM.

  3. #3
    neilcoffey is offline Senior Member
    Join Date
    Nov 2008
    Posts
    286
    Rep Power
    7

    Default

    In case it helps as well, a page of mine on reading data from a ResultSet.

    The usual procedure is that you structure your query to retrieve more or less the subset of rows that you want, then if necessary, call ResultSet.next() to skip down to the one you want within that subset.

  4. #4
    hadesflames is offline Member
    Join Date
    Apr 2009
    Posts
    7
    Rep Power
    0

    Default

    I am talking about a table that has a value in column 2 row 4 now i want to get a value from a different column, but of the SAME row as the first one (4) the actual numbers are examples and do not matter. I am doing a program where knowing a "username" I would be able to retrieve user data.

  5. #5
    neilcoffey is offline Senior Member
    Join Date
    Nov 2008
    Posts
    286
    Rep Power
    7

    Default

    In that case, I still don't understand why you care about the row numbers especially. You'd do a query, e.g.

    Java Code:
    SELECT Id, FirstName, Surname, ... FROM Users WHERE username = '....';
    and then the single row returned by this query would be the one you want.

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

Similar Threads

  1. Replies: 4
    Last Post: 03-31-2010, 01:08 PM
  2. Replies: 1
    Last Post: 02-23-2009, 07:48 PM
  3. MySQL/JDBC Mysql query output
    By thelinuxguy in forum Advanced Java
    Replies: 4
    Last Post: 02-13-2009, 02:57 AM
  4. Java JDBC/MySQL appropriate Syntax
    By thelinuxguy in forum Advanced Java
    Replies: 7
    Last Post: 02-10-2009, 08:57 PM
  5. help ... JDBC or PHP/MySQL
    By bluebarca in forum Advanced Java
    Replies: 1
    Last Post: 11-16-2007, 11:05 AM

Posting Permissions

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