Re: Class Not Found Exception



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.



.



Relevant Pages

  • Re: Trying to Move Group - SQL Instance Wont Start
    ... You can do a maintenance install and add the new nodes. ... "maintaining a failover cluster" for recovery from failure scenario 1. ... Senior SQL Infrastructure Consultant ... Microsoft SQL Server MVP ...
    (microsoft.public.sqlserver.clustering)
  • Re: Unable to Apply SP4 to SQL 2000 Cluster (new Node)
    ... While attempting to install SP4, it comes up immediately after I ... to be on one of the nodes that can bring SQL Server online and apply SP3a, ...
    (microsoft.public.sqlserver.clustering)
  • Re: Any help here???
    ... Well, for starters, I believe MDAC is unnecessary for .NET applications - as ... ADO.NET has its own SQL Server provider for data access. ... > trust me - all that's been done here was to install SP2 or upgrade of XP ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Access 2007->SQL Server2005 "connection was forcibly closed",G
    ... I moved every table I was able to move to the SQL ... closed connections - but all of these errors are in the version which used ... the SQL Server 2000 and everything worked ... communication between ODBC (OLEDB and Native Client, ...
    (microsoft.public.sqlserver.connect)
  • RE: Cannot connect to my SQL 2005 server using JDBC - can any diagnostic tool tell me what the
    ... All JDBC drivers are limited to using TCP/IP, so if you can connect properly with a UDL specifying tcp:servername, then you should be OK. ... Cannot connect to my SQL 2005 server using JDBC - can any diagnostic tool tell me what the problem is? ... Running SQL Server 2005 SP2 and using named instances. ...
    (microsoft.public.sqlserver.jdbcdriver)

Loading