Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » DTP » "No suitable driver" exception
"No suitable driver" exception [message #35561] Mon, 27 August 2007 11:43 Go to next message
Eclipse User
Originally posted by: xstang.atlas.cz

while trying to connect to nysql db I always get an exception message "No
suitable driver".
If I try to connect through Data Source Explorer, it works fine.

Can anyone help me with that?
I'm new to Eclipse, so it may be just a stupid small thing, but I can't
figure it out.
Thanx
Re: "No suitable driver" exception [message #35595 is a reply to message #35561] Mon, 27 August 2007 14:47 Go to previous messageGo to next message
Eclipse User
Originally posted by: brianf.sybase.com

Hi... Can you provide some additional details about how you're trying to get
a connection?

Thanks
--Brian Fitzpatrick
Sr. Software Engineer/DTP Connectivity
Sybase, Inc

"xstang" <xstang@atlas.cz> wrote in message
news:a6feeb2163692b9a9e610ed0106a6d14$1@www.eclipse.org...
> while trying to connect to nysql db I always get an exception message "No
> suitable driver".
> If I try to connect through Data Source Explorer, it works fine.
>
> Can anyone help me with that? I'm new to Eclipse, so it may be just a
> stupid small thing, but I can't figure it out.
> Thanx
>
Re: "No suitable driver" exception [message #35730 is a reply to message #35595] Tue, 28 August 2007 02:44 Go to previous messageGo to next message
Eclipse User
Originally posted by: xstang.atlas.cz

Hi,

that's the code:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
...
public class to {
public static void main(String[] args) {

try {
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/test");
} catch (SQLException ex) {
...
}
}
}
Re: "No suitable driver" exception [message #35764 is a reply to message #35730] Thu, 30 August 2007 09:36 Go to previous messageGo to next message
Eclipse User
Originally posted by: brianf.sybase.com

Hi there...

This is fine code, but you have to make sure that the driver is loaded
before you call to get a connection.

If you're developing a plug-in, you can use the Driver Instance to get a
classloader with the associated jars already there. However, since the
example you provided was a simple main(), I'm guessing you're just doing
straight Java development.

This is more of a JDBC thing, but you typically have to load the class ahead
of time by adding the driver jar(s) to the project classpath and then using
something like...

try {
Class.forName("my.jdbc.driver.class");
}
catch(Exception x){
System.out.println( "Unable to load the driver class!" );
}

This will load the jar into the classloader so the JDBC DriverManager can
see it and you should then be able to use your code.

If you're doing things within an Eclipse plug-in, we have other options
available within DTP to help you out.

Hope that helps.
--Fitz

"xstang" <xstang@atlas.cz> wrote in message
news:b064ba84538d8f9b1956de1529085677$1@www.eclipse.org...
> Hi,
>
> that's the code:
>
> import java.sql.Connection;
> import java.sql.DriverManager;
> import java.sql.SQLException;
> ..
> public class to {
> public static void main(String[] args) {
>
> try {
> Connection conn =
> DriverManager.getConnection("jdbc:mysql://localhost:3306/test"); }
> catch (SQLException ex) {
> ...
> } }
> }
>
how to special Data Source Explorer(dse) content [message #39068 is a reply to message #35561] Mon, 26 November 2007 21:13 Go to previous message
Jet  is currently offline Jet
Messages: 5
Registered: July 2009
Junior Member
Hi,
i want use dse view in my plugin , but i wont show all connection profile
content.
Image,before open data source explorer view, i get connection profile id,
i want only show the connection profile content.

Any advices?
thanks in advance!
Jet
Re: "No suitable driver" exception [message #587669 is a reply to message #35561] Mon, 27 August 2007 14:47 Go to previous message
Brian Fitzpatrick is currently offline Brian Fitzpatrick
Messages: 495
Registered: July 2009
Senior Member
Hi... Can you provide some additional details about how you're trying to get
a connection?

Thanks
--Brian Fitzpatrick
Sr. Software Engineer/DTP Connectivity
Sybase, Inc

"xstang" <xstang@atlas.cz> wrote in message
news:a6feeb2163692b9a9e610ed0106a6d14$1@www.eclipse.org...
> while trying to connect to nysql db I always get an exception message "No
> suitable driver".
> If I try to connect through Data Source Explorer, it works fine.
>
> Can anyone help me with that? I'm new to Eclipse, so it may be just a
> stupid small thing, but I can't figure it out.
> Thanx
>
Re: "No suitable driver" exception [message #587708 is a reply to message #35595] Tue, 28 August 2007 02:44 Go to previous message
Eclipse User
Originally posted by: xstang.atlas.cz

Hi,

that's the code:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
...
public class to {
public static void main(String[] args) {

try {
Connection conn =
DriverManager.getConnection("jdbc:mysql://localhost:3306/test");
} catch (SQLException ex) {
...
}
}
}
Re: "No suitable driver" exception [message #587718 is a reply to message #35730] Thu, 30 August 2007 09:36 Go to previous message
Brian Fitzpatrick is currently offline Brian Fitzpatrick
Messages: 495
Registered: July 2009
Senior Member
Hi there...

This is fine code, but you have to make sure that the driver is loaded
before you call to get a connection.

If you're developing a plug-in, you can use the Driver Instance to get a
classloader with the associated jars already there. However, since the
example you provided was a simple main(), I'm guessing you're just doing
straight Java development.

This is more of a JDBC thing, but you typically have to load the class ahead
of time by adding the driver jar(s) to the project classpath and then using
something like...

try {
Class.forName("my.jdbc.driver.class");
}
catch(Exception x){
System.out.println( "Unable to load the driver class!" );
}

This will load the jar into the classloader so the JDBC DriverManager can
see it and you should then be able to use your code.

If you're doing things within an Eclipse plug-in, we have other options
available within DTP to help you out.

Hope that helps.
--Fitz

"xstang" <xstang@atlas.cz> wrote in message
news:b064ba84538d8f9b1956de1529085677$1@www.eclipse.org...
> Hi,
>
> that's the code:
>
> import java.sql.Connection;
> import java.sql.DriverManager;
> import java.sql.SQLException;
> ..
> public class to {
> public static void main(String[] args) {
>
> try {
> Connection conn =
> DriverManager.getConnection("jdbc:mysql://localhost:3306/test"); }
> catch (SQLException ex) {
> ...
> } }
> }
>
how to special Data Source Explorer(dse) content [message #588718 is a reply to message #35561] Mon, 26 November 2007 21:13 Go to previous message
Jet  is currently offline Jet
Messages: 5
Registered: July 2009
Junior Member
Hi,
i want use dse view in my plugin , but i wont show all connection profile
content.
Image,before open data source explorer view, i get connection profile id,
i want only show the connection profile content.

Any advices?
thanks in advance!
Jet
Previous Topic:ODA Jdbc not in Eclipse
Next Topic:generic JDBC is unsupported
Goto Forum:
  


Current Time: Sat Jul 26 05:13:03 EDT 2014

Powered by FUDForum. Page generated in 0.02423 seconds