Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Getting id of Column values from db

  1. #1
    Junior Member
    Join Date
    Jun 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Getting id of Column values from db

    how can i get id from db table for each column values with java or oracle query? i did get before each column content from file and now i need get the id of this column values from db. I read csv files from folder and then load the data from these files into subfolder, and here with line li = line.split(","); i get the values that i have in csv file and split them and become in li the value name, and then in else block i create a P objekt where i set this values from csv files, and with [I]p.setLid(li); i set the value for all valuenames, and then get these valuenames in separate column with other content from this csv, and my question is, i need to do this with db, and write these csv file values to the table in db (it will be done with another java class), what i need, that to write the ids of these values into the table in db, instead of valuename, and while there is no ids for valuenames in csv files, i need to get the id from the table in db where these are already listed with sequences, and i don't know how can i write in data table the id of this valuenames and other content, this data table should contain the ids of valuenames timestamp values and the ids of the csv files name, i don't know how to do this with the ids, i must get the ids from the db table and then set these on [I]p.setLid(li); where i set early the valuenames, instead of valuenames i should set ids, that will set ids automatically for all these valuenames.
    try {  
                while ((line = br.readLine()) != null) {  
                    if (lc == 0) {  
                        li = line.split(",");  
                    }  
                  else {  
     
                        String[] temp = line.split(",");  
     
                        for (int i = 1; i < temp.length; i++) {  
     
                            p = new P();  
     
                            p.setLid(li[i]);  
                            p.setSid(on);  
                                l.add(p);  
                        }  
               }  
                    lc++;  
     
                }
    with
    li = line.split(",");

    i got the values that then will be given to [I]p.setLid(li); and iterate, but now i want to get id from the table in db where this values stored with id instead of this column values, how can i do it? Any suggestions please.


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Getting id of Column values from db

    Welcome to the forum! Thanks for taking the time to learn how to post code correctly. If you haven't already, please read this topic to learn other useful info for new members.

Similar Threads

  1. The column in JTable is not showing the proper values
    By nat in forum What's Wrong With My Code?
    Replies: 0
    Last Post: February 17th, 2014, 02:28 PM
  2. Replies: 2
    Last Post: October 26th, 2013, 09:56 AM
  3. Replies: 2
    Last Post: October 26th, 2013, 09:56 AM
  4. Sum elements column by column
    By NallelyXIII in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 9th, 2013, 01:22 AM
  5. Character Values Inside of Number Values
    By bgroenks96 in forum Java Theory & Questions
    Replies: 4
    Last Post: October 2nd, 2011, 08:27 PM

Tags for this Thread