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

Connecting to database JSP

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+
2 Replies


acoder
Expert Mod 15k+
P: 16,027
You will get more help in the Java forum for your JSP problems.
Jan 23 '07 #2

10K+
P: 13,264
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);
}
Set the mysqlserver.jar in your classpath before running your code. The command is something like:

set CLASSPATH=.;mysqlserver.jar;
Jan 23 '07 #3

Post your reply

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