Wednesday, March 7, 2012

needing help to connect to server

I am new working with JDBC. I am having problems with
having the drivers reconized. I have gotten the 3 .jar
files. Here is what I do any detailed info would help.
I have taken the code off the site
http://support.microsoft.com/default.aspx?scid=kb;en-
us;313100#4
and added the user and pass that I need.
I compile it javac xxx.java
I have tried to specify where the drivers are I have moved
then in the dir where the xxx.java files are and I still
get this error
java.lang.ClassNotFoundException:
com.microsoft.jdbc.sqlserver.SQLServerDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged
(Native Method)
at java.net.URLClassLoader.findClass(Unknown
Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass
(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown
Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at Connect.getConnection(Connect.java:29)
at Connect.displayDbProperties(Connect.java:47)
at Connect.main(Connect.java:83)
Error Trace in getConnection() :
com.microsoft.jdbc.sqlserver.SQLServerDriver
Any help that you can give me is great. Take in mind that
I am new at this and will need a little more detail
responce.
Thanks Tom
"Tom Teer" wrote:

> I am new working with JDBC. I am having problems with
> having the drivers reconized. I have gotten the 3 .jar
> files. Here is what I do any detailed info would help.
> I have taken the code off the site
> http://support.microsoft.com/default.aspx?scid=kb;en-
> us;313100#4
> and added the user and pass that I need.
> I compile it javac xxx.java
> I have tried to specify where the drivers are I have moved
> then in the dir where the xxx.java files are and I still
> get this error
> java.lang.ClassNotFoundException:
> com.microsoft.jdbc.sqlserver.SQLServerDriver
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged
> (Native Method)
> at java.net.URLClassLoader.findClass(Unknown
> Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass
> (Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown
> Source)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Unknown Source)
> at Connect.getConnection(Connect.java:29)
> at Connect.displayDbProperties(Connect.java:47)
> at Connect.main(Connect.java:83)
> Error Trace in getConnection() :
> com.microsoft.jdbc.sqlserver.SQLServerDriver
> Any help that you can give me is great. Take in mind that
> I am new at this and will need a little more detail
> responce.
> Thanks Tom
>
Tom,
It appears that you are still unable to load the drivers for SQL Server.
If the driver's JAR files are inside the same directory as your application,
make sure that you have . (dot) as one of the arguments in your system's
classpath.
Alternatively, add the JAR files to your system's CLASSPATH. That would make
them available to any Java application system-wide.
Be sure to add them to the classpath in the form
%location%/msutils.jar;%location/mssqlserver.jar - that is with the full file
name.
Hope this helps,
Yuval
|||"Tom Teer" wrote:

> I am new working with JDBC. I am having problems with
> having the drivers reconized. I have gotten the 3 .jar
> files. Here is what I do any detailed info would help.
> I have taken the code off the site
> http://support.microsoft.com/default.aspx?scid=kb;en-
> us;313100#4
> and added the user and pass that I need.
> I compile it javac xxx.java
> I have tried to specify where the drivers are I have moved
> then in the dir where the xxx.java files are and I still
> get this error
> java.lang.ClassNotFoundException:
> com.microsoft.jdbc.sqlserver.SQLServerDriver
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged
> (Native Method)
> at java.net.URLClassLoader.findClass(Unknown
> Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at sun.misc.Launcher$AppClassLoader.loadClass
> (Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown
> Source)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Unknown Source)
> at Connect.getConnection(Connect.java:29)
> at Connect.displayDbProperties(Connect.java:47)
> at Connect.main(Connect.java:83)
> Error Trace in getConnection() :
> com.microsoft.jdbc.sqlserver.SQLServerDriver
> Any help that you can give me is great. Take in mind that
> I am new at this and will need a little more detail
> responce.
> Thanks Tom
>
|||Tom,
You could also try running your application as:
java -cp .;.\msbase.jar;.\msutil.jar;.\mssqlserver.jar xxx
Sue Purkis
DataDirect Technologies
yuvalz <yuvalz@.discussions.microsoft.com> wrote in message news:<19B25152-8E15-4893-B56A-6D3A4FE7D85D@.microsoft.com>...[vbcol=seagreen]
> "Tom Teer" wrote:

No comments:

Post a Comment