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

Would like to know whether mysql JDBC connectivity syntax correct or not

 
tangara goh
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear experts,

I would like to check whether my connectivity syntax is it correct. Thanks.


try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost/databasename", "table name","password");
//collect information from the form data
strNRIC = request.getParameter("txtNRIC").trim();

catch blah blah balh

Many thanks.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks OK. Does it work?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it looks fine. You can check a summary of some of the most common JDBC urls here, including MySql's.
 
tangara goh
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all for your affirmation.

I don't know if it's going to work because I didn't create the password and username myself but it's done at my web hosting company's end.

So now, am praying real hard that it's going to work......
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic