Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Other Java > Java Databases
|
Java Databases Discussion specific to working with Java Databases. For other Java topics, please see related Java forums. For database discussions not specific to Java, please see the Database category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 9th, 2007, 06:46 AM
Registered User
 
Join Date: Apr 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nigam.anand
Default Databaase Connection with SQl Server....

Hi...

    I am facing problem while connecting to SQL Server 2000 through Java Program... It showing the following problem...


 java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.


Code given below...


package DataBase;

import java.sql.*;
/**
 *
 * @ Author :- Nigamananda Rout
 * @ E-mail :- [email protected]
 *
 * @ Changed on February 8, 2007, 3:34 PM
 */
public class SqlServer_Test {

    /** Creates a new instance of SqlServer_Test */
    public SqlServer_Test() {
    }

 public static void main(String ns[])
 {

        try {
            Class.forName("com.microsoft.jdbc.sqlserver.SQLSer verDriver");

            String db_connect_string = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=Nigam";
            String db_userid = "sa";
            String db_password = "passwd" ;

            Connection conn = DriverManager.getConnection(db_connect_string, db_userid, db_password);
            System.out.println("connected");

        } catch (Exception e) {
            System.out.println("Not connected Due to Error " + e.toString());
      }
 }


Thank you...





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Server Connection MonkeyMan666 C# 2 November 14th, 2008 10:44 AM
Database connection with SQL Server yubaraj JSP Basics 3 May 29th, 2007 04:39 AM
Connection to SQL Server brijxp ADO.NET 1 November 18th, 2006 08:34 AM
SQL Server Connection mpeterson Classic ASP Databases 1 July 8th, 2003 09:50 PM
Connection with sql server arshad mahmood VB Databases Basics 1 June 19th, 2003 10:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.