Jdbc-swing

Hi All,
I would like to connect the database and retrieve and updates values from/into tables through swing components.I have tried that,but some socketexception is occured.
please answer to my question.
Regards,
Aravind

What's your question? You made two statements -- not a question in sight.
What socket exception are you encountering?

Similar Messages

  • Inserting JTable for JDBC swing project in programme.

    i,ve a problem to develop an application contains table area
    with fixed columns but multiple rows in it.give me a suitable suggestion plz.

    http://forum.java.sun.com/thread.jsp?forum=57&thread=271752
    Take a look at this thread and please read carefully.
    James

  • Is java free?

    I need to write application for my company, it will use jdbc, swing, xml, all from standart J2EE JDK. Do I need to pay anything and what license should I use?

    Even if I will sell my programm? Yes! Of course, you are not allowed to sell the JRE itself as if it was your program. But you can of course sell your own program based on the JRE.

  • SWING GUI blockes when doing a DB action with microsoft nativ JDBC driver

    hi,
    in a bigger project i have the problem that if i perform a DB action the GUI is blocked. It does not matter if i do the DB Action in invokeLater or
    in a SwingWorker or in a new Thread if i call the DB Action and i move another window over my window it is not refreshed.
    normally the GUI shouln�t be blocked if i use invokeLater. maybe it
    has something to do that i use the native DB driver? I am using JDK
    1.4. has anyone ever encounterd the same problem?
    alex
    package swingtest;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    public class GUIProblem extends JDialog {   
    // this method does a simple DB call to generate some load
    public void doMyDBCall()
    try {
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    Connection con = DriverManager.getConnection ("jdbc:microsoft:sqlserver://abgvdr71:1433;databasename=v52li;","sa","");
    Statement question0 = con.createStatement();
    ResultSet rs0=null;
    rs0 = question0.executeQuery("select * from intercept_24");
    boolean more=rs0.next();
    while (more) {    more=rs0.next();}
    catch (Exception sql)
    { sql.printStackTrace(); }
    public void doItinvokeLater()
    SwingUtilities.invokeLater(new Runnable(){    public void run(){       
    doMyDBCall();     
    public void doItSwingWorker()
    SwingWorker worker = new SwingWorker() {
    public Object construct() {
    System.out.println("worker start");
    doMyDBCall();
    return null;
    worker.start();
    System.out.println("finished .....");
    Object view = (Object) worker.get();
    public GUIProblem (){
    super((JFrame)null,"",true);
    JButton button = new JButton("do it");
    button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent event)
    // calls it direct -> GUI blocked
    //doMyDBCall();
    // with invoke later -> GUI blocked
    //doItinvokeLater();
    // with the swingWorker -> GUI also blocks
    doItSwingWorker();     
    getContentPane().add(button);
    setSize(200,200);
    setVisible(true);
    public static void main(String [] args)
    {  new GUIProblem(); }
    }

    The invokeLater runs the Runnable in the event thread, so yes, that will block your GUI. You ALMOST got the SwingWorker right. DB call in the construct() method -- the construct() method executes outside the event thread, the finished() method executes in the event thread. The only problem is, you did a worker.get() method in your event thread (right after worker.start(0, and get() blocks until result is ready from construct() -- so, bingo, you're jammed up waiting in you event thread.

  • Swing-jdbc

    we are developing a swing applicaiton.it is connecting to an oracle 10gr2 database.all database calls are written seperately in a class and conncetions are closed in finaly block.the problem is that on invoking the application few times in a row, the following sql exception is happening
    java.lang.NullPointerException
    java.sql.SQLException: Listener refused the connection with the following error:
    ORA-12519, TNS:no appropriate service handler found
    The Connection descriptor used by the client was:
    172.16.18.192:1521:oncodms
    is it due to some network problem or database server related problem?? or some problem with the code?? ive seen connection pooling in j2ee containers ,is it possible to implement something like that in swing application??

    Hi friends.
    I'm newer in Java, and i'm searching for 3er party
    components (comercial or free), that connects swing
    with jdbc (for example, one tablemodel that connects
    with jdbc for read and write).
    Thank you.Please see http://forum.java.sun.com/thread.jspa?threadID=5123381
    Edit: Hey Stupid! That thread is yours. Cripes how stupid can you get....

  • Using a swing program with a gui-based jdbc program

    hello.
    my name is james mcfadden and i am a final year computing student at letterkenny IT in ireland. i have 2 programs here that i want to make interact with each other. the first one is a jdbc demo and the second one is a login program that i'll be using with the first one. i was trying to get the 2 programs interacting with each other yesterday but i was unsuccessful. would you be able to look at it as soon as possible? i have to be able to use these programs next week. thank you very much.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.JOptionPane;
    import java.sql.*;
    public class Demo extends JFrame {
    static String url = "jdbc:odbc:VideoLibrary";
    static Statement stmt;
    static Connection con;
         //declare member variables here
         JTextField hostField;
    JTextField queryField;
    QueryTableModel qtm;
    JComboBox comboBox;
    public static void main(String args[]){
         //new LogOn();     
    int choice=-1;
              do{
    choice=getChoice();
    if(choice!=0){
    getSelected(choice);
    }while(choice!=5);
    System.exit(0);
    public static int getChoice(){
    String choice;
    int ch;
    choice = JOptionPane.showInputDialog(null,"1. Maintain product details\n"+"2. Maintain member details\n"+"3. Maintain rental details\n"+"4. View product, member and rental details\n"+"5. Log Off\n\n"+"Enter your choice");
              ch = Integer.parseInt(choice);
    return ch;
    public static void getSelected(int choice){   
              if(choice==1){
    addProducts();
    if(choice==2){
    addMembers();
              if(choice==3){
    addRentals();
              if(choice==4){
              Demo test = new Demo();
    test.setVisible(true);
    public static Connection getConnection(){
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              catch(java.lang.ClassNotFoundException e) {
    System.err.print("ClassNotFoundException: ");
    System.err.println(e.getMessage());
    try {
    con=DriverManager.getConnection(url,"","");
              catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    return con;
    public static void addProducts(){
    Connection con = getConnection();
    String addProduct1, addProduct2, addProduct3, addProduct4, addProduct5, addProduct6, addProduct7, addProduct8, addProduct9, addProduct10, addProduct11, addProduct12, addProduct13, addProduct14, addProduct15, addProduct16, addProduct17, addProduct18, addProduct19, addProduct20, addProduct21, addProduct22, addProduct23, addProduct24, addProduct25, addProduct26, addProduct27, addProduct28, addProduct29, addProduct30, addProduct31, addProduct32, addProduct33, addProduct34, addProduct35, addProduct36, addProduct37, addProduct38, addProduct39, addProduct40, addProduct41, addProduct42, addProduct43, addProduct44, addProduct45, addProduct46, addProduct47, addProduct48, addProduct49, addProduct50, addProduct51, addProduct52, addProduct53, addProduct54, addProduct55, addProduct56, addProduct57, addProduct58, addProduct59, addProduct60, addProduct61, addProduct62, addProduct63, addProduct64, addProduct65, addProduct66, addProduct67, addProduct68, addProduct69, addProduct70, addProduct71, addProduct72, addProduct73, addProduct74, addProduct75, addProduct76, addProduct77, addProduct78, addProduct79, addProduct80, addProduct81, addProduct82, addProduct83, addProduct84, addProduct85, addProduct86, addProduct87, addProduct88, addProduct89, addProduct90, addProduct91, addProduct92, addProduct93;
    addProduct1 = "insert into Product values (110001, 'The Killers - Sams Town', 5.00, 'G', 'CD', 2006)";
    addProduct2 = "insert into Product values (110002, 'Robbie Williams - Rudebox', 5.00, 'G', 'CD', 2006)";
    addProduct3 = "insert into Product values (110003, 'Razorlight - Razorlight', 5.00, 'G', 'CD', 2006)";
    addProduct4 = "insert into Product values (110004, 'My Chemical Romance - The Black Parade', 5.00, 'G', 'CD', 2006)";
    addProduct5 = "insert into Product values (110005, 'Snow Patrol - Eyes Open', 5.00, 'G', 'CD', 2006)";
    addProduct6 = "insert into Product values (110006, 'Scissor Sisters - Ta-Dah!', 5.00, 'G', 'CD', 2006)";
              addProduct7 = "insert into Product values (110007, 'Lovesounds - Justin Timberlake', 5.00, 'G', 'CD', 2006)";
    addProduct8 = "insert into Product values (110008, 'Director - We thrive on big cities', 5.00, 'G', 'CD', 2006)";
    addProduct9 = "insert into Product values (110009, 'Roxette - Roxette hits', 5.00, 'G', 'CD', 2006)";
    addProduct10 = "insert into Product values (110010, 'Pussy Cat Dolls - PCD', 5.00, 'G', 'CD', 2006)";
    addProduct11 = "insert into Product values (110011, 'Evanescence - The Open Door', 5.00, 'G', 'CD', 2006)";
    addProduct12 = "insert into Product values (110012, 'Deacon Blue - The Singles', 5.00, 'G', 'CD', 2006)";
              addProduct13 = "insert into Product values (110013, 'Rod Stewart - The Best of Rod Stewart', 5.00, 'G', 'CD', 2006)";
              addProduct14 = "insert into Product values (110014, 'P Diddy - Press Play', 5.00, 'G', 'CD', 2006)";
    addProduct15 = "insert into Product values (110015, 'James Morrison - Undiscovered', 5.00, 'G', 'CD', 2006)";
    addProduct16 = "insert into Product values (110016, 'BDay - Beyonce', 5.00, 'G', 'CD', 2006)";
    addProduct17 = "insert into Product values (110017, 'John Legend - Once Again', 5.00, 'G', 'CD', 2006)";
              addProduct18 = "insert into Product values (110018, 'Luther Vandross - The Ultimate', 5.00, 'G', 'CD', 2006)";
              addProduct19 = "insert into Product values (110019, 'Fleetwood Mac - Greatest Hits', 5.00, 'G', 'CD', 2006)";
              addProduct20 = "insert into Product values (110020, 'Kooks - Inside In Inside Out', 5.00, 'G', 'CD', 2006)";
              addProduct21 = "insert into Product values (110021, 'Scooter - Mind the Gap', 5.00, 'G', 'CD', 2007)";
              addProduct22 = "insert into Product values (110022, 'Scooter - Whos Got the Last', 5.00, 'G', 'CD', 2007)";
              addProduct23 = "insert into Product values (110023, 'Scooter - Jigga Jigga', 5.00, 'G', 'CD', 2007)";
              addProduct24 = "insert into Product values (110024, 'Dr. Alban - Look Whos Talking', 5.00, 'G', 'CD', 2007)";
              addProduct25 = "insert into Product values (110025, 'Dr. Alban - Hello Afrika', 5.00, 'G', 'CD', 2007)";
              addProduct26 = "insert into Product values (110026, 'Dr. Alban - Born in Africa', 5.00, 'G', 'CD', 2007)";
              addProduct27 = "insert into Product values (110027, 'Bon Jovi - Crossroad', 5.00, 'G', 'CD', 2007)";
              addProduct28 = "insert into Product values (110028, 'Bon Jovi - Have a Nice Day', 5.00, 'G', 'CD', 2007)";
              addProduct29 = "insert into Product values (110029, 'Bon Jovi - These Days', 5.00, 'G', 'CD', 2007)";
              addProduct30 = "insert into Product values (120001, 'Mission Impossible 3', 5.00, '15', 'DVD', 2006)";
              addProduct31 = "insert into Product values (120002, 'The Wind that Shakes the Barley', 5.00, '12', 'DVD', 2006)";
              addProduct32 = "insert into Product values (120003, 'The Break Up', 5.00, '12', 'DVD', 2006)";
              addProduct33 = "insert into Product values (120004, 'The Da Vinci Code', 5.00, '15', 'DVD', 2006)";
              addProduct34 = "insert into Product values (120005, 'Ice Age 2', 5.00, 'G', 'DVD', 2006)";
              addProduct35 = "insert into Product values (120006, 'Just My Luck', 5.00, '12', 'DVD', 2006)";
              addProduct36 = "insert into Product values (120007, 'Stormbreaker', 5.00, '12', 'DVD', 2006)";
              addProduct37 = "insert into Product values (120008, 'X-Men 3', 5.00, 'PG', 'DVD', 2006)";
              addProduct38 = "insert into Product values (120009, 'Lake House', 5.00, '12', 'DVD', 2006)";
              addProduct39 = "insert into Product values (120010, 'Inside Man', 5.00, '15', 'DVD', 2006)";
              addProduct40 = "insert into Product values (120011, 'Ultraviolet', 5.00, '12', 'DVD', 2006)";
              addProduct41 = "insert into Product values (120012, 'Friends with Money', 5.00, '15', 'DVD', 2006)";
              addProduct42 = "insert into Product values (120013, 'Fearless', 5.00, 'PG', 'DVD', 2006)";
              addProduct43 = "insert into Product values (120014, 'When A Stranger Calls', 5.00, '15', 'DVD', 2006)";
              addProduct44 = "insert into Product values (120015, 'Prime', 5.00, '15', 'DVD', 2006)";
              addProduct45 = "insert into Product values (120016, 'Poseidon', 5.00, '12', 'DVD', 2006)";
              addProduct46 = "insert into Product values (120017, 'Tristan & Isolde', 5.00, '12', 'DVD', 2006)";
              addProduct47 = "insert into Product values (120018, 'Little Mermaid', 5.00, '12', 'DVD', 2006)";
              addProduct48 = "insert into Product values (120019, 'The Fast & The Furious 3', 5.00, '12', 'DVD', 2006)";
              addProduct49 = "insert into Product values (120020, 'The Omen', 5.00, '15', 'DVD', 2006)";
              addProduct50 = "insert into Product values (120021, 'Eragon', 5.00, '15', 'DVD', 2007)";
              addProduct51 = "insert into Product values (120022, 'Arthur and the Minimoys', 5.00, '15', 'DVD', 2007)";
              addProduct52 = "insert into Product values (120023, 'The Pursuit of Happyness', 5.00, 'G', 'DVD', 2007)";
              addProduct53 = "insert into Product values (120024, 'Van Wilder 2: The Rise of Taj', 5.00, '15', 'DVD', 2007)";
              addProduct54 = "insert into Product values (120025, 'Blood Diamond', 5.00, '15', 'DVD', 2007)";
              addProduct55 = "insert into Product values (120026, 'Deja Vu', 5.00, '15', 'DVD', 2007)";
              addProduct56 = "insert into Product values (120027, 'For Your Consideration', 5.00, '18', 'DVD', 2007)";
              addProduct57 = "insert into Product values (120028, 'The Fountain', 5.00, 'PG', 'DVD', 2007)";
              addProduct58 = "insert into Product values (120029, 'Bobby', 5.00, '15', 'DVD', 2007)";
              addProduct59 = "insert into Product values (130001, 'Need for Special Carbon', 5.00, '15', 'Playstation 2 Game', 2006)";
              addProduct60 = "insert into Product values (130002, 'Need for Special Carbon', 5.00, '15', 'Nintendo DS Game', 2006)";
              addProduct61 = "insert into Product values (130003, 'Need for Special Carbon', 5.00, '15', 'PSP Game', 2006)";
              addProduct62 = "insert into Product values (130004, 'Need for Special Carbon', 5.00, '15', 'Xbox 360 Game', 2006)";
              addProduct63 = "insert into Product values (130005, 'EYETOY Play SPORTS', 5.00, '15', 'Playstation 2 Game', 2006)";
              addProduct64 = "insert into Product values (130006, 'Family Fun With Playstation 2', 5.00, '15', 'Playstation 2 Game', 2006)";
              addProduct65 = "insert into Product values (130007, 'Smackdown v Raw 07', 5.00, '15', 'Playstation 2 Game', 2006)";
              addProduct66 = "insert into Product values (130008, 'Smackdown v Raw 07', 5.00, '15', 'PSP Game', 2006)";
              addProduct67 = "insert into Product values (130009, 'Smackdown v Raw 07', 5.00, '15', 'Xbox 360 Game', 2006)";
              addProduct68 = "insert into Product values (130010, 'Sinister Legends', 5.00, '15', 'Playstation 2 Game', 2006)";
              addProduct69 = "insert into Product values (130011, 'Pro Evolution Soccer 6', 5.00, '15', 'Playstation 2 Game', 2006)";
              addProduct70 = "insert into Product values (130012, 'Pro Evolution Soccer 6', 5.00, '15', 'PSP Game', 2006)";
              addProduct71 = "insert into Product values (130013, 'Pro Evolution Soccer 6', 5.00, '15', 'Xbox 360 Game', 2006)";
              addProduct72 = "insert into Product values (130014, 'BUZZ Jungle Party', 5.00, '15', 'Playstation 2 Game', 2006)";
              addProduct73 = "insert into Product values (130015, 'FIFA 07', 5.00, '15', 'Playstation 2 Game', 2006)";
              addProduct74 = "insert into Product values (130016, 'Killzone Liberation', 5.00, '15', 'PSP Game', 2006)";
              addProduct75 = "insert into Product values (130017, 'Gangs of London', 5.00, '15', 'PSP Game', 2006)";
              addProduct76 = "insert into Product values (130018, 'FIFA 07', 5.00, '15', 'PSP Game', 2006)";
              addProduct77 = "insert into Product values (130019, 'Passport to Amsterdam', 5.00, '15', 'PSP Game', 2006)";
              addProduct78 = "insert into Product values (130020, 'Tiger Woods 07', 5.00, '15', 'Playstation 2 Game', 2006)";
              addProduct79 = "insert into Product values (130021, 'Tiger Woods 07', 4.90, '15', 'PSP Game', 2006)";
              addProduct80 = "insert into Product values (130022, 'Tiger Woods 07', 4.90, '15', 'Xbox 360 Game', 2006)";
              addProduct81 = "insert into Product values (130023, 'Madden NFL 07', 4.90, '15', 'Playstation 2 Game', 2006)";
              addProduct82 = "insert into Product values (130024, 'Madden NFL 07', 4.90, '15', 'Nintendo DS Game', 2006)";
              addProduct83 = "insert into Product values (130025, 'Madden NFL 07', 4.90, '15', 'PSP Game', 2006)";
              addProduct84 = "insert into Product values (130026, 'Madden NFL 07', 4.90, '15', 'Xbox 360 Game', 2006)";
              addProduct85 = "insert into Product values (130027, 'Gears of War', 4.90, '15', 'Xbox 360 Game', 2006)";
              addProduct86 = "insert into Product values (130028, 'Star Trek: Legacy', 4.90, '15', 'Xbox 360 Game', 2006)";
              addProduct87 = "insert into Product values (130029, 'Tekken: Dark Ressurection', 4.90, '15', 'PSP Game', 2006)";
              addProduct88 = "insert into Product values (130030, 'GTA Vice city stories PSP', 4.90, '15', 'PSP Game', 2006)";
              addProduct89 = "insert into Product values (130031, 'Star Trek: Encounters', 5.00, '15', 'Playstation 2 Game', 2007)";
              addProduct90 = "insert into Product values (130032, 'Star Trek: Shattered Universe', 5.00, '15', 'Xbox 360 Game', 2007)";
              addProduct91 = "insert into Product values (130033, 'Star Trek Voyager: Elite Force', 5.00, '15', 'Playstation 2 Game', 2007)";
              addProduct92 = "insert into Product values (130034, 'Battlestar Galactica', 5.00, '15', 'Xbox 360 Game', 2007)";
              addProduct93 = "insert into Product values (130035, 'Battlestar Galactica', 5.00, '15', 'Playstation 2 Game', 2007)";
              try {
    stmt = con.createStatement();
    stmt.executeUpdate(addProduct1);
    stmt.executeUpdate(addProduct2);
    stmt.executeUpdate(addProduct3);
    stmt.executeUpdate(addProduct4);
                   stmt.executeUpdate(addProduct5);
    stmt.executeUpdate(addProduct6);
              stmt.executeUpdate(addProduct7);
    stmt.executeUpdate(addProduct8);
    stmt.executeUpdate(addProduct9);
    stmt.executeUpdate(addProduct10);
    stmt.executeUpdate(addProduct11);
    stmt.executeUpdate(addProduct12);
              stmt.executeUpdate(addProduct13);
              stmt.executeUpdate(addProduct14);
    stmt.executeUpdate(addProduct15);
    stmt.executeUpdate(addProduct16);
    stmt.executeUpdate(addProduct17);
              stmt.executeUpdate(addProduct18);
              stmt.executeUpdate(addProduct19);
              stmt.executeUpdate(addProduct20);
              stmt.executeUpdate(addProduct21);
              stmt.executeUpdate(addProduct22);
              stmt.executeUpdate(addProduct23);
              stmt.executeUpdate(addProduct24);
              stmt.executeUpdate(addProduct25);
              stmt.executeUpdate(addProduct26);
              stmt.executeUpdate(addProduct27);
              stmt.executeUpdate(addProduct28);
              stmt.executeUpdate(addProduct29);
              stmt.executeUpdate(addProduct30);
              stmt.executeUpdate(addProduct31);
              stmt.executeUpdate(addProduct32);
              stmt.executeUpdate(addProduct33);
              stmt.executeUpdate(addProduct34);
              stmt.executeUpdate(addProduct35);
              stmt.executeUpdate(addProduct36);
              stmt.executeUpdate(addProduct37);
              stmt.executeUpdate(addProduct38);
              stmt.executeUpdate(addProduct39);
              stmt.executeUpdate(addProduct40);
              stmt.executeUpdate(addProduct41);
              stmt.executeUpdate(addProduct42);
              stmt.executeUpdate(addProduct43);
              stmt.executeUpdate(addProduct44);
              stmt.executeUpdate(addProduct45);
              stmt.executeUpdate(addProduct46);
              stmt.executeUpdate(addProduct47);
              stmt.executeUpdate(addProduct48);
              stmt.executeUpdate(addProduct49);
              stmt.executeUpdate(addProduct50);
              stmt.executeUpdate(addProduct51);
              stmt.executeUpdate(addProduct52);
              stmt.executeUpdate(addProduct53);
              stmt.executeUpdate(addProduct54);
              stmt.executeUpdate(addProduct55);
              stmt.executeUpdate(addProduct56);
              stmt.executeUpdate(addProduct57);
              stmt.executeUpdate(addProduct58);
              stmt.executeUpdate(addProduct59);
              stmt.executeUpdate(addProduct60);
              stmt.executeUpdate(addProduct61);
              stmt.executeUpdate(addProduct62);
              stmt.executeUpdate(addProduct63);
              stmt.executeUpdate(addProduct64);
              stmt.executeUpdate(addProduct65);
              stmt.executeUpdate(addProduct66);
              stmt.executeUpdate(addProduct67);
              stmt.executeUpdate(addProduct68);
              stmt.executeUpdate(addProduct69);
              stmt.executeUpdate(addProduct70);
              stmt.executeUpdate(addProduct71);
              stmt.executeUpdate(addProduct72);
              stmt.executeUpdate(addProduct73);
              stmt.executeUpdate(addProduct74);
              stmt.executeUpdate(addProduct75);
              stmt.executeUpdate(addProduct76);
              stmt.executeUpdate(addProduct77);
              stmt.executeUpdate(addProduct78);
              stmt.executeUpdate(addProduct79);
              stmt.executeUpdate(addProduct80);
              stmt.executeUpdate(addProduct81);
              stmt.executeUpdate(addProduct82);
              stmt.executeUpdate(addProduct83);
              stmt.executeUpdate(addProduct84);
              stmt.executeUpdate(addProduct85);
              stmt.executeUpdate(addProduct86);
              stmt.executeUpdate(addProduct87);
              stmt.executeUpdate(addProduct88);
              stmt.executeUpdate(addProduct89);
              stmt.executeUpdate(addProduct90);
              stmt.executeUpdate(addProduct91);
              stmt.executeUpdate(addProduct92);
              stmt.executeUpdate(addProduct93);
    stmt.close();
    con.close();
              catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    public static void addMembers(){
    Connection con = getConnection();
    String addMember1, addMember2, addMember3, addMember4, addMember5, addMember6, addMember7, addMember8, addMember9, addMember10;
    addMember1 = "insert into Member values (1234, 'Ann', 'Smyth', 'Upper Killult, Falcarragh, Co. Donegal', '(074)-9135210', '(087)-2030172', #5/11/85#, #5/12/06#)";
    addMember2 = "insert into Member values (2345, 'John', 'Murphy', 'Lower Killult, Falcarragh, Co. Donegal', '(074)-9135211', '(087)-2030173', #4/12/85#, #6/13/06#)";
    addMember3 = "insert into Member values (1324, 'James', 'McFadden', 'Lower Ardsbeg, Gortahork, Co. Donegal', '(074)-9165314', '(087)-2030171', #4/11/85#, #6/14/06#)";
    addMember4 = "insert into Member values (1235, 'Frankie', 'Ferry', 'Ardsmore, Gortahork, Co. Donegal', '(074)-9165325', '(087)-2031234', #6/13/60#, #6/15/06#)";
    addMember5 = "insert into Member values (1236, 'Daniel', 'McKimm', 'Ballyness, Falcarragh, Co. Donegal', '(074)-9135212', '(087)-2030184', #5/14/73#, #6/16/06#)";
    addMember6 = "insert into Member values (2346, 'Stephen', 'Doohan', 'Ballyness, Falcarragh, Co. Donegal', '(074)-9135213', '(087)-2030185', #6/13/85#, #5/13/06#)";
    addMember7 = "insert into Member values (2347, 'James', 'Ferry', 'Meenlaragh, Gortahork, Co.Donegal', '(074)-9165360', '(087)-2031345', #9/12/85#, #5/14/06#)";
    addMember8 = "insert into Member values (2348, 'Liam', 'Cannon', 'Derryconner, Gortahork, Co.Donegal', '(074)-9165324', '(087)-2031456', #4/11/86#, #5/15/06#)";
    addMember9 = "insert into Member values (2401, 'Ciaran', 'Ferry', 'Brinalack, Gweedore, Co.Donegal', '(074)-9176425', '(087)-2030282', #9/12/85#, #5/16/06#)";
    addMember10 = "insert into Member values (2402, 'Ciaran', 'McGee', 'Derrybeg, Gweedore, Co.Donegal', '(074)-9176536', '(087)-2030393', #9/14/85#, #5/18/06#)";
    try {
    stmt = con.createStatement();
    stmt.executeUpdate(addMember1);
    stmt.executeUpdate(addMember2);
    stmt.executeUpdate(addMember3);
                   stmt.executeUpdate(addMember4);
                   stmt.executeUpdate(addMember5);
                   stmt.executeUpdate(addMember6);
                   stmt.executeUpdate(addMember7);
                   stmt.executeUpdate(addMember8);
                   stmt.executeUpdate(addMember9);
                   stmt.executeUpdate(addMember10);
    stmt.close();
    con.close();
              catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
         public static void addRentals(){
    Connection con = getConnection();
    String addRental1, addRental2, addRental3, addRental4, addRental5, addRental6, addRental7, addRental8, addRental9, addRental10;
    addRental1 = "insert into Rental values (110001, 'The Killers - Sams Town', 1234, 'Ann', 'Smyth', #9/01/06#, #9/10/06#, 'Yes', 2.00)";
    addRental2 = "insert into Rental values (120001, 'Mission Impossible 3', 2345, 'John', 'Murphy', #9/02/06#, #9/09/06#, 'No', 0.00)";
    addRental3 = "insert into Rental values (130001, 'Need for Special Carbon', 1324, 'James', 'McFadden', #9/03/06#, #9/12/06#, 'Yes', 2.00)";
    addRental4 = "insert into Rental values (110002, 'Robbie Williams - Rudebox', 1235, 'Frankie', 'Ferry', #9/04/06#, #9/11/06#, 'No', 0.00)";
    addRental5 = "insert into Rental values (120015, 'Prime', 1236, 'Daniel', 'McKimm', #9/05/06#, #9/14/06#, 'Yes', 2.00)";
    addRental6 = "insert into Rental values (130015, 'FIFA 07', 2346, 'Stephen', 'Doohan', #9/06/06#, #9/13/06#, 'No', 0.00)";
    addRental7 = "insert into Rental values (110009, 'Roxette - Roxette hits', 2347, 'James', 'Ferry', #9/07/06#, #9/16/06#, 'Yes', 2.00)";
    addRental8 = "insert into Rental values (120003, 'The Break Up', 2348, 'Liam', 'Cannon', #9/08/06#, #9/15/06#, 'No', 0.00)";
    addRental9 = "insert into Rental values (130027, 'Gears of War', 2401, 'Ciaran', 'Ferry', #9/09/06#, #9/18/06#, 'Yes', 2.00)";
    addRental10 = "insert into Rental values (110021, 'Scooter - Mind the Gap', 2402, 'Ciaran', 'McGee', #9/10/06#, #9/17/06#, 'No', 0.00)";
    try {
    stmt = con.createStatement();
    stmt.executeUpdate(addRental1);
    stmt.executeUpdate(addRental2);
    stmt.executeUpdate(addRental3);
                   stmt.executeUpdate(addRental4);
                   stmt.executeUpdate(addRental5);
                   stmt.executeUpdate(addRental6);
                   stmt.executeUpdate(addRental7);
                   stmt.executeUpdate(addRental8);
                   stmt.executeUpdate(addRental9);
                   stmt.executeUpdate(addRental10);
    stmt.close();
    con.close();
              catch(SQLException ex) {
    System.err.println("SQLException: " + ex.getMessage());
    public Demo(){
    super("Demo Test Frame");
    setSize(350, 200);
    comboBox = new JComboBox();
    comboBox.addItem("jdbc:odbc:VideoLibrary");
    qtm = new QueryTableModel();
    JTable table = new JTable(qtm);
    JScrollPane scrollpane = new JScrollPane(table);
    JPanel p1 = new JPanel();
    p1.setLayout(new GridLayout(3, 2));
    p1.add(comboBox);
    p1.add(new JLabel("Enter your query: "));
    p1.add(queryField = new JTextField());
    p1.add(new JLabel("Click here to send: "));
    JButton jb = new JButton("Search");
    jb.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
    qtm.setHostURL();
    qtm.setQuery(queryField.getText().trim());
    p1.add(jb);
    getContentPane().add(p1, BorderLayout.NORTH);
    getContentPane().add(scrollpane, BorderLayout.CENTER);
    }//end class
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class LogOn extends JPanel{
         private static JTextField username=null;
         private static JPasswordField password=null;
         private static JButton button=null;
    public LogOn(){
              setSize(260,160);
              username=new JTextField(15);
         password=new JPasswordField(15);
              //JPanel pane=new JPanel();
              JLabel usernameLabel=new JLabel("Username: ");
              JLabel passwordLabel=new JLabel("Password: ");
              /*pane.*/add(usernameLabel);
              /*pane.*/add(username);
              /*pane.*/add(passwordLabel);
              /*pane.*/add(password);
              //setContentPane(pane);
              show();
              button=new JButton("Ok");
              add(button);
         button.addActionListener(new ButtonListener());
              JFrame frame=new JFrame("Welcome to Home Entertainment");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         frame.getContentPane().add(new LogOn());
         frame.pack();
         frame.setVisible(true);
         private class ButtonListener implements ActionListener{
         public void actionPerformed(ActionEvent e){
              try{
                        new Demo();
                   catch(Exception ex){}     
    }

    here's the code (again, but it doesn't look as ugly as it did earlier on).
    i have three programs, only 2 of which can interact with each other. QueryTestTable.java is used with Demo.java to display data in a JTable. the third program is called LogOn.java. i want to use the LogOn.java (username and password for logging on to the system) program in order to be able to use the other 2 programs. i have to be able to use these programs next week. thank you very much.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import javax.swing.JOptionPane;
    import java.sql.*;
    public class Demo extends JFrame {
       static String url = "jdbc:odbc:VideoLibrary";
       static Statement stmt;
       static Connection con;
       //declare member variables here
       JTextField hostField;
       JTextField queryField;
       QueryTableModel qtm;
       JComboBox comboBox;
       public static void main(String args[]){
          //new LogOn();
          int choice=-1;
          do{
             choice=getChoice();
             if(choice!=0){
                getSelected(choice);
          }while(choice!=5);
          System.exit(0);
       public static int getChoice(){
          String choice;
          int ch;
          choice = JOptionPane.showInputDialog(null,"1. Maintain product      
          details\n"+"2. Maintain member details\n"+"3. Maintain rental 
          details\n"+"4. View product, member and rental details\n"+"5. Log 
          Off\n\n"+"Enter your choice");
          ch = Integer.parseInt(choice);
          return ch;
       public static void getSelected(int choice){
          if(choice==1){
             addProducts();
          if(choice==2){
             addMembers();
          if(choice==3){
             addRentals();
          if(choice==4){
             Demo test = new Demo();
             test.setVisible(true);
       public static Connection getConnection(){
          try {
             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          catch(java.lang.ClassNotFoundException e) {
             System.err.print("ClassNotFoundException: ");
             System.err.println(e.getMessage());
          try {
             con=DriverManager.getConnection(url,"","");
          catch(SQLException ex) {
             System.err.println("SQLException: " + ex.getMessage());
          return con;
       public static void addProducts(){
          Connection con = getConnection();
          String addProduct1, addProduct2;
          addProduct1 = "insert into Product values (110001, 'The Killers -  
          Sams Town', 5.00, 'G', 'CD', 2006)";
          addProduct2 = "insert into Product values (110002, 'Robbie
          Williams - Rudebox', 5.00, 'G', 'CD', 2006)";
          try {
             stmt = con.createStatement();
             stmt.executeUpdate(addProduct1);
             stmt.executeUpdate(addProduct2);
             stmt.close();
             con.close();
          catch(SQLException ex) {
             System.err.println("SQLException: " + ex.getMessage());
       public static void addMembers(){
          Connection con = getConnection();
          String addMember1, addMember2;
          addMember1 = "insert into Member values  
          (1234, 'Ann', 'Smyth', 'Upper Killult, Falcarragh, Co. Donegal', '(074)-
          9135210', '(087)-2030172', #5/11/85#, #5/12/06#)";
          addMember2 = "insert into Member values
          (2345, 'John', 'Murphy', 'Lower Killult, Falcarragh, Co.
          Donegal', '(074)-9135211', '(087)-2030173', #4/12/85#, #6/13/06#)";
          try {
             stmt = con.createStatement();
             stmt.executeUpdate(addMember1);
             stmt.executeUpdate(addMember2);
             stmt.close();
             con.close();
          catch(SQLException ex) {
             System.err.println("SQLException: " + ex.getMessage());
       public static void addRentals(){
          Connection con = getConnection();
          String addRental1, addRental2;
          addRental1 = "insert into Rental values (110001, 'The Killers - 
          Sams Town', 1234, 'Ann', 'Smyth', #9/01/06#, #9/10/06#, 'Yes', 2.00)";
          addRental2 = "insert into Rental values (120001, 'Mission
          Impossible 3', 2345, 'John', 'Murphy', #9/02/06#, #9/09/06#, 'No',
          0.00)";
          try {
             stmt = con.createStatement();
             stmt.executeUpdate(addRental1);
             stmt.executeUpdate(addRental2);
             stmt.close();
             con.close();
          catch(SQLException ex) {
             System.err.println("SQLException: " + ex.getMessage());
       public Demo(){
          super("Demo Test Frame");
          setSize(350, 200);
          comboBox = new JComboBox();
          comboBox.addItem("jdbc:odbc:VideoLibrary");
          qtm = new QueryTableModel();
          JTable table = new JTable(qtm);
          JScrollPane scrollpane = new JScrollPane(table);
          JPanel p1 = new JPanel();
          p1.setLayout(new GridLayout(3, 2));
          p1.add(comboBox);
          p1.add(new JLabel("Enter your query: "));
          p1.add(queryField = new JTextField());
          p1.add(new JLabel("Click here to send: "));
          JButton jb = new JButton("Search");
          jb.addActionListener(new ActionListener(){
                public void actionPerformed(ActionEvent e){
                      qtm.setHostURL();
                      qtm.setQuery(queryField.getText().trim());
          p1.add(jb);
          getContentPane().add(p1, BorderLayout.NORTH);
          getContentPane().add(scrollpane, BorderLayout.CENTER);
    }//end class
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class LogOn extends JPanel{
       private static JTextField username=null;
       private static JPasswordField password=null;
       private static JButton button=null;
       public LogOn(){
          setSize(260,160);
          username=new JTextField(15);
          password=new JPasswordField(15);
          //JPanel pane=new JPanel();
          JLabel usernameLabel=new JLabel("Username: ");
          JLabel passwordLabel=new JLabel("Password: ");
          /*pane.*/add(usernameLabel);
          /*pane.*/add(username);
          /*pane.*/add(passwordLabel);
          /*pane.*/add(password);
          //setContentPane(pane);
          show();
          button=new JButton("Ok");
          add(button);
          button.addActionListener(new ButtonListener());
          JFrame frame=new JFrame("Welcome to Home Entertainment");
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.getContentPane().add(new LogOn());
          frame.pack();
          frame.setVisible(true);
       private class ButtonListener implements ActionListener{
          public void actionPerformed(ActionEvent e){
             try{
                new Demo();
             catch(Exception ex){}
    import java.sql.*;
    import java.io.*;
    import java.util.Vector;
    import javax.swing.*;
    import javax.swing.table.*;
    public class QueryTableModel extends AbstractTableModel{
       Vector cache; 
       int colCount;
       String[] headers;
       Connection db;
       Statement statement;
       String currentURL;
       public QueryTableModel(){
          cache=new Vector();
          try{
             Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          catch(Exception e){
             System.out.println("problem loading the driver ");
       public String getColumnName(int i){
          return headers;
    public int getColumnCount(){
    return colCount;
    public int getRowCount(){
    return cache.size();
    public Object getValueAt(int row, int col){
    return ((String[])cache.elementAt(row))[col];
    public void setHostURL(){
    String url = "jdbc:odbc:VideoLibrary";
    closeDB();
    try{
    db=DriverManager.getConnection(url,"","");
    statement=db.createStatement();
    catch(Exception e){
    System.out.println("Could not initialize the database.");
    e.printStackTrace();
    public void setQuery(String q){
    cache=new Vector();
    String s="select * from Product";
    try{
    ResultSet rs=statement.executeQuery(q);
    ResultSetMetaData meta=rs.getMetaData();
    colCount=meta.getColumnCount();
    headers=new String[colCount];
    for(int h=1;h<=colCount;h++){
    headers[h-1]=meta.getColumnName(h);
    while(rs.next()){
    String[] record=new String[colCount];
    for(int i=0;i<colCount;i++){
    record[i]=rs.getString(i+1);
    cache.addElement(record);
    fireTableChanged(null);
    catch(Exception e){
    cache=new Vector();
    e.printStackTrace();
    public void initDB(String url){
    try{
    db=DriverManager.getConnection(url);
    statement=db.createStatement();
    catch(Exception e){
    System.out.println("Could not initialize the database.");
    e.printStackTrace();
    public void closeDB(){
    try{
    if(statement!=null){
    statement.close();
    if(db!=null){
    db.close();
    catch(Exception e){
    System.out.println("Could not close the current connection.");
    e.printStackTrace();

  • Swing related question wrongly posted in the JDBC forum

    The OP needs some sort of dynamic table model. He does not seem to understand the difference between JDBC and Swing so I am not hopeful for an easy resolution.
    The table model used appears to be static so it is not wonder that the new rows are not visible.
    I asked the OP to post their questiopn in here several times so far but it seems rather hopeless. Perhaps someone here can help.
    http://forum.java.sun.com/thread.jspa?threadID=699957&tstart=0

    If you have CC you get Edge and you are free to use it any DPS work you do, including Single Edition.
    Bob

  • JDBC-ODBC Bridge, Swing Components

    This program displays information from the Access database Autos.mdb.
    Uses the JDBC-ODBC Bridge.
    Requires a DSN called Autos pointing to Auto.mdb
    I am using the swing components and can't seem to set up my combobox to pull the right data which doesn't display any of the data from the database. I am able to do it using AWT but would like a sleeker look so I am trying to convert. I have made the text bold where I am having the problem. Any insight would be greatful! I am very new to JDBC-ODBC so please go easy on me...
    import java.sql.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class JDBCApp extends Frame implements ItemListener
         //Declare database variables
         Connection conVehicle;
         Statement cmdVehicle;
         ResultSet rsVehicle;
         boolean blnSuccessfulOpen = false;
         //Declare components
         JComboBox lstManuf   = new JComboBox();
         JLabel lblModel  = new JLabel("                          ");
         JLabel lblYear        = new JLabel("                          ");
         JLabel lblCost      = new JLabel("                          ");
         JLabel lblID      = new JLabel("                              ");
         JLabel lblInstructions = new JLabel("Select Manufacturer to Display Record");
         public static void main(String args[])
              //Declare an instance of this application
              JDBCApp thisApp = new JDBCApp();
              thisApp.createInterface();
         public void createInterface()
              //Load the database and set up the frame
              loadDatabase();
              if (blnSuccessfulOpen)
                   setTitle("Display Auto's Database");
                   addWindowListener(new WindowAdapter()
                             public void windowClosing(WindowEvent event)
                                  stop();
                                  System.exit(0);
                   setLayout(new FlowLayout());
                   add(new JLabel("Manufacturer"));
                   add(lstManuf);
                   lstManuf.addItemListener(this);
                   add(lblInstructions);
                   add(new JLabel("Model"));
                   add(lblModel);
                   add(new JLabel("Year"));
                   add(lblYear);
                   add(new JLabel("Cost"));
                   add(lblCost);
                   add(new JLabel("Vehicle Identification"));
                   add(lblID);
                   setSize(300,300);
                   setVisible(true);
              else
                   stop();             //Close any open connection
                   System.exit(-1);    //Exit with error status
              public void loadDatabase()
                   try
                        //Load the MicroSoft drivers
                        Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
                   catch (ClassNotFoundException err)
                             //No drivers found
                             System.err.println("Driver did not load properly");
                   try
                        //Connect to the database
                        conVehicle = DriverManager.getConnection("jdbc:odbc:Auto");
                        //Create a ResultSet
                        cmdVehicle = conVehicle.createStatement();
                        rsVehicle = cmdVehicle.executeQuery(
                                            "Select * from Vehicle;");
                        loadNames(rsVehicle);
                        blnSuccessfulOpen = true;
                   catch(SQLException error)
                        System.err.println("Error: " + error.toString());
         public void loadNames(ResultSet rsVehicle)
              try
                   //Fill last name list box
                   while(rsVehicle.next())
                   lstManuf.addItem(rsVehicle.getString("Manufacturer"));
              catch (SQLException error)
                   System.err.println("Error in display record");
         public void itemStateChanged(ItemEvent event)
              //Display the selected record
              lblInstructions.setText("");          String strManufName = lstManuf.getText();
              try
                   Statement cmdVehicle = conVehicle.createStatement();
                   ResultSet rsVehicle = cmdVehicle.executeQuery(
                        "Select * from Vehicle where [Manufacturer] = '" + strManufName + "';");
                   DisplayRecord(rsVehicle);
              catch(SQLException error)
                   System.err.println("Error in recordset");
          public void DisplayRecord(ResultSet rsVehicle)
               try
                   //Display information
                   if(rsVehicle.next()) //If more records remain
                        lblModel.setText(rsVehicle.getString("ModelName"));
                        lblYear.setText(rsVehicle.getString("Year"));
                        lblCost.setText(rsVehicle.getString("CostValue"));
                        lblID.setText(rsVehicle.getString("VehicleID"));
                   else
                        System.err.println("No more records");
              catch (SQLException error)
                   System.err.println("Error in display record");
         public void stop()
              try
                   //Terminate the connection
                   if (conVehicle != null)
                        conVehicle.close();
              catch(SQLException error)
                   System.err.println("Unable to disconnect");
    }

    I am going to help you out but first I would like to advise you not to do this.
    Mixing JDBC and Swing (or any GUI for that matter) like this is not the preferred way to proceed. If you want to learn JDBC then command line/shell is fine. If you want to learn Swing learn Swing. When you want to use the two together learn about MVC first.
    I am advising you to do this because nobody writes code like this (mixing GUI and database and business logic all in one class). So if you want real world training MVC should be what you look at next.
    See http://en.wikipedia.org/wiki/Model-view-controller for more
    As near as I can tell your problem is mostly just because you aren't using the combo box correctly. Try
    String strManufName = lstManuf.getSelectedItem().toString();it's a bit of a hack but will work for your purposes. What you need in the eend is to use the methods JComboxBox has like getSelectedItem() or getSelectedIndex().
    See http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html for more.
    Some other comments.
    1) It's nice to see you aren't just swallowing exceptions but some of them are kind of pointless if you just continue on. Like here
    try
      //Load the MicroSoft drivers
      Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
    catch (ClassNotFoundException err)
      //No drivers found
      System.err.println("Driver did not load properly");
    }And then you continue on with the method. What for? There's no point since the driver didn't load.
    2) Please look into the use of PreparedStatements. Very good things those. You can use them in place of your Statements. They are safer but for your purposes help you by you not having to worry about the formatting of data you bind to queries. For example what happens if a manufacturer name contains a ' (single quote) ? Trouble that's what. PreparedStatements make that problem go away.
    3) Don't use SELECT *. It is always good practice to put the names of the columns you are selecting. This prevents your code from breaking if the order of the columns should change in any way.

  • Coding Swing Applications with Large JDBC ResultSets

    Hi,
    Does anyone know where I can find information regarding efficient ways to code Swing UI's with large JDBC result sets. I have been using JTextArea but my application seems to constantly run out of memory when I encounter a large result set. Also, any information regarding threading and if running database queries should be done entirely off the event thread vs SwingUtilities.invokeLater() would be of tremendous help.
    Thanks,
    John Meah

    If doing operations in the awt thread starts to impair the performance of your app, then create a new class that implements Runnable, and do this:
    Thread t = new Thread (new yourRunnable());
    t.start();
    t should have lower priority than the AWT thread.
    As far as large result sets, it is a fairly universal problem. My recommendation is that you arbitrarily impose a limit on how many of the records returned are displayed, like maybe 25 records. This should fix your problem

  • Swing - Jdbc Components

    Hi friends.
    I'm newer in Java, and i'm searching for 3er party components (comercial or free), that connects swing with jdbc (for example, one tablemodel that connects with jdbc for read and write).
    Thank you.

    Hi friends.
    I'm newer in Java, and i'm searching for 3er party
    components (comercial or free), that connects swing
    with jdbc (for example, one tablemodel that connects
    with jdbc for read and write).
    Thank you.Please see http://forum.java.sun.com/thread.jspa?threadID=5123381
    Edit: Hey Stupid! That thread is yours. Cripes how stupid can you get....

  • Crystal Report for Eclipse - Java SWING - JDBC Examples?

    <p>Good day! I am just a newbie in Java Programming and I am wondering if there is an example application in SWING-JDBC w/reports that uses Crystal reports w/ Eclipse IDE. As what I have noticed, all of the examples I have seen here are all in jsp and I havent seen anything for swing-jdbc only. I want to try using crystal reports in java. </p><p>&#160;</p><p>Do you guys have some examples (even a very simple one) that uses crystal reports with Eclipse and even with a simple database like Access? Any sample, tutorial downloads with this topic? hope you guys can help. thank you very much and God bless.</p>

    Crystal Reports doesn't have the same niece tooling for desktop/swing applications that it does for JSP/Web applications. That said you can still create reports with CR4Eclipse and use them in a Swing applications. Try out these samples that I posted. They are all desktop/swing applications. These will work with Eclipse.
    [http://diamond.businessobjects.com/node/707 | /node/707]
    [http://diamond.businessobjects.com/node/335 | /node/335]
    Hopefully this is helpful.
    Rob Horne
    Rob's blog - http://diamond.businessobjects.com/blog/10</p>

  • How use jdbc with swing ? i am new in this concept.

    hi
    freinds,
    i am new in java can any one give the example which explain the how to use jdbc with swing.
    thanks in advace.
    satish
    thanks.

    See here  >  http://support.apple.com/kb/HT4236
    More info in the User Guides for your Devices...

  • Oracle JDBC and Swing Applets

    Hi
    I'm trying yo connect to an oracle databse using the oracle thin driver
    in a Swing Applet deriving from JApplet class using a JTable .
    Note my browser is Swing enabled and i can view normal swing applets.
    But i get an error which says
    Oracle/jdbc/driver/oracel/driver not found
    But if i run this as an application instead of a swing applet it works
    Remember it's a Swing Applet not a normal Applet.and the oracle driver works in a normal application.this error occurs only when the oracle driver is used in a Swing Applet.
    any ideas?
    mail me at [email protected]
    '**********************Heres the code************************
    import java.sql.*;
    import java.lang.*;
    import java.awt.*;
    import java.applet.Applet;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    <applet code =testdata.class width=300 height=300></applet>
    class databaseconnect{
    public Connection conn;
    public ResultSet rs;
    databaseconnect(){}
         public void connect(){
              try{
              DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());     
              conn = DriverManager.getConnection("jdbc:oracle:thin:@theserver:1521:dbase", "un", "pw");
              }catch(SQLException e) { }
         public ResultSet getdata(){
              try{
              Statement st = conn.createStatement();
              rs = st.executeQuery("select * from tt");
              }catch (SQLException e) { }
         return rs;
    class toggledata{
    static ResultSet rs;
    static String s,r;
    //public static void main(String args[]){
    databaseconnect data = new databaseconnect();
    public String makestr(){
         s = "1";
         r = "1";
         try{
         data.connect();
         rs = data.getdata();
              while(rs.next()){
                   s = s + "," + rs.getString(1);
                   r = r + " " + rs.getString(2);
         }catch (SQLException e) {}
         //System.out.println(s);
         //System.out.println(r);
    return s;
    public class testdata extends JApplet{
    int d,cont,y;
    String t;
    char n,m;
    int c;
    Object h;
    //public testdata(){
    public void init(){
         //super("My First Oracle Application");
         cont = 0;
         y=1;
         h = ",";
         //colstr e = new colstr();
         toggledata f = new toggledata();
         String rs = new String(f.makestr());
         Object [][] data = new Object [1][15];
         char chars [] = rs.toCharArray();
         for(int x=0; x<15; x++){
              data [0][cont] = new Integer(chars[x]);
              cont = cont + 1;
         String [] col ={"a","b","c","d","e","f","g","h","i","f","g","h","i","j","k"};
         final JTable table = new JTable(data, col);
         table.setPreferredScrollableViewportSize(new Dimension(500, 70));
         JScrollPane scrollPane = new JScrollPane(table);
         getContentPane().add(scrollPane, BorderLayout.CENTER);
    //public static void main(String args []){
    //     testdata g = new testdata();
    //     g.pack();
    //     g.setVisible(true);
    Thanks

    continued...
    I re-read your problem , your problem is as same as me.
    So, unzip classes12.zip oy folder /htdocs/ on your server
    , when this file is unziped it will create the necessary
    folders and files so your program will find the drivers
    classes and I think your problem is solved.
    Thanks Jamanir

  • Using swings to connect jdbc

    Iam new to java.plz help me to connect jdbc with GUI components.While connecting i have problems .Do anyone have the program plz forward to my [email protected]

    [url http://java.sun.com/docs/books/tutorial/]JDBC Database Access

  • JDBC with Swing ?

    Hi,
    I want to build a Java application that accesses an Oracle database. I want the fields of that form (JTextField) to be somehow "assocated" to the database's table so that whenever I update the field all I have to do is a save (or commit).
    I know Borland has a bunch of tools like that (com.borland.dx.dataset), but I want to stay away from that Borland-specific stuff.
    Is that possible to do with the Rowset Implementation ? Do I need something else ?
    Thanks !

    Here is what I mean :
    Let say you have a JFrame with a few JTextFields and JCheckBox, and you want to have a simple query returning the results into those fields.
    Then, after modifying the value of those fields, you want to click on Save.
    Is there a way to show the query data in those fields and "post" the changes without saying : JTextField value goes to that table column, etc.
    Something like :
      jtextfield1.assignToTable("MYTABLE");
      jtextfield1.assignToColumn("PRODUCT_ID");And whenever I update or requery this database table, the associated fields would get populated automatically.
    Regards,
    Alexandre

Maybe you are looking for

  • HELP - AA7 upgrade to 7.1.0

    I've an annoying problem... with AA7, that is! Every time I restart my laptop (Vista HP) I get the windows installer pop-up for the Acrobat 7.1.0 upgrade which will not run - it just stops with an error (can't remember exactly which one, at present -

  • [JS][CS3] Change the content type of a text frame

    Hi, a bit basic maybe but I'm stuck on this from an hour... I need a textFrame to become a graphic object. The textFrame has no content. How can I change the contentType on that object? Thanks anticipately.

  • How to pass a value from jspx page to the managed bean

    hi, i have created a jspx page and manages bean with page flow scope.. in my jspx page i am searching a employee record from the data base . and getting entire employee details including 'status' as a search result. here i want to pass the value of '

  • Create 3d cel animation look after effects

    Im trying to achieve this look for a project I am working on. (Link below), The artist said that they only used after effects for all the cube animations, and was wondering if anybody new a tutorial or guide that would help with best way to acieve th

  • Validation of PO / Transportations lane

    Hi My question is, is it possible to validate the PO and the validity of the transportations lane, not by the delivery date of the PO but validate the creation day instead, a lot of our purchased product have a lead time of more than ½ year, so it is