Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Testing your Java development environment

From: Java Database Integration with JDBC

Video: Testing your Java development environment

The exercises in this course are designed to work with Java 7, the most recent version of the Java Programming Language as of the time of this recording. If you haven't programmed with Java 7 before, you want to install it on your computer and make sure it's working. If you need to install Java 7, you can get the JDK or the Java Developers Kit from Oracle. Go to the URL oracle.com/Java, that will take you to the main Java page, then go to the Downloads menu and select Java for Developers.

Testing your Java development environment

The exercises in this course are designed to work with Java 7, the most recent version of the Java Programming Language as of the time of this recording. If you haven't programmed with Java 7 before, you want to install it on your computer and make sure it's working. If you need to install Java 7, you can get the JDK or the Java Developers Kit from Oracle. Go to the URL oracle.com/Java, that will take you to the main Java page, then go to the Downloads menu and select Java for Developers.

On this screen you'll see that there are two downloads available, the JDK or Java Developers Kit, and the JRE or Java Runtime Environment. You'll want the JDK. I'll click that link, and I'll see a listing of all the different installations for various Operating Systems. You can choose from the Mac version or the Windows version, and notice that there are two versions for Windows, one for 64 bit and one for X86 or 32-bit. After following the rest of the instructions to install the JDK on your system, if you're working on a Mac, make sure that you have set the Java 7 Runtime as your default.

To do this, go to the Java Preferences application, which you can find through Spotlight or from Finder by going to the Applications/Utilities folder. I'll open Java Preferences and show you the state it should be in. You should have Java 7 installed, and Java SE7 should be at the top of the list that makes it your default. If you're working on Windows, all you need to do is install the JDK. It'll be fine if it's installed side by side with Java 6 or an older version of the JDK.

It just has to be present on your system. Once you have installed Java 7 on your system, the next step is to make sure that you can create and run a Java 7 project in Eclipse. I have already installed Eclipse, and I'll go to the Eclipse Preferences dialog. You can get the Preferences either through Eclipse Preferences on Mac or from the Window menu on Windows. In the Preferences dialog, go to the Java section and then to the Compiler and make sure your Compiler compliance level is set to 1.7, which is the actual underlying version number for what's called in marketing Java 7.

If you don't see 1.7 as a possible option, make sure that you're running at least Juno Eclipse 4.2. If all that is set, now you're ready to create a simple project and make sure that some code will work. That would only work if you're running Java 7 or later. I'll close the Preferences dialog and create a new Java project. I'll name the project Java7Test, and I'll make sure that my execution environment JRE is set to JavaSE-1.7, and I'll click Finish.

I'll open up the project and go to the source folder, and I'll create a New Class. I will name my class Main. I'll add it to a package called com.lynda.javatraining, and I'll make sure that I have checked the option to create a main method, and I'll click Finish. Now I'm going to execute a little bit of code that will only work correctly if I have Java 7 or later installed. I'll go to the class declaration and delete these comments, and within the class declaration but outside the main method I'll declare a static string field.

I'll make it private and static, and I'll set its type as String, and I'll give it a value of one. I'll go to the main method, and I'll add a switch statement. I'll type the word Switch and press Ctrl+Space, and I'll use this switch code template. I'll set the key to value, and here's why: this is a Java 7 test. Java 7 adds the ability to use switch statements with string values, something you couldn't do with older versions of Java. So if this code works, then I know the Java 7 is working. I'll press Tab to go to my first case, and I look for a value of one as a string.

I'll tab again, and I'll use the sysout code template, typing sysout, and then pressing Ctrl+Space, and I'll out put the string, the value is one. Now I'll go down to my default case, and I'll add another system output block, and I'll output the string, The value isn't one. I'll save my changes and run my application and in my Console, I'll see the string, the value is one. So if this code is working on your system then you know JDK 7 is working. Finally, I'm going to make a couple of other changes to my Eclipse environment and then I'll be ready to launch into the exercises in this course.

I'm going to reset the current Java perspective. The Java perspective is installed as part of the Eclipse installation. I'll go to window and Reset Perspective and click Yes, and then I'm going to close the Task List view, which I won't need for this course. Then I'll save this reconfigure perspective as a custom perspective named Java DB. I'll go to the menu and choose Window > Save Prospective As, and I'll name this Java DB and click OK. Now at any time during the exercises, I'll be able to return to this custom perspective, and this will be my starting perspective in each of the exercises of this course. So Java 7 is tested.

I know I'll be able to run Custom Java 7 code on this system, and I have customized my Eclipse installation, and I'm ready to get started with JDBC.

Show transcript

This video is part of

Image for Java Database Integration with JDBC
Java Database Integration with JDBC

32 video lessons · 7136 viewers

David Gassner
Author

 
Expand all | Collapse all
  1. 5m 23s
    1. Welcome
      53s
    2. What you should know before starting this course
      1m 20s
    3. Using the exercise files
      3m 10s
  2. 12m 2s
    1. Testing your Java development environment
      5m 14s
    2. Importing a MySQL database
      5m 1s
    3. Creating a database user in MySQL
      1m 47s
  3. 32m 47s
    1. What is JDBC?
      4m 26s
    2. Choosing a JDBC driver
      6m 46s
    3. Connecting to a MySQL database server
      8m 7s
    4. Connecting to a HyperSQL database file
      6m 23s
    5. Executing a static SQL statement
      7m 5s
  4. 17m 42s
    1. Connecting to multiple databases
      6m 24s
    2. Handling JDBC exceptions
      7m 7s
    3. Closing database resources in Java 7
      4m 11s
  5. 47m 25s
    1. Looping through result sets
      8m 23s
    2. Moving the cursor in scrollable result sets
      5m 51s
    3. Limiting the number of fetched rows
      6m 57s
    4. Filtering data with prepared statements
      6m 58s
    5. Calling stored procedures
      5m 48s
    6. Handling multiple values from stored procedures
      5m 54s
    7. Using generic getter methods in Java SE 7
      7m 34s
  6. 45m 23s
    1. Managing data entities with JavaBean classes
      5m 0s
    2. Retrieving a single row as a JavaBean object
      6m 5s
    3. Inserting rows with prepared statements
      8m 2s
    4. Updating rows with prepared statements
      5m 4s
    5. Deleting rows with prepared statements
      4m 9s
    6. Managing data with updatable result sets
      6m 6s
    7. Using a persistent database connection
      6m 43s
    8. Committing and rolling back transactions
      4m 14s
  7. 9m 35s
    1. Getting the DatabaseMetaData object
      3m 40s
    2. Getting column and data type information
      5m 55s
  8. 50s
    1. Next steps
      50s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ .

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Java Database Integration with JDBC.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member ?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferences from the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.