Link to home
Start Free TrialLog in
Avatar of garfield11
garfield11

asked on

Load driver & getting a connection to db

Hi all,

I'm new in JSP and I encountered problems while loading the driver n getting a connection to the database.

Codes:

Class.forName( "com.microsoft.jdbc.sqlserver.SQLServerDriver" );

Connection conn = DriverManager.getConnection (
                    "jdbc:microsoft:sqlserver:OTsoft",
                    "sa", "" );

But it results in "No suitable driver".

Currently using Microsoft SQL Server - Enterprise Manager for database.

Can anyone please advise? Thanks!
Avatar of kotan
kotan
Flag of Malaysia image

Do you set the CLASSPATH point to the jar file of jdbc driver?
Avatar of garfield11
garfield11

ASKER

yup. Under JPadPro menu, I select "Edit Standard Classpath"-->"Add" and enter C:\tomcat\lib\servlet.jar.
No, I believe kotan is asking if you have the path to the JDBC driver jar in your classpath.

if you don't have it in your classpath, add it.

if you haven't gotten/downloaded the SQL Server JDBC driver.. you can get it from here:
http://msdn.microsoft.com/downloads/default.asp?URL=/downloads/sample.asp?url=/MSDN-FILES/027/001/779/msdncompositedoc.xml

CJ

ASKER CERTIFIED SOLUTION
Avatar of cheekycj
cheekycj
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mick Barry
Add the jar file for your JDBC driver to the directory:
<webapp>/WEB-INF/lib
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

"Accept cheekycj's comment as answer."
 
Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

Kuldeepchaturvedi
EE Cleanup Volunteer