Results 1 to 8 of 8
  1. #1
    pbaudru is offline Member
    Join Date
    Jan 2010
    Location
    Athus - Belgium
    Posts
    23
    Rep Power
    0

    Smile Bata Base connection failled

    Hi All,

    I'm new here and also new as a JAVA developer.

    Well, I'm writting my first JAVA application that is very simple cause it's composed by an Interface(JFrame) with a JList and some criteria fields. I have now to populate this JList reading data on database.
    Now I'm trying to connect to the SQL server 2005 express edition database but I've got the following error messages:

    java.sql.SQLException: No suitable driver found for jdbc.odbc.eureka
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at recheureka2.actionPerformed(recheureka2.java:392)
    at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
    at javax.swing.AbstractButton$Handler.actionPerformed (Unknown Source)
    at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(Unknown Source)
    at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent( Unknown Source)
    at java.awt.LightweightDispatcher.processMouseEvent(U nknown Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)


    Here is my code related to database connection:

    //DATABASE
    String dbUrl = "jdbc.odbc.eureka";
    //String dbUrl = "PC346519167106/SQLEXPRESS";
    String user = "PC346519167106/Patricia e Pierre";
    String password = "";
    //Class.forName = ("sun.jdbc.odbc.JdbcOdbcDriver");
    try {
    //Connection sur une autre machine
    //jdbc:rmi://192.xxx.xxx.xxx:1099/jdbc.cloudspace:db
    @SuppressWarnings("unused")
    Connection con = DriverManager.getConnection(dbUrl, user, password);
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery("SELECT NOM, PRENOM FROM CANDIDAT WHERE MOT_CLES_1 = 'COOLGEN'; ");
    while (rs.next()) {
    String nom = rs.getString("nom");
    String prenom = rs.getString("prenom"); }
    EFfiltre4.setText( rs.getString("nom"));
    EFfiltre5.setText( rs.getString("prenom"));
    }
    catch (SQLException e)
    {
    // TODO Auto-generated catch block
    EFfiltre4.setText("erreur");
    EFfiltre5.setText("error");
    e.printStackTrace();
    }



    Could you please help me guys ?

    Best regards.

    Pierre.
    Last edited by pbaudru; 01-19-2010 at 09:56 AM.

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Get the MSServer JDBC driver and use it instead of using odbc.
    You will need to add it to the classpath and find out what the connections string should look like for the connection.

  3. #3
    pbaudru is offline Member
    Join Date
    Jan 2010
    Location
    Athus - Belgium
    Posts
    23
    Rep Power
    0

    Default

    Hi 035198x,
    Thanks for your message !
    Well, I copied SQLJDBC file in the LIB folder bellow(I think SQLJDBC is the driver right ?):
    C:\Documents and Settings\Patricia e Pierre\Mes documents\Java\Eclipse\eclipse-java-galileo-SR1-win32\eclipse\plugins\org.apache.ant_1.7.1.v200901 20-1145\lib

    I'm not sure if this folder is the right place to put SQLJDBC file.

    I also changed the classpath to(including folder path when copied SQLJDBC file):
    .;C:\Program Files\Java\jre1.5.0_02\lib\ext\QTJava.zip;C:\Docum ents and Settings\Patricia e Pierre\Mes documents\Java\Eclipse\eclipse-java-galileo-SR1-win32\eclipse\plugins\org.apache.ant_1.7.1.v200901 20-1145\lib

    Do you have any suggeston about where to copy the SQLJDBC file ?

    Regards, Pierre.

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Put it in a lib directory in under your project's main directory. Don't put it into eclipse's folders.
    If you are using eclipse then you need to add it to your project's build path as well.
    Don't forget to update your code to use that driver instead of odbc and check what the right connection string should look like at ConnectionStrings.com - Forgot that connection string? Get it here!

  5. #5
    pbaudru is offline Member
    Join Date
    Jan 2010
    Location
    Athus - Belgium
    Posts
    23
    Rep Power
    0

    Smile

    Thanks again for your help :)

    I'm not sure i've found the correct folder for my project...

    On Eclipse project properties i have this path:

    C:\Documents and Settings\Patricia e Pierre\Mes documents\Java\Eclipse\RECHERCHE CANDIDAT EUREKA

    So I copied the file inside this folder......but still have the same erros....

    In the code I use this :
    String dbUrl = "sqljdbc.eureka";
    and
    String dbUrl = "jdbc.sqljdbc.eureka";

    But same erros too....

    I'm lost man....:(

    What do you suggest please ?

    Regards, Pierre.

  6. #6
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Did you go to connectionstrings.com to find out what the connection string should look like?
    Also a JDBC tutorial is not a bad thing to go through at this stage.

    P.S You typed Bata instead of Data in the thread title. I know a shoe company called Bata so I thought you were struggling to connect with their shoe manufactuing base.

  7. #7
    pbaudru is offline Member
    Join Date
    Jan 2010
    Location
    Athus - Belgium
    Posts
    23
    Rep Power
    0

    Default

    I visited the link you've sent me, thanks again man !

    I also got a JDBC tutorial....I will read all this one...:O)

    On the list of connections strings i can't find one related to SQLJDBC....so i think I have to use a NATIVE one right ?
    Sorry to ask a lot....I'm realy new on JAVA.....

    Yes, it would be DATA BASE and not BATA BASE....sorry...

    Regards, Pierre.

  8. #8
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Read the tutorial. It also explains the types of drivers and which one you should use when.

Similar Threads

  1. base conversion (large)
    By billymac00 in forum New To Java
    Replies: 1
    Last Post: 04-07-2009, 06:56 PM
  2. How to find logarithm base 2 value in java
    By RJNARESH in forum Advanced Java
    Replies: 5
    Last Post: 03-19-2009, 11:12 PM
  3. [SOLVED] Base conversions
    By rlzyoner in forum New To Java
    Replies: 3
    Last Post: 12-10-2008, 01:40 PM
  4. 2 threads sharing a data base connection
    By Ed in forum Advanced Java
    Replies: 2
    Last Post: 07-04-2007, 05:41 AM
  5. Connection to data base
    By Daniel in forum JDBC
    Replies: 2
    Last Post: 06-07-2007, 05:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •