• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jdbc problem

 
Abed Rabie
Ranch Hand
Posts: 74
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I face a problem in jdbc.
The problem is : I have a JComboBox that i want to fill it with the database sources that exist in the ODBC DataSources in the administrative tools.
So please inform me how can i write the code that enable me to get all the DataSources from the odbc and filling them into the JcomboBox.
Thx alot for ur help
LOLO
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64205
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Abed, no one here will do your work for you. What you will need to do is to at least make an attempt to write the code yourself. Then you can post here with any problems you are having getting it to work.
bear
Forum Bartender
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This might help you:
How to ask questions the right way
And I guess you're a beginner. So errors are accepted. But don't email questions like this one again. The next time you aren't a beginner anymore.
Instead of begging for pardon, read the article.
You're welcome.
 
Abed Rabie
Ranch Hand
Posts: 74
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
I'm not like you to tell me the code i'm just want to know the start point of the road.
I mean the classes that may help me doing this task.
Thx for help
Aabed
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aabed,
Allow me to suggest the following "starting points":
  • "How to Use Combo Boxes" lesson in the Java Tutorial
  • "JDBC(TM) Database Access" trail of the Java Tutorial


  • Good Luck,
    Avi.
     
    Abed Rabie
    Ranch Hand
    Posts: 74
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Dear All,

    Once i need to connect to any database we write down the following:

    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver" );
    Connection con=DriverManager.getConnection("jdbc dbc:myDatabaseName","sa","");

    Statement stat=con.createStatement();

    // then we make the query statement here

    what i need is not to connect to certain database in my System DSN but i need to get all the database names from within my system DSN.

    I think to use the URL class. But i don't get any acurate vision.

    If you can't help me tell me cause i don't like to disturbe you any more.

    Best reagrds

    Aabed
     
    Blake Minghelli
    Ranch Hand
    Posts: 331
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I don't think the other posters understood what you are asking for. Abed is not asking for help on "how to use JComboBox" or "how to use JDBC", rather he is asking this:
    How do you find all of the ODBC data sources that are configured on a Windows PC?

    It sounds like Abed wants to be able to get a list of DSN's from the PC and display them in a combobox so the user can pick one. But how do you get that list using Java?

    I don't know the answer but I thought it might help if I re-worded your question. Since this is specific to Windows, you may have to use a native library to get that info.

    Abed just needs a starting point, e.g. "check out this API XXX" or "there is a tool called XXX that can help you". Anyone have any experience with this?
     
    Jeanne Boyarsky
    author & internet detective
    Marshal
    Posts: 33713
    316
    Eclipse IDE Java VI Editor
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I don't know of any way to get a list of databases on a machine. It's possible to list all the tables in a database, but I don't think you can list the databases on a machine.

    What are you trying to do with this information? Maybe there is another way to accomplish it.
     
    Abed Rabie
    Ranch Hand
    Posts: 74
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Dear all,

    I find a solution but it's not so good from my point of view. I get all the database names that exist on the sql server path and listed them in my combobox but this is a bad way cause if anyone change this path, i will not be able to get any DSN.


    waitting for your reply

    best regards

    Aabed
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic