aspose file tools*
The moose likes JDBC and the fly likes Would like to know whether mysql JDBC connectivity syntax correct or not Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Would like to know whether mysql JDBC connectivity syntax correct or not" Watch "Would like to know whether mysql JDBC connectivity syntax correct or not" New topic
Author

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

tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
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

Joined: Apr 14, 2004
Posts: 10336

Looks OK. Does it work?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Yes, it looks fine. You can check a summary of some of the most common JDBC urls here, including MySql's.


[My Blog]
All roads lead to JavaRanch
tangara goh
Ranch Hand

Joined: Dec 27, 2009
Posts: 125
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......
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Would like to know whether mysql JDBC connectivity syntax correct or not
 
Similar Threads
Reference Variable in Java
JDBCRealm in Tomcat5.5 and SQLServer2005
RequestDispatcher
How do you compare a string using this...
Adding html tags to script