package jsupport.com.db;

import java.sql.Connection;
import java.sql.DriverManager;javascript:void(0)
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Jsupport
 */
public class AccessDatabaseConnection {

    public static Connection connect() {

        Connection con;
        try {

            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=Data.mdb;";
            con = DriverManager.getConnection(database, "Admin", "64");

        } catch (Exception ex) {
            return null;
        }
        return con;
    }

    public void getData(){

        try {

            Statement stmt = connect().createStatement();
            ResultSet rset = stmt.executeQuery("SELECT * FROM tblData");

            if (rset.next()) {

                String name     = rset.getString("user_name");
                String email    = rset.getString("user_email");

                System.out.println("Name  : " +name +"  Email : "+email);
            }

        } catch (SQLException ex) {

        }
    }

    public static void main(String[] args) {
        new AccessDatabaseConnection().getData();
    }
}
Access Database table
 
 
      Data.mdb
 
 



Advertisements
Comments
  1. Guillermo Rurup says:

    I still can not quite feel that I could become one of those reading through the important guidelines found on your website. My family and I are truly thankful for your generosity and for presenting me the chance to pursue my personal chosen profession path. Thank you for the important information I acquired from your site.

  2. etupakka says:

    I like this post, enjoyed this one appreciate it for posting .

  3. certified nursing assistant exam says:

    I think other website proprietors should take this website as an model, very clean and great user friendly style and design, let alone the content. You are an expert in this topic!

  4. music licensing agencies says:

    I believe this web site contains some rattling good information for everyone :D. “The ground that a good man treads is hallowed.” by Johann von Goethe.

  5. teething rash says:

    I like your writing style really enjoying this web site. “Sometimes a scream is better than a thesis.” by Ralph Waldo Emerson.

  6. Samuel Venturella says:

    Thank you for some other excellent article. The place else may anyone get that kind of information in such an ideal method of writing? I’ve a presentation subsequent week, and I’m on the look for such information.

  7. A powerful share, I just given this onto a colleague who was doing somewhat evaluation on this. And he in actual fact purchased me breakfast because I located it for him.. smile. So let me reword that: Thnx for the deal with! But yeah Thnkx for spending the time to discuss this, I feel strongly about it and adore reading extra on this subject. If possible, as you turn into expertise, would you thoughts updating your weblog with extra particulars? It is highly useful for me. Big thumb up for this weblog put up!

  8. basketball sleeveless t shirts says:

    Good day! This is kind of off topic but I need some help from an established blog. Is it difficult to set up your own blog? I’m not very techincal but I can figure things out pretty quick. I’m thinking about setting up my own but I’m not sure where to begin. Do you have any points or suggestions? With thanks

  9. cheap vacation ideas says:

    I take pleasure in, lead to I discovered exactly what I used to be having a look for. You’ve ended my 4 day long hunt! God Bless you man. Have a nice day. Bye

  10. seo backlink building says:

    I was basically interested in learning if you ever considered moving over the layout of your website? Its well written, I love what you have got to say. But maybe you may add a a bit more in the way of content so folks might connect to it better.

  11. music publishing and licensing says:

    I would like to thnkx for the efforts you have put in writing this web site. I am hoping the same high-grade site post from you in the upcoming as well. In fact your creative writing abilities has encouraged me to get my own site now. Really the blogging is spreading its wings fast. Your write up is a great example of it.

  12. mastering music says:

    Simply wanna input on few general things, The website style and design is perfect, the subject material is real good. “To the artist there is never anything ugly in nature.” by Franois Auguste Ren Rodin.

  13. raising water san jose says:

    Hi there! Would you mind if I share your blog with my zynga group? There’s a lot of people that I think would really appreciate your content. Please let me know. Many thanks

  14. dj equipment las vegas nv says:

    Hello! Do you know if they make any plugins to assist with SEO? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good gains. If you know of any please share. Appreciate it!

  15. Otis Job says:

    Yeah bookmaking this wasn’t a high risk determination great post! .

  16. Scrapebox says:

    Enjoyed reading this, very good stuff, thanks .

  17. hiring a crane says:

    Nice read, I just passed this onto a colleague who was doing a little research on that. And he actually bought me lunch because I found it for him smile Thus let me rephrase that: Thank you for lunch! “They may forget what you said, but they will never forget how you made them feel.” by Carl W. Buechner.

  18. four micro onde says:

    I believe you have mentioned some very interesting points , thanks for the post.

  19. colleges with nursing programs says:

    I would like to thnkx for the efforts you have put in writing this blog. I’m hoping the same high-grade site post from you in the upcoming as well. In fact your creative writing abilities has encouraged me to get my own web site now. Actually the blogging is spreading its wings quickly. Your write up is a great example of it.

  20. link building strategies and link baiting says:

    Very interesting topic, thanks for posting.

  21. credit card consolidation says:

    I’ve been exploring for a little for any high-quality articles or weblog posts in this sort of space . Exploring in Yahoo I ultimately stumbled upon this web site. Studying this info So i am glad to exhibit that I’ve an incredibly just right uncanny feeling I discovered just what I needed. I so much definitely will make sure to do not put out of your mind this website and provides it a glance on a constant basis.

  22. Augustine says:

    I consider something truly special in this site.

  23. california media solutions contact says:

    Heya! I realize this is sort of off-topic but I needed to ask. Does managing a well-established blog such as yours require a lot of work? I’m completely new to blogging but I do write in my journal every day. I’d like to start a blog so I will be able to share my own experience and thoughts online. Please let me know if you have any kind of ideas or tips for new aspiring bloggers. Thankyou!

  24. we are fans says:

    really enjoyed what that you simply wrote actually. truly isnt so simple to uncover great text to read (you already know.. READ not just looking at it like some zombie before you head to yet another post just to ignore), so cheers mate for really not wasting any one time! :p

  25. Regena says:

    I like this site very much so much good info.

  26. credit card holder says:

    hello!,I love your writing so so much! percentage we communicate more about your post on AOL? I need a specialist on this house to resolve my problem. May be that’s you! Taking a look ahead to see you.

  27. Rupert Baab says:

    Very good information can be found on website . “Wealth may be an ancient thing, for it means power, it means leisure, it means liberty.” by James Russell Lowell.

  28. Blog Indexer says:

    I was reading some of your articles on this website and I conceive this website is real informative! Keep putting up.

  29. credit card holder says:

    Wow! This can be one particular of the most useful blogs We’ve ever arrive across on this subject. Actually Great. I am also an expert in this topic therefore I can understand your hard work.

  30. blackjack game for free says:

    Some truly good content on this site, appreciate it for contribution. “A liar should have a good memory.” by Quintilian.

  31. free blackjack says:

    Regards for helping out, good info .

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s