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: Database in a standalone computer

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Database in a standalone computer

    How do Java store a few data to a database in a computer that is not connected to any server, MySQL database or network connection, and how is the code to connect with it?.
    Last edited by Abednego Setyawan; March 11th, 2010 at 10:16 PM.


  2. #2
    Junior Member
    Join Date
    Apr 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Database in a standalone computer

    I think This is your answer

    try
    {
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          Connection con = DriverManager.getConnection("jdbc:odbc:dsn1");
          Statement stat = con.createStatement();
          Resultset rs = stat.executeQuery("select * from table");
     
          rs.close();
         stat.close();
         con.close();
    }
    catch(Exception e)
    {
     
    }

    to create dsn go to Control Panel->Administrator tools->ODBC->Second tab->Add->button and create dsn
    here d[/quote]
    Last edited by Freaky Chris; April 8th, 2010 at 07:33 AM. Reason: Added code tags

Similar Threads

  1. Funny computer and office related cartoons
    By Flash in forum The Cafe
    Replies: 6
    Last Post: April 9th, 2010, 05:13 AM
  2. Database? How-To...
    By DeMolay8613 in forum JDBC & Databases
    Replies: 2
    Last Post: November 24th, 2009, 12:37 PM
  3. updating database
    By gurpreetm13 in forum JDBC & Databases
    Replies: 3
    Last Post: October 9th, 2009, 12:43 PM
  4. Code wise working of Computer Algebra Systems
    By helloworld922 in forum Java Theory & Questions
    Replies: 1
    Last Post: July 7th, 2009, 08:45 AM
  5. Desktop Database Application
    By TCoomer in forum JDBC & Databases
    Replies: 2
    Last Post: June 4th, 2009, 04:51 PM