• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

Java and SQLSERVER2008 connectivity

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you include the jar file in the runtime classpath as well as the compile classpath?
 
Bushra Fathima
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what is the solution now for me?please tell me what should be done.
 
Saloon Keeper
Posts: 28210
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Oh sure, it's a tiny ad, but under the right circumstances, it gets bigger.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic