473,440 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,440 software developers and data experts.

JDBC Exception Resolution connecting to SQL Server

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
5 2649
Colloid Snake
144 100+
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
r035198x
13,262 8TB
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
9,065 Expert Mod 8TB
And now it is :D

And I have also given the thread a more meaningful name.
Jan 23 '07 #4
r035198x
13,262 8TB
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
316 100+
i think you should add ojdbc14.jar or at least classes12.jar in the libraries.
then probs will be solved
Jan 25 '07 #6

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

Similar topics

0
by: JShurmatz | last post by:
If anyone can shed some light on this problem I would greatly appreciate it. I am unsuccessfully trying to use a database connnection retrieved from a pool configured using Java System Web...
0
by: Nils Valentin | last post by:
Hi MySQL Fans ;-), Is it possible that the 3.08 series allows to connect to 4.0.14 versions but not to the 4.1 alpha-versions ? I get belows error when tryig to connect from DbVisualizer which...
0
by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version...
2
by: Marc Stiegele | last post by:
Hello, I have a problem with the IBM DB2 UDB XML Extender. I`m working on a iSeries 400 server (AS/400, V5R1) with a integrated DB2 (my client is NT 4.0 Service Pack 1 with JDK1.1.8). I want to...
5
by: Steffen | last post by:
hi there, i have a problem connecting to a db2 database 7.2.4 on AIX using java when running the javacode on AIX using jdk1.3.1. The classpath is correctly set to java12/... on windows the...
1
by: kommaraju | last post by:
iam a starter to db2 & jdbc.i have a servlet program which connects to ibm db2 using jdbc.when i run this using apache tomcat 4.1.34 , it is showing a error message of HTTP STATUS 500 my jdbc...
3
by: %NAME% | last post by:
When using embedded SQL for db2 under solaris, you do not need to give username and password since the system will use your unix-login as default credential. However, with JDBC seems I always need...
2
by: bevis | last post by:
I'm new to sql server and mysql but this seems like it should be a pretty straight forward jdbc connection. But I have spent almost 2 days just trying to get a jdbc connection. Please help if you...
3
by: Anoop | last post by:
Is it true that there are no type 4 jdbc drivers to connect to a DB2 server v7.1? The DB2 server is hosted on ACF2 (OS/390). We would be connecting from windows and solaris boxes. If it is true,...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.