Re: Class Not Found Exception
- From: "ÁõÑÐ LiuYan" <lovetide@xxxxxxx>
- Date: Mon, 20 Feb 2006 23:26:22 +0800
Very useful, it takes me 1 night time to resole this issue.
I hope microsoft can HIGHLIGHT this difference in the document of
SQLServer2005 JDBC.
# SQL Server 2000 version of the driver
#config.jdbc.driver=com.microsoft.jdbc.sqlserver.SQLServerDriver
# SQL Server 2005 version
config.jdbc.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
"Evan T. Basalik (MSFT)" <evanba@xxxxxxxxxxxxxxxxxxxx> дÈëÏûÏ¢ÐÂÎÅ:sxLVxjALGHA.3764@xxxxxxxxxxxxxxxxxxxxxxxx
If you are using the SQL Server 2000 version of the driver, you will need:
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
and
CLASSPATH=.;C:\JDBC\DDSP3\lib\msbase.jar;C:\JDBC\DDSP3\lib\mssqlserver.jar;C:\JDBC\DDSP3\lib\msutil.jar
If you are using the SQL Server 2005 version, you will need:
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
and
CLASSPATH=.;C:\JDBC\sqljdbc_1.0\enu\sqljdbc.jar
--------------------
Thread-Topic: Class Not Found Exception
thread-index: AcYo+3NRe1QkARdfQGCCaXbKbFyiqg==
X-WBNR-Posting-Host: 147.56.101.155
From: "=?Utf-8?B?RGF2aWQ=?=" <David@xxxxxxxxxxxxxxxxxxxxxxxxx>
Subject: Class Not Found Exception
Not new to programming, but very new to Java...
I have written a Java app that is attempting to connect to a local SQL
Server. I've downloaded and installed Microsoft's JDBC driver (it appeared
to
install okay).
The following code is throwing the Class Not Found exception at the class
statement. Is there something more that I need to do with the driver that
I've installed or am I missing something in the code?
thanks for any help.
java.sql.Connection connection = null;
String username = "myName";
String password = "myPass";
String URL = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String conn =
"jdbc:microsoft:sqlserver://localhost:1433:DatabaseName=myDB";
try {
Class.forName(URL).newInstance();
connection = DriverManager.getConnection(conn, username, password);
... rest of code
--
This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms specified
at
http://www.microsoft.com/info/cpyright.htm
Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
.
- References:
- RE: Class Not Found Exception
- From: Evan T. Basalik (MSFT)
- RE: Class Not Found Exception
- Prev by Date: Re: Callablestatement.execute() and clearParameter() causing excep
- Next by Date: Re: Bug with Multiple Result Sets?
- Previous by thread: RE: Class Not Found Exception
- Next by thread: RE: Feature and performance comparison
- Index(es):
Relevant Pages
|
Loading