Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URL for MySQL database

 
Richard Scothern
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm currently in the process of connecting a java application to a mysql database. I'm using the mm.mysql JDBC driver on Windows 2000 with J2se 1.4.
What I need to know is how to decide what url to use to get a connection.
The database is running on the same machine, so I assume it's called localhost, but how do I find the port number? And do I need to include the name of the database I want to use?
Thanks,
Richard
 
Michael Matola
whippersnapper
Ranch Hand
Posts: 1821
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JavaRanch Cattle Drive JDBC assignments use MySQL and there's good info on that page about getting things set up and running.
On that page you'll find a class called Test that gets an instance of the MySQL driver and gets a connection to a local database called "soup".
...
...
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
...
...
Connection con = DriverManager.getConnection( "jdbc:mysql://localhost/soup" );
[ July 04, 2002: Message edited by: Michael Matola ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic