Why am I getting java.sql.SQLException: No suitable driver found when the url is correct and driver is present? The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceThe infamous java.sql.SQLException: No suitable driver foundjava.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/dbnameThe infamous java.sql.SQLException: No suitable driver foundFinding Foreign Keys From Unknown Database SQL and JavaSlow sql execution under Oracle connection from Weblogic controlled data sourceNo suitable driver found for jdbc mysql?Postgres : No suitable Driver found for jdbc JAR File32bit Win7, 32bit JDK and 32bit MS Access causes java.sql.SQLException: No suitable driver foundNo suitable driver found for jdbc:postgresqljava.sql.SQLException: No suitable driver Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URLWhy jdbc driver is not found from generated jar?eclipse: No suitable driver found for jdbc
Sort a list of pairs representing an acyclic, partial automorphism
Finding the path in a graph from A to B then back to A with a minimum of shared edges
University's motivation for having tenure-track positions
Change bounding box of math glyphs in LuaTeX
How to remove this toilet supply line that seems to have no nut?
In horse breeding, what is the female equivalent of putting a horse out "to stud"?
Simulating Exploding Dice
What do you call a plan that's an alternative plan in case your initial plan fails?
How are presidential pardons supposed to be used?
Does Parliament need to approve the new Brexit delay to 31 October 2019?
I could not break this equation. Please help me
how can a perfect fourth interval be considered either consonant or dissonant?
How did the audience guess the pentatonic scale in Bobby McFerrin's presentation?
Scientific Reports - Significant Figures
Is there a writing software that you can sort scenes like slides in PowerPoint?
Did the UK government pay "millions and millions of dollars" to try to snag Julian Assange?
What is this lever in Argentinian toilets?
Is every episode of "Where are my Pants?" identical?
system() function string length limit
What's the point in a preamp?
How to pronounce 1ターン?
When did F become S in typeography, and why?
Typeface like Times New Roman but with "tied" percent sign
What aspect of planet Earth must be changed to prevent the industrial revolution?
Why am I getting java.sql.SQLException: No suitable driver found when the url is correct and driver is present?
The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experienceThe infamous java.sql.SQLException: No suitable driver foundjava.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/dbnameThe infamous java.sql.SQLException: No suitable driver foundFinding Foreign Keys From Unknown Database SQL and JavaSlow sql execution under Oracle connection from Weblogic controlled data sourceNo suitable driver found for jdbc mysql?Postgres : No suitable Driver found for jdbc JAR File32bit Win7, 32bit JDK and 32bit MS Access causes java.sql.SQLException: No suitable driver foundNo suitable driver found for jdbc:postgresqljava.sql.SQLException: No suitable driver Cannot create JDBC driver of class 'oracle.jdbc.driver.OracleDriver' for connect URLWhy jdbc driver is not found from generated jar?eclipse: No suitable driver found for jdbc
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am trying the following code to make connection with my database online, hosted on ElephantSQL.
private static Connection getConnection()
try
Class.forName("org.postgresql.Driver");
catch (ClassNotFoundException e)
System.out.println("Jar not found "+e.getMessage());
//dbUrl is given this way
String dbUrl = "jdbc:postgres://database:password@manny.db.elephantsql.com:5432/database";
String username = "database";
String password = "password";
try
return DriverManager.getConnection(dbUrl,username,password);
catch (SQLException e)
e.printStackTrace();
return null;
But I am getting the following error:
java.sql.SQLException: No suitable driver found for < url >
I tried all the things from the similar questions which I found here
Question 1
and
Question 2.
But nothing worked and I am stuck. I would appreciate any help.
java postgresql jdbc
add a comment |
I am trying the following code to make connection with my database online, hosted on ElephantSQL.
private static Connection getConnection()
try
Class.forName("org.postgresql.Driver");
catch (ClassNotFoundException e)
System.out.println("Jar not found "+e.getMessage());
//dbUrl is given this way
String dbUrl = "jdbc:postgres://database:password@manny.db.elephantsql.com:5432/database";
String username = "database";
String password = "password";
try
return DriverManager.getConnection(dbUrl,username,password);
catch (SQLException e)
e.printStackTrace();
return null;
But I am getting the following error:
java.sql.SQLException: No suitable driver found for < url >
I tried all the things from the similar questions which I found here
Question 1
and
Question 2.
But nothing worked and I am stuck. I would appreciate any help.
java postgresql jdbc
No other logs? Could you please post a bit more the exception you got ?
– DeskToDevelop
Mar 22 at 7:16
Unrelated, but: you don't needClass.forName()
– a_horse_with_no_name
Mar 22 at 7:27
add a comment |
I am trying the following code to make connection with my database online, hosted on ElephantSQL.
private static Connection getConnection()
try
Class.forName("org.postgresql.Driver");
catch (ClassNotFoundException e)
System.out.println("Jar not found "+e.getMessage());
//dbUrl is given this way
String dbUrl = "jdbc:postgres://database:password@manny.db.elephantsql.com:5432/database";
String username = "database";
String password = "password";
try
return DriverManager.getConnection(dbUrl,username,password);
catch (SQLException e)
e.printStackTrace();
return null;
But I am getting the following error:
java.sql.SQLException: No suitable driver found for < url >
I tried all the things from the similar questions which I found here
Question 1
and
Question 2.
But nothing worked and I am stuck. I would appreciate any help.
java postgresql jdbc
I am trying the following code to make connection with my database online, hosted on ElephantSQL.
private static Connection getConnection()
try
Class.forName("org.postgresql.Driver");
catch (ClassNotFoundException e)
System.out.println("Jar not found "+e.getMessage());
//dbUrl is given this way
String dbUrl = "jdbc:postgres://database:password@manny.db.elephantsql.com:5432/database";
String username = "database";
String password = "password";
try
return DriverManager.getConnection(dbUrl,username,password);
catch (SQLException e)
e.printStackTrace();
return null;
But I am getting the following error:
java.sql.SQLException: No suitable driver found for < url >
I tried all the things from the similar questions which I found here
Question 1
and
Question 2.
But nothing worked and I am stuck. I would appreciate any help.
java postgresql jdbc
java postgresql jdbc
edited Mar 22 at 7:26
Joakim Danielson
10.8k3725
10.8k3725
asked Mar 22 at 6:37
PandaPanda
33
33
No other logs? Could you please post a bit more the exception you got ?
– DeskToDevelop
Mar 22 at 7:16
Unrelated, but: you don't needClass.forName()
– a_horse_with_no_name
Mar 22 at 7:27
add a comment |
No other logs? Could you please post a bit more the exception you got ?
– DeskToDevelop
Mar 22 at 7:16
Unrelated, but: you don't needClass.forName()
– a_horse_with_no_name
Mar 22 at 7:27
No other logs? Could you please post a bit more the exception you got ?
– DeskToDevelop
Mar 22 at 7:16
No other logs? Could you please post a bit more the exception you got ?
– DeskToDevelop
Mar 22 at 7:16
Unrelated, but: you don't need
Class.forName()
– a_horse_with_no_name
Mar 22 at 7:27
Unrelated, but: you don't need
Class.forName()
– a_horse_with_no_name
Mar 22 at 7:27
add a comment |
2 Answers
2
active
oldest
votes
As documented in the manual the URL for Postgres must be structured like this:
jdbc:postgresql://host:port/database
The prefix jdbc:postgres
needs to be jdbc:postgresql
and the part database:password@manny.db.elephantsql.com:5432
in your URL is wrong. It's hard to tell what exactly the hostname is, but I guess you need to use:
jdbc:postgresql://manny.db.elephantsql.com:5432/database
The error remains same, it still is saying no suitable driver found for < changed url, without database:password >
– Panda
Mar 22 at 8:34
@Panda: I overlooked another error in your URL. It needs to bepostgresql
notpostgres
in the prefix.
– a_horse_with_no_name
Mar 22 at 8:37
Thank you, I also couldn't spot that :)
– Panda
Mar 22 at 8:42
add a comment |
It seems that your driver jar file is not in classpath.
One of the option is put driver jar file in lib directory of your project and add jar file in classpath ( or buildpath in eclipse )
you can download dirver file from given URL
https://jdbc.postgresql.org/download.html
1
That would throw a ClassNotFoundException
– a_horse_with_no_name
Mar 22 at 7:30
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55294129%2fwhy-am-i-getting-java-sql-sqlexception-no-suitable-driver-found-when-the-url-is%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
As documented in the manual the URL for Postgres must be structured like this:
jdbc:postgresql://host:port/database
The prefix jdbc:postgres
needs to be jdbc:postgresql
and the part database:password@manny.db.elephantsql.com:5432
in your URL is wrong. It's hard to tell what exactly the hostname is, but I guess you need to use:
jdbc:postgresql://manny.db.elephantsql.com:5432/database
The error remains same, it still is saying no suitable driver found for < changed url, without database:password >
– Panda
Mar 22 at 8:34
@Panda: I overlooked another error in your URL. It needs to bepostgresql
notpostgres
in the prefix.
– a_horse_with_no_name
Mar 22 at 8:37
Thank you, I also couldn't spot that :)
– Panda
Mar 22 at 8:42
add a comment |
As documented in the manual the URL for Postgres must be structured like this:
jdbc:postgresql://host:port/database
The prefix jdbc:postgres
needs to be jdbc:postgresql
and the part database:password@manny.db.elephantsql.com:5432
in your URL is wrong. It's hard to tell what exactly the hostname is, but I guess you need to use:
jdbc:postgresql://manny.db.elephantsql.com:5432/database
The error remains same, it still is saying no suitable driver found for < changed url, without database:password >
– Panda
Mar 22 at 8:34
@Panda: I overlooked another error in your URL. It needs to bepostgresql
notpostgres
in the prefix.
– a_horse_with_no_name
Mar 22 at 8:37
Thank you, I also couldn't spot that :)
– Panda
Mar 22 at 8:42
add a comment |
As documented in the manual the URL for Postgres must be structured like this:
jdbc:postgresql://host:port/database
The prefix jdbc:postgres
needs to be jdbc:postgresql
and the part database:password@manny.db.elephantsql.com:5432
in your URL is wrong. It's hard to tell what exactly the hostname is, but I guess you need to use:
jdbc:postgresql://manny.db.elephantsql.com:5432/database
As documented in the manual the URL for Postgres must be structured like this:
jdbc:postgresql://host:port/database
The prefix jdbc:postgres
needs to be jdbc:postgresql
and the part database:password@manny.db.elephantsql.com:5432
in your URL is wrong. It's hard to tell what exactly the hostname is, but I guess you need to use:
jdbc:postgresql://manny.db.elephantsql.com:5432/database
edited Mar 22 at 8:36
answered Mar 22 at 7:29
a_horse_with_no_namea_horse_with_no_name
308k46471573
308k46471573
The error remains same, it still is saying no suitable driver found for < changed url, without database:password >
– Panda
Mar 22 at 8:34
@Panda: I overlooked another error in your URL. It needs to bepostgresql
notpostgres
in the prefix.
– a_horse_with_no_name
Mar 22 at 8:37
Thank you, I also couldn't spot that :)
– Panda
Mar 22 at 8:42
add a comment |
The error remains same, it still is saying no suitable driver found for < changed url, without database:password >
– Panda
Mar 22 at 8:34
@Panda: I overlooked another error in your URL. It needs to bepostgresql
notpostgres
in the prefix.
– a_horse_with_no_name
Mar 22 at 8:37
Thank you, I also couldn't spot that :)
– Panda
Mar 22 at 8:42
The error remains same, it still is saying no suitable driver found for < changed url, without database:password >
– Panda
Mar 22 at 8:34
The error remains same, it still is saying no suitable driver found for < changed url, without database:password >
– Panda
Mar 22 at 8:34
@Panda: I overlooked another error in your URL. It needs to be
postgresql
not postgres
in the prefix.– a_horse_with_no_name
Mar 22 at 8:37
@Panda: I overlooked another error in your URL. It needs to be
postgresql
not postgres
in the prefix.– a_horse_with_no_name
Mar 22 at 8:37
Thank you, I also couldn't spot that :)
– Panda
Mar 22 at 8:42
Thank you, I also couldn't spot that :)
– Panda
Mar 22 at 8:42
add a comment |
It seems that your driver jar file is not in classpath.
One of the option is put driver jar file in lib directory of your project and add jar file in classpath ( or buildpath in eclipse )
you can download dirver file from given URL
https://jdbc.postgresql.org/download.html
1
That would throw a ClassNotFoundException
– a_horse_with_no_name
Mar 22 at 7:30
add a comment |
It seems that your driver jar file is not in classpath.
One of the option is put driver jar file in lib directory of your project and add jar file in classpath ( or buildpath in eclipse )
you can download dirver file from given URL
https://jdbc.postgresql.org/download.html
1
That would throw a ClassNotFoundException
– a_horse_with_no_name
Mar 22 at 7:30
add a comment |
It seems that your driver jar file is not in classpath.
One of the option is put driver jar file in lib directory of your project and add jar file in classpath ( or buildpath in eclipse )
you can download dirver file from given URL
https://jdbc.postgresql.org/download.html
It seems that your driver jar file is not in classpath.
One of the option is put driver jar file in lib directory of your project and add jar file in classpath ( or buildpath in eclipse )
you can download dirver file from given URL
https://jdbc.postgresql.org/download.html
answered Mar 22 at 7:26
VirenViren
11
11
1
That would throw a ClassNotFoundException
– a_horse_with_no_name
Mar 22 at 7:30
add a comment |
1
That would throw a ClassNotFoundException
– a_horse_with_no_name
Mar 22 at 7:30
1
1
That would throw a ClassNotFoundException
– a_horse_with_no_name
Mar 22 at 7:30
That would throw a ClassNotFoundException
– a_horse_with_no_name
Mar 22 at 7:30
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55294129%2fwhy-am-i-getting-java-sql-sqlexception-no-suitable-driver-found-when-the-url-is%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
No other logs? Could you please post a bit more the exception you got ?
– DeskToDevelop
Mar 22 at 7:16
Unrelated, but: you don't need
Class.forName()
– a_horse_with_no_name
Mar 22 at 7:27