can't connect to msssql

From: Georg Andersson (georg.andersson_at_swisstopo.ch)
Date: 07/22/04


Date: 22 Jul 2004 02:55:30 -0700

hi the code below is supposed to establish a connection to my database
located on a sql-server. but there is always thr following exception:
java.sql.SQLException: No suitable driver

i have downloaded the driver from microsoft
(http://www.microsoft.com/downloads/details.aspx?FamilyID=86212d54-8488-481d-b46b-af29bb18e1e5&DisplayLang=en)
and copied the 3 jar-files to C:\Program Files\
j2sdk1.4.2_04\jre\lib\ext and C:\Program Files\Java\
j2re1.4.2_04\lib\ext.

any ideas what i'm doing wrong?

public void testCON(){
  Connection connection = null;
  try {
    String driverName =
("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    Class.forName(driverName);
    
    String serverName = "lt51s";
    String mydatabase = "ADMS";
    String url = "jdbc:mysql://" + serverName + "/" + mydatabase;
    String username = "user";
    String password = "password";
    connection = DriverManager.getConnection(url, username, password);
  }catch (ClassNotFoundException e) {
    System.out.println(e);
  }catch (SQLException e) {
    System.out.println(e);
  }
}



Relevant Pages

  • Driver corrupts prepared statements in pool.
    ... This test case demonstrates a bug in the Microsoft SQL Server 2005 JDBC ... cause an exception the next time it is used. ... Microsoft SQL Server 2005 JDBC driver 1.0.809.102 ... // A connection will NOT work properly until it has been ...
    (microsoft.public.sqlserver.jdbcdriver)
  • [bug] stuck localhost TCP connections, v2.6.26-rc3+
    ... That connection has been stuck for 9 ... and it occured on two boxes, both are SMP ... # Bus options ... # Generic Driver Options ...
    (Linux-Kernel)
  • Re: Reading mm datasource
    ... When in Word on my machine, I click on open datasource, pick Connect ... > do not seem to have a specific driver name for the connection string. ... But before you go much further, I hadn't realised you were taking that particular approach to making the connection, and AFAIK the consequence is likely to be that you will be opening your data source, using the "OLE DB Provider for ODBC data sources" which is an approach I know little about but will ...
    (microsoft.public.word.mailmerge.fields)
  • Re: HP JetDirect (now media center and HP 3310)
    ... The problem I am having is not with a HP printer driver. ... In this situation the drive is accessible through Windows Explorer. ... Windows Explorer to force a connection and get Transfer Images to work. ... I am not sure if this will completely work since the setup program may do ...
    (microsoft.public.windowsxp.print_fax)
  • Re: HP JetDirect (now media center and HP 3310)
    ... The problem I am having is not with a HP printer driver. ... In this situation the drive is accessible through Windows Explorer. ... Windows Explorer to force a connection and get Transfer Images to work. ... I am not sure if this will completely work since the setup program may do ...
    (microsoft.public.windowsxp.print_fax)