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;








0















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.










share|improve this question
























  • 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

















0















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.










share|improve this question
























  • 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













0












0








0








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.










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 need Class.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











  • Unrelated, but: you don't need Class.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












2 Answers
2






active

oldest

votes


















1














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





share|improve this answer

























  • 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











  • Thank you, I also couldn't spot that :)

    – Panda
    Mar 22 at 8:42


















-1














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






share|improve this answer


















  • 1





    That would throw a ClassNotFoundException

    – a_horse_with_no_name
    Mar 22 at 7:30











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
);



);













draft saved

draft discarded


















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









1














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





share|improve this answer

























  • 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











  • Thank you, I also couldn't spot that :)

    – Panda
    Mar 22 at 8:42















1














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





share|improve this answer

























  • 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











  • Thank you, I also couldn't spot that :)

    – Panda
    Mar 22 at 8:42













1












1








1







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





share|improve this answer















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






share|improve this answer














share|improve this answer



share|improve this answer








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 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

















  • 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











  • 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













-1














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






share|improve this answer


















  • 1





    That would throw a ClassNotFoundException

    – a_horse_with_no_name
    Mar 22 at 7:30















-1














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






share|improve this answer


















  • 1





    That would throw a ClassNotFoundException

    – a_horse_with_no_name
    Mar 22 at 7:30













-1












-1








-1







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






share|improve this answer













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







share|improve this answer












share|improve this answer



share|improve this answer










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












  • 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

















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript