Skip to Content.
Sympa Menu

freetds - RE: How to load FreeTDS JDBC driver?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Daniel Selin" <daniel.selin AT home.se>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: RE: How to load FreeTDS JDBC driver?
  • Date: Thu, 4 Jan 2001 19:34:19 +0100


Try this:

public Connection getConnection()
{
String username = "the_username";
String password = "the_password";
String thinConn =
"jdbc:freetds:sqlserver://the_db_server/the_db_name;tds=7.0";
String driverClass = "com.internetcds.jdbc.tds.Driver";

Connection c=null;
try
{
Class.forName("com.internetcds.jdbc.tds.Driver");
c = DriverManager.getConnection(thinConn,username,password);
}
catch(ClassNotFoundException e) {System.out.println("DB-Driver-class
not
found");}
catch(SQLException e) {System.out.println("SQL-Exception:
"+e.getMessage());}
return c;
}

I hope it helps.

/Daniel


>Hi:
>I'm trying to connect to SQL Server from a linux server.
>I'm using the freetds_jdbc.snapshot.jar driver with the following java
>code:
>
> //driver load
> Class.forName ("?????");
>
> //database connection
> Connection con = DriverManager.getConnection
>(jdbc:freetds:sqlserver://sqlserver/database, "user","database");
>
>How must I load the driver in Class.forName("??????")?
>For example, with JDBC-ODBC bridge it should be:
>
> Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");





Archive powered by MHonArc 2.6.24.

Top of Page