problem in connecting to database

hi ,

I tried to load the driver for SQL SERVER I downloaded from their site.

In the help file they specificly said that its name is "com.microsoft.jdbc.sqlserver.SQLServerDriver ".

I also made sure that the CLASSPATH is set correctly ,

but unfortunatally I couldnt compile the next application

class Test {

public static void main(String[] args){

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

}

}

does someone know what have I done wrong?

thanks ahead

Eran

[553 byte] By [Eran_Yanaia] at [2007-10-2 0:55:04]
# 1

This won't fix your problem, but it will give more info:

public class Test

{

public static void main(String[] args)

{

try

{

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");

}

catch (Exception e)

{

e.printStackTrace();

}

}

}

I'm betting that you THINK you set CLASSPATH properly, but you did not.

%

duffymoa at 2007-7-15 18:15:00 > top of Java-index,Java Essentials,New To Java...
# 2

you can use any driver i give a hint

this driver come under jdk

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")

you check driver is properly installed or not following code to try

try

{

Class.forName("any driver")

}

catch(ClassNotFoundException e)

{

System.out.println("driver is not installed properly+e")}

sunjothi_1984a at 2007-7-15 18:15:00 > top of Java-index,Java Essentials,New To Java...
# 3
thanks.all I needed was the try & cath clauseEraN
Eran_Yanaia at 2007-7-15 18:15:00 > top of Java-index,Java Essentials,New To Java...
# 4
thanks for the replyi need more informationpls reply me -sun_jothi
sunjothi_1984a at 2007-7-15 18:15:00 > top of Java-index,Java Essentials,New To Java...
# 5
> thanks for the reply> > i need more information> pls reply me>-sun_jothi*eh* what?
Annie.a at 2007-7-15 18:15:00 > top of Java-index,Java Essentials,New To Java...
# 6
reply for who can post this topic
sunjothi_1984a at 2007-7-15 18:15:00 > top of Java-index,Java Essentials,New To Java...
# 7
> reply for who can post this topicanswer for who can ask question makes sense
yawmarka at 2007-7-15 18:15:00 > top of Java-index,Java Essentials,New To Java...