problem with SQL Server 2000 Driver for JDBC
843854Feb 20 2004 — edited Feb 21 2004<font face=verdana >HI,<br>
Today i downloaded the SQL Server 2000 Driver for JDBC , SP 2.<br>
I wrote a simple code for getting records. Here is the peace of the code<br>
import java.sql.*;<br>
import com.microsoft.jdbc.sqlserver.SQLServerDriver;<br>
public class TestConnection {<br>
public TestConnection () {
}<br>
public static void main(String[] args) {<br>
TestConnection tc= new TestConnection ();<br>
try {<br>
DriverManager.registerDriver(new com.microsoft.jdbc.sqlserver.
SQLServerDriver());<br>
Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://163.122.28.180:1433","aby","baby");<br>
System.out.println("Passed...........");<br>
Connection con1 = DriverManager.getConnection("jdbc:microsoft:sqlserver://163.122.28.180\\zebra;User=aby;Password=baby");<br>
System.out.println("Passed......toooooooo.....");<br>
Statement stmt = con.createStatement();<br>
ResultSet rs = null;<br>
rs = stmt.executeQuery("select * from m_faq");<br>
while (rs.next()) {<br>
System.out.println("ID is..........."+rs.getString(1));<br>
}<br>
}<br>
catch (SQLException ex) {<br>
System.out.println("error in connection area"+ex);<br>
}<br>
}<br>
}<br>
Output is<br>
Passed...........<br>
error in connection areajava.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]The requested instance is either invalid or not running.<br>
the program is unable to execute the statement related with "con1".<br>
I am unable to solve the problem.I need ur help. Thanks in anticipation.<br>
Sid<br></font>