Java
  Home arrow Java arrow Page 5 - Developing SQL Server based Java Apps usin...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVA

Developing SQL Server based Java Apps using NetBeans IDE
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 16
    2006-05-24

    Table of Contents:
  • Developing SQL Server based Java Apps using NetBeans IDE
  • What do we need to connect to Microsoft SQL Server from Java (or JDBC)?
  • How to configure CLASSPATH to connect to Microsoft SQL Server database
  • How to establish a Microsoft SQL Server database connection using JDBC
  • Creating a Microsoft SQL Server database connection using NetBeans IDE: Form Design
  • Creating a Microsoft SQL Server database connection using NetBeans IDE: the nucleus

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Developing SQL Server based Java Apps using NetBeans IDE - Creating a Microsoft SQL Server database connection using NetBeans IDE: Form Design


    (Page 5 of 6 )

    In this section, instead of simply connecting to Microsoft SQL Server, I shall go a bit further to give us the number of rows available in a table. This would be much more practical.

    We shall develop a small application with a button, ScrollPane and TextArea.  When the button is hit, it needs to give out the number of rows available. I named the project “SampleJavaApplication1” and the form (or JFrame) as “DBSample01” in the package “MyDBPack.”

    When the form (or JFrame) is created with “DBSample01,” the code behind it (only the constructor) would look something like the following:

      public class DBSample01 extends javax.swing.JFrame { 

        /** Creates new form DBSample01 */
        public DBSample01() {
            initComponents();
        }

    Make changes to the above code fragment in such a way that it looks similar to the following:

      public class DBSample01 extends javax.swing.JFrame {   

        /** Creates new form DBSample01 */
        public DBSample01() {
            initComponents();
            this.setSize(300,200);
        }

    In the above code, I explicitly defined the initial size of the frame.  Before dropping all controls on the form, set the layout to “null layout” (fig 02) to ease our development for this article.  When you complete your form design, it should look something like fig 2, and the “inspector” view should look something like fig 2-1.


    Figure 02. "null layout".


    Figure 02-1.
    "inspector" view.

    For the convenience of writing understandable code, I named those controls as follows:

    tbtnBold
    tbtnItalic
    txtMsg

    I also gave a value to the Frame property “title” (using the property window), namely “ToggleButtons: a Demo.”

    More Java Articles
    More By Jagadish Chaterjee


       · Hello guys. This contribution helps you to work with SQL Server using Java...
       · Sir, your article was really helpfull. But Sir,could you please tell me how to do...
     

    JAVA ARTICLES

    - Deploying Multiple Java Applets as One
    - Deploying Java Applets
    - Understanding Deployment Frameworks
    - Database Programming in Java Using JDBC
    - Extension Interfaces and SAX
    - Entities, Handlers and SAX
    - Advanced SAX
    - Conversions and Java Print Streams
    - Formatters and Java Print Streams
    - Java Print Streams
    - Wildcards, Arrays, and Generics in Java
    - Wildcards and Generic Methods in Java
    - Finishing the Project: Java Web Development ...
    - Generics and Limitations in Java
    - Getting Started with Java Web Development in...







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 2 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek