aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Java and SQLSERVER2008 connectivity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Java and SQLSERVER2008 connectivity" Watch "Java and SQLSERVER2008 connectivity" New topic
Author

Java and SQLSERVER2008 connectivity

Bushra Fathima
Greenhorn

Joined: Oct 22, 2008
Posts: 11
Hi,

I have the following code to connect to SQLSERVEer2008,

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
connectionURl ---- jdbc:sqlserver://172.16.40.65:1433;DatabaseName=DBName,uname,pwd;

I am' using MYEclipse6.6 and have included sqljdbc4.jar in libraries.

But i 'am still getting No suitable driver error when i run application.


Can anyone help.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42611
    
  65
Did you include the jar file in the runtime classpath as well as the compile classpath?


Ping & DNS - my free Android networking tools app
Bushra Fathima
Greenhorn

Joined: Oct 22, 2008
Posts: 11
Hi,

I included the jar as usual we do in MyEclipse. right-click prj-> properties->Java Build path->Libraries. and then add external jars.

I have also set the jar in CLASSPATH in environment variables
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42611
    
  65
I included the jar as usual we do in MyEclipse. right-click prj-> properties->Java Build path->Libraries. and then add external jars.

That sounds like it's used at build time, not runtime.

I have also set the jar in CLASSPATH in environment variables

Are you running this within Eclipse? If so, then it's possible that CLASSPATH is not used.

Moving to the IDE forum.
Bushra Fathima
Greenhorn

Joined: Oct 22, 2008
Posts: 11
So what is the solution now for me?please tell me what should be done.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

The CLASSPATH for Eclipse isn't taken into consideration when debugging apps inside Eclipse. That's a completely different classpath, based on the project's classpath PLUS the debug session's classpath. You have left out some details, but from the sound of it, you're trying to debug and not getting the driver. You need to add the driver jar to the debug session's classpath. The Run/Debug Configurations menu will permit you to retrieve and edit the debugging profile, including its CLASSPATH.

Just for info, I was REALLY disappointed in the Microsoft SQL Server JDBC driver. I inherited a monstrosity where half the program's application logic was in stored procedures with transaction nesting all over the landscape. The Microsoft driver had a complete nervous breakdown. I switched to an open-source SQL Server driver I got from SourceForge and the problems went away.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java and SQLSERVER2008 connectivity