JDBC connection with MS SQL Server 2000

I'm trying to connect the MS SQL server 2000 database table through the JSP page.  I'm using the local machine.

I'm trying with these below line

DriverManager.registerDriver(new jdbc.sqlserver.SQLServerDriver());
Connection connection = DriverManager.getConnection("jdbc:sqlserver:test","ash","admin");
                DSN  DATABASE password

Plz help me.

Ashish

Here is a sample code I used to connect from jsp to sqlserver using dsn. 

Find Helpful
 

public String setDBConn()throws Exception
    {
  String url = "jdbc:odbc:Fred";
  Connection con;
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  con = DriverManager.getConnection(url,"", "");
  Statement stmt = con.createStatement();
 
  String createTableCoffees = "CREATE TABLE COFFEES " + "(COF_NAME VARCHAR(32), SUP_ID INTEGER, PRICE FLOAT, " + "SALES INTEGER, TOTAL INTEGER)";
 
  stmt.executeUpdate(createTableCoffees);
  stmt.executeUpdate("INSERT INTO COFFEES " + "VALUES ('Colombian', 101, 7.99, 0, 0)");
  stmt.executeUpdate("INSERT INTO COFFEES " + "VALUES ('French_Roast', 49, 8.99, 0, 0)");
 
  String query = "SELECT COF_NAME, PRICE FROM COFFEES";
  ResultSet rs = stmt.executeQuery(query);
  String s1="START [";
  while (rs.next()) {
   s1 += "-" + rs.getString("COF_NAME");
   //float n = rs.getFloat("PRICE");
   //System.out.println(s1 + "   " + n);
  }
  return s1;
 }
Pravin Sapkal

Do you have a Java Problem?
Ask It in The Java Forum

Java Books
Java Certification, Programming, JavaBean and Object Oriented Reference Books

Return to : Java Programming Hints and Tips

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.
The site www.erpgreat.com is not affiliated with or endorsed by any company listed at this site.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.