Simple JSP JDBC Example

January 29, 2008 | Leave a Comment

I learned to program on Java, but have done little to exercise those skills in the last six years, preferring to leverage PHPs simplicity whenever possible. So... when I had a need to put together a simple JSP script that queried Oracle, I found myself scouring for a truly simple example to start from. Here's the example I put together:

JAVA:
  1. <%@ page import="java.sql.*" %>
  2. <%
  3. try
  4. {
  5.     //this is how you might get a POST or GET variable from the request to use
  6.     //String user_id = request.getParameter("some_var");
  7.  
  8.     Connection  conn = DriverManager.getConnection("jdbc:oracle:thin:@HOSTNAME:PORT:SID","USERNAME","PASSWORD");
  9.     Statement stmt = conn.createStatement();
  10.     ResultSet rset = stmt.executeQuery("SELECT sysdate FROM dual'");
  11.     if (rset.next())
  12.     {
  13.         out.println(rset.getString(1));
  14.     }
  15.     else
  16.     {
  17.         out.println("No records found");
  18.     }
  19.     rset.close();
  20.     stmt.close();
  21. }
  22. catch (SQLException e) {
  23.     out.println("Exception");
  24. }
  25. %>

Certainly for your own purposes you would need to write a lot more code than this. Yet, if you seek a simple example just to gain your bearings, this should do it.

Tags: , , , , , , , , , , ,

Related:

Bizarre Frozen Waves

January 20, 2008 | Leave a Comment

The video quality here isn't great, but what it captures is stunning. As the water in Newfoundland freezes and expands, it pushes up on shore in waves of ice. Fascinating.

Tags: , , , , ,

Related:

Guitar Hero III - Wii Replacement Disks

January 17, 2008 | 1 Comment

As awesome as Guitar Hero 3 for the Wii is... they accidentally released the game with mono sound. Apparently this was due to some screw up when the game master was made. Whatever the cause, Activision has stepped up:

From the Activision recall site:

As you know, some consumers have not been able to enjoy the full audio output of Dolby Pro Logic II on the Wii version of Guitar Hero III: Legends of Rock. Activision is working with Nintendo to improve the audio experience and will be re-mastering the game. We will be offering Wii consumers who have Dolby capabilities free replacement discs in early 2008 once the discs become available. To pre-register for your free replacement disc, please fill out the following information. We will email you once the free replacement discs are available.

So if you have Guitar Hero III for Wii, I highly recommend getting your recall disk exchange.

Tags: , , , , , , , , , ,

Related:

Announcing Sun MySQL!

January 16, 2008 | Leave a Comment

Sun has officially acquired MySQL! As a huge fan and supporter of MySQL, I have personal commitment and obvious concerns about this. In my experience most things Sun does are bloated and slow to develop (Solaris, Java, Open Office). Yet, I remain hopeful because they do seem to respect and work positively with open source initiatives.

The most positive things can come out of this are improved marketing, better name recognition, and funds injected into a project. Maybe they can compete with Oracle now? Hey, maybe Sun will stop using Berkeley DB to back most it's existing products. I'll admit that upon first reading this my heart skipped a few beats, but as the pains subsided I think its all going to be OK.

Tags: , , , , , , , ,

Related:

Connect360 - iLife Meets XBox 360

January 10, 2008 | Leave a Comment

connect360I knew you could connect a Windows Media Center PC to your XBox 360 to extend the available content, but my primary machine at home is a Mac running OS X. This means all the fun media (movies, music, and pictures) is all on there. So after a bit of searching I turned up the absolutely amazing Connect360 by Nullriver Software.

So how exactly does it work and what does it do?

The iTunes integration allows you to browse and play your iTunes music by song, artist, album, genre or playlist. As expected, this allows support for listening to your iTunes songs while playing a game. It even updates your iTunes play count and play date for songs played on your Xbox 360.

In addition, Connect360 supports streaming of live Internet radio broadcasts by simply addind any station to a playlist

As for iPhoto, you can view your photo library, browse by photo album or watch a slideshow.

Any movies in your movie folder become available for viewing in full screen.

Connect360 supports the following formats:

MP3, AAC, WAV, AIFF and Apple Lossless for Music. For Photos, Connect360 supports: JPEG, RAW, GIF, PNG, BMP and TIFF. For video streaming, currently only WMV+WMA, AVI (DIVX/XVID), H.264 and MPEG4 files are supported (in MP4 and MOV containers).

On top of all this sweetness, it also does "automagic transcoding". With this feature, it can do on-the-fly automatic transcoding of many formats so that you can enjoy even more content on you Xbox 360.

As for setup, you drop a new control panel on your Mac and this Connect360 software will automatically detect your Xbox 360 and in turn your 360 will automatically detect your Mac and the media made available to it.

The demo is free, and the full version is merely $20, so if you have this setup, try it out, you won't be sorry.

Tags: , , , , , , , , , , , , , , , , ,

Related: