import java.sql.*; class connectsql { static connection cont(string db)throws exception { class.forname("com.mysql.jdbc.driver"); connection con=drivermanager.getconnection("jdbc:mysql://localhost:3306/"+db+","root","xyz" ); return(con); } } i facing problem in compiling function , 7th line suppose problem there syntax error.if please tell me.here want take name of database parameter received calling function.when gave exact name of database instead of parameter worked,but not after passed parameter in connection line.
it should be
connection con=drivermanager.getconnection("jdbc:mysql://localhost:3306/"+db,"root","xyz" ); problem
"+db+" you have " mark
Comments
Post a Comment