Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help

 
priya agg
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
i m new user working on java.i m getting problem while simply connecting with database.i m using sqlserver n java version-jdk1.5.0_04.
getting error----
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at a.main(a.java:24)
while i m loading n establishing connection using system DSN
// load driver and prepare to access
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con = DriverManager.getConnection(DSN,userid,password);
Statement stmt = con.createStatement();

plzzz help me to get things done
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What URL are you using in your getConnection method?
 
priya agg
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Sturrock:
What URL are you using in your getConnection method?


thanxs for an early reply

actually want to connect using DSN

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con = DriverManager.getConnection("jdbcdbc:"+DSN,USERID,PASSWORD);
Statement stmt = con.createStatement();

path are set.while running it shows error as specified earlier
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you want to use JDBC-ODBC? There is no reason to use JDBC-ODBC with SQL Server. If you absolutely must do that, you will need to use the JDBC-ODBC bridge, not the SQL Server driver.
 
priya agg
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
please let me know more abt it...
please also want to know difference between both?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a read through our JDBC FAQs, they should answer your questions. You might also have a look at Sun's JDBC Tutorial.
[ June 24, 2008: Message edited by: Paul Sturrock ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic