473,395 Members | 2,253 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,395 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 2648
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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...

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.