Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: connection with microsoft sql server 2008 using netbeans

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default connection with microsoft sql server 2008 using netbeans

    public class JavaApplication2 {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    try {
    Class.forName("com.microsoft.sqlserver.jdbc.SQLSer verDriver");
    String connectionUrl = "jdbc:sqlserver://localhost:1433;databaseName=Attendance;user=suhail ;password=123456";
    Connection con = DriverManager.getConnection(connectionUrl);
    // String connectionUrl = "jdbc:sqlserver://localhost;integratedSecurity=true";
    // Connection con = DriverManager.getConnection(connectionUrl);
    } catch (SQLException e) {
    System.out.println("SQL Exception: " + e.toString());
    } catch (ClassNotFoundException cE) {
    System.out.println("Class Not Found Exception: " + cE.toString());
    }
    }
    }



    This is the snipped code....I am getting error as "connection refuses" what is the error in the code plz help me

    thanks


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: connection with microsoft sql server 2008 using netbeans

    Please copy and paste the full text of the error message. There is no error message spelled the way you have spelled it: "connection refuses"

    Also Please edit your post and wrap your code with
    [code=java]
    <YOUR CODE HERE>
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Replies: 7
    Last Post: December 28th, 2012, 10:48 AM
  2. Connection String for Sql Server
    By manjula in forum JDBC & Databases
    Replies: 1
    Last Post: July 11th, 2012, 11:12 AM
  3. Connect to SQL server 2008
    By vahidbakhtiary in forum JDBC & Databases
    Replies: 1
    Last Post: July 2nd, 2012, 10:07 AM
  4. Replies: 1
    Last Post: December 15th, 2011, 08:29 AM
  5. MS SQL server 2005 to 2008 R2 migration
    By sandeep23k in forum JDBC & Databases
    Replies: 3
    Last Post: April 9th, 2011, 10:53 AM