Skip to Content.
Sympa Menu

freetds - Re: Solaris access to a MS SQL Database

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Steve Sherwood" <stephens AT cabletron.com>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Solaris access to a MS SQL Database
  • Date: Thu, 11 Nov 1999 13:16:11


On Wed, 10 Nov 1999 13:1:44, Dan Gregoria wrote:

>Compiling and running my Java program (uses JDBC)on NT gave a useful result
>in that I was able to access a MS SQL Server database located on a separate
>NT server.
>
>Moving the source to a new install of JDK 1.1.8 on Solaris 2.5.1, then
>comiling and running it gave the following error messsages. My code put
>out diagnostics with "***" prefix:

Don't use the ODBC bridge for java, it's buggy. Get the FreeTDS JDBC
drivers, install in your classpath, and do something like the code below.
I use the same code for solaris, linux and NT, connecting to MSSQL 6.5 and 7
with no problems.

import java.io.*;
import java.sql.*;
import java.net.URL;

public class foo {
public static void main(String s[])
{
Connection con;
try {
Class.forName("com.internetcds.jdbc.tds.Driver");

Class.forName("com.internetcds.jdbc.tds.SybaseDriver");

con = DriverManager.getConnection(
"jdbc:freetds://Host/Database", "Login",
"Password");

Statement stmt = con.createStatement();
stmt.executeQuery("SELECT * FROM Spam");

stmt.close();
con.close();
}
catch (SQLException e) {
System.out.println(e.getMessage());
}
catch (ClassNotFoundException e) {
System.out.println(e.getMessage());
}
}
}


---
Steve Sherwood - stephens AT ctron.com - (01635) 810517
O---------------------------------+-----------------------O
| Just like Pariah I have no name | Never feed your cat |
| Living in a blaze of obscurity | anything that clashes |
| Need courage to survive the day | with the carpet... |
O---------------------------------+-----------------------O
(A)bort (R)etry (I)nfluence with large hammer






Archive powered by MHonArc 2.6.24.

Top of Page