Results 1 to 8 of 8
Thread: Bata Base connection failled
- 01-19-2010, 09:43 AM #1
Member
- Join Date
- Jan 2010
- Location
- Athus - Belgium
- Posts
- 23
- Rep Power
- 0
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.
- 01-19-2010, 09:51 AM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 13
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.
- 01-19-2010, 10:01 AM #3
Member
- Join Date
- Jan 2010
- Location
- Athus - Belgium
- Posts
- 23
- Rep Power
- 0
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.
- 01-19-2010, 10:54 AM #4
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 13
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!
- 01-19-2010, 12:57 PM #5
Member
- Join Date
- Jan 2010
- Location
- Athus - Belgium
- Posts
- 23
- Rep Power
- 0
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.
- 01-19-2010, 01:06 PM #6
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 13
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.
- 01-20-2010, 11:31 AM #7
Member
- Join Date
- Jan 2010
- Location
- Athus - Belgium
- Posts
- 23
- Rep Power
- 0
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.
- 01-20-2010, 11:37 AM #8
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 13
Similar Threads
-
base conversion (large)
By billymac00 in forum New To JavaReplies: 1Last Post: 04-07-2009, 06:56 PM -
How to find logarithm base 2 value in java
By RJNARESH in forum Advanced JavaReplies: 5Last Post: 03-19-2009, 11:12 PM -
[SOLVED] Base conversions
By rlzyoner in forum New To JavaReplies: 3Last Post: 12-10-2008, 01:40 PM -
2 threads sharing a data base connection
By Ed in forum Advanced JavaReplies: 2Last Post: 07-04-2007, 05:41 AM -
Connection to data base
By Daniel in forum JDBCReplies: 2Last Post: 06-07-2007, 05:55 AM
Bookmarks