Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes JDBC and the fly likes how to mysql database? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to mysql database?" Watch "how to mysql database?" New topic
Author

how to mysql database?

Markandey Sahu
Greenhorn

Joined: Jun 29, 2006
Posts: 13
Can any one give me code for connecting mysql database?
Wich driver we can use for connecting database.
pls give me complete code..
Class.forName("???");
Connection con =DriverManage.getConnection("???","??","??");
what i have to write in place of ???
Mathias Nilsson
Ranch Hand

Joined: Aug 21, 2004
Posts: 367
"jdbc:mysql://localhost:3306/test" , "test", "test"

the first localhost is your mysql database. Can be any ip number
3306 is the mysql port. Often 3306 used
the first test is the database name.
second test is the username to the database
third test is the password

// Mathias


SCJP1.4
Scott Johnson
Ranch Hand

Joined: Aug 24, 2005
Posts: 518
Have you read the
manual?
[ December 27, 2006: Message edited by: Scott Johnson ]
 
 
subject: how to mysql database?
 
Similar Threads
how to connect mysql database?
MySQL help
mysql driver????
data source Problem in Struts
Creating jar from project using hibernate