By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,737 Members | 1,989 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,737 IT Pros & Developers. It's quick & easy.

JDBC Exception Resolution connecting to SQL Server

P: 12
hi all
i need help to connect to sql ser4ver usng jsp

i m using sql server 2000,i installed Microsoft SQL Server 2000
Driver for JDBC in my system....
i placed all jar files in class path....

when try to run my applicatio i m getting following error:

java.lang.ClassNotFoundException: com.microsoft.jdbc.SQLServerDriver


my code is :

<%@ page import = "java.io.*" import = "java.lang.*"
import = "java.sql.*" %>

<%
out.println("<h2>Successfully logged in</h2>");
try
{
Class.forName("com.microsoft.jdbc.SQLServerDriver" );
Connection con=DriverManager.getConnection
("jdbc:host://localhost:8080/ravi","srinivas","sa""sa");
Statement st = con.createStatement();

String sql="INSERT INTO ravi1 VALUES ('Michael', 'dba', '90000' )";
st.executeUpdate(sql);
}
Jan 23 '07 #1
Share this Question
Share on Google+
5 Replies


Colloid Snake
100+
P: 144
hi all
i need help to connect to sql ser4ver usng jsp

i m using sql server 2000,i installed Microsoft SQL Server 2000
Driver for JDBC in my system....
i placed all jar files in class path....

when try to run my applicatio i m getting following error:

java.lang.ClassNotFoundException: com.microsoft.jdbc.SQLServerDriver


my code is :

<%@ page import = "java.io.*" import = "java.lang.*"
import = "java.sql.*" %>

<%
out.println("<h2>Successfully logged in</h2>");
try
{
Class.forName("com.microsoft.jdbc.SQLServerDriver" );
Connection con=DriverManager.getConnection
("jdbc:host://localhost:8080/ravi","srinivas","sa""sa");
Statement st = con.createStatement();

String sql="INSERT INTO ravi1 VALUES ('Michael', 'dba', '90000' )";
st.executeUpdate(sql);
}
Just to make sure, you have either included the the jdbc .jar file with the program, or added it to your classpath, correct? What what environment are you using?

Also, in your code:

Expand|Select|Wrap|Line Numbers
  1. ("jdbc:host://localhost:8080/ravi","srinivas","sa""sa"); // is there a reason you have 'sa' in there twice in quotes? (Is "sasa" your passwd, or is it just "sa"?)
  2.  
Jan 23 '07 #2

10K+
P: 13,264
Just to make sure, you have either included the the jdbc .jar file with the program, or added it to your classpath, correct? What what environment are you using?

Also, in your code:

Expand|Select|Wrap|Line Numbers
  1. ("jdbc:host://localhost:8080/ravi","srinivas","sa""sa"); // is there a reason you have 'sa' in there twice in quotes? (Is "sasa" your passwd, or is it just "sa"?)
  2.  
And also just to add that all this should really have been taking place in the Java forum
Jan 23 '07 #3

Banfa
Expert Mod 5K+
P: 8,916
And now it is :D

And I have also given the thread a more meaningful name.
Jan 23 '07 #4

10K+
P: 13,264
And now it is :D

And I have also given the thread a more meaningful name.
Thanks Banfa. I hope the OP's problem was resolved.
Jan 23 '07 #5

hirak1984
100+
P: 316
i think you should add ojdbc14.jar or at least classes12.jar in the libraries.
then probs will be solved
Jan 25 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.