Results 1 to 2 of 2

Thread: connectivity of sql with java

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2005
    Posts
    15

    connectivity of sql with java

    what is the connectivity code of sql server with java

  2. #2
    Addicted Member
    Join Date
    May 2001
    Location
    UK
    Posts
    222

    Re: connectivity of sql with java

    You need to get the SQL Server JAR from somewhere, then this is the basic setup:

    Code:
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); // this statically initialises the driver.
    
    String url = "jdbc:microsoft:sqlserver://<host>:<port>;DatabaseName=<databasename>";
    String username = "sa";
    String password = "yourpassword"
    Connection c = DriverManager.getConnection(this.url, username, password);
    That should do it for you...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width