Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

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>
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 20 2004
Added on Feb 20 2004
2 comments
100 views