Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MySql Connection

 
nash avin
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I would like to talk to my MySql server on the local machine (4.0.15-nt) by giving the userid and password from the java program.
As of now I am able to connect to the Mysql server by using only the url in the code
Connection conn = DriverManager.getConnection(url).
I want to give the userid and password.
Kindly let me know.
PS: I connect to the MySql server by.....
C:\mysql\bin\mysql I dont give the userid and password,
How do I go about doing this,
help would be appreciated

thanks
nash
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to talk to my MySql server on the local machine (4.0.15-nt) by giving the userid and password from the java program.
Take a look at the DriverManager class documentation. Notice that the getConnection method is overloaded. One version takes a url, a user, and a password (all as Strings).
I connect to the MySql server by.....
C:\mysql\bin\mysql I dont give the userid and password,
How do I go about doing this,

Are you asking how to secure a database in MySQL?
 
nash avin
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I want to know how to go about doing a secure connection to a database server (MySql 4.0.15-nt),that is provide a username and password so that I could connect to it.
Let me know
Thanking you
nash
 
Nehul NN
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hope this help.
--Nehul
SCJP1.4
SCWCD
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic