Solved

Java - database connection issue, setting the jdbc class path

Posted on 2010-08-25
5
709 Views
Last Modified: 2012-05-10
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!
0
Comment
Question by:robthomas09
  • 2
5 Comments
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 200 total points
ID: 33526887
you set a wrong zone : javascript.
should be : java

which tools are you using to compile your code ?
You may specify the path to the ms sql jdbc driver (sqljdbc.jar) with javac with the option : -classpath

Generaly under dev tools you specify the classpath (not only for a jdbc driver) by project.
For your applications running on the system you set the classpath as environment variable

more info here for example :
http://download-llnw.oracle.com/javase/1.3/docs/tooldocs/win32/classpath.html

if you need more help you can ask a moderator to change the zone... hmmm... I do it for you now :)
0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 300 total points
ID: 33528224
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
0
 

Author Closing Comment

by:robthomas09
ID: 33533896
Thanks!
0
 
LVL 82

Expert Comment

by:leakim971
ID: 33535535
You're welcome! Thanks for the points!
0

Featured Post

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to install/upgrade the Blitz responder kit 8 27
Can someone plz fix this..getting an error 3 18
arguments to jar 5 15
use lov values 2 37
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how the fundamental information of how to create a table.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now