• Post Reply Bookmark Topic Watch Topic
  • New Topic

JDBC Error : No database selected

 
Arati nargide
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my code :






I have added JDBC driver "mysql-connector-java-5.1.20-bin.jar".
Still its saying no Database selected.
Please help...
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the problem should be here

jdbc:mysql://localhost:3306/

let's say you created a schema named mydb, the connection string must be

jdbc:mysql://localhost:3306/mydb
 
Arati nargide
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nicola Garofalo wrote:the problem should be here

jdbc:mysql://localhost:3306/

let's say you created a schema named mydb, the connection string must be

jdbc:mysql://localhost:3306/mydb



Oh, Thank you very much.
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let me know if it works.

Anyway that's mysql tutorial link on connecting to mySql using DriverManager

http://dev.mysql.com/doc/refman/5.6/en/connector-j-usagenotes-connect-drivermanager.html
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!