Question : Java - database connection issue, setting the jdbc class path

Hello experts<

I try to connect to my data base with the following:

var dbConn = DatabaseConnectionFactory.createDatabaseConnection ('com.microsoft.sqlserver.jdbc.SQLServerDriver','jdbc:sqlserver://localhost:1433;databaseName=ngtest;','default','#####');

and ge the error:

Wrapped java.sql.SQLException: No suitable driver found for jdbc:sqlserver://localhost:1433;databaseName=ngtest

REsearching a bit tells me to set the path correctly in the class file, but are not sure how to do that.  Thoughts?

Thanks in advance!

Answer : Java - database connection issue, setting the jdbc class path

add this line before creating db connection
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

you need to include the jar file that have com.microsoft.sqlserver.jdbc.SQLServerDriver class in your classpath,
use this tutorial as reference for jdbc
http://download.oracle.com/javase/tutorial/jdbc/overview/index.html
Random Solutions  
 
programming4us programming4us