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: General question regarding Java, Jpanel, and SQL and preferred method of interacting between them all

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default General question regarding Java, Jpanel, and SQL and preferred method of interacting between them all

    Please be patient with me as I attempt to assemble my question.

    Let's assume I have a table that has three fields in it. Two of the fields are strings, and the third field is a integer. In the Java world when setting up your jpanel and your fields, do most programmers setup that integer field as a string on the screen, then convert it to a number under the covers before writing it to a table via sql? Or do they typically leave them as an numeric(integer) field on the screen? Additionally, is the preferred method to assign the sql field values equal to the jfield values, or is it preferred to define a group of variables that the jfield information is moved into, and then move the variables into the SQL fields? I am just trying to get a feel for the best method to achieve these things.

    Additionally, if numbers are not typed in to a numeric(INT) field, then do we want to store NULL values to that field in that table, or is it preferred we store the value 0?

    I hope all of that made sense. I am new to the java world, but hardly new to programming. I appreciate your patience, and thanks for taking the time to read through this.


  2. #2
    Member
    Join Date
    Nov 2013
    Location
    Bangalore, India
    Posts
    69
    My Mood
    Cool
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Default Re: General question regarding Java, Jpanel, and SQL and preferred method of interacting between them all

    I would suggest to have as an integer. For storing it in DB unless it is a mandatory to be stored i wouldn't store it. If its mandatory prefer to store zero instead of NULL.

Similar Threads

  1. Java general question
    By maths94 in forum What's Wrong With My Code?
    Replies: 10
    Last Post: December 6th, 2013, 03:31 PM
  2. Interacting with NetHack
    By caphect in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: July 13th, 2012, 02:11 AM
  3. [SOLVED] How to modify core Java interface java.sql.Statement.execute(String sql)?
    By amughost in forum Java Theory & Questions
    Replies: 6
    Last Post: June 9th, 2012, 04:31 PM
  4. General Question
    By Becca in forum Collections and Generics
    Replies: 6
    Last Post: November 3rd, 2011, 03:52 PM
  5. Just a general Java related question
    By javaisfun in forum Java Theory & Questions
    Replies: 3
    Last Post: October 25th, 2011, 07:21 AM