Skip to Content.
Sympa Menu

freetds - Re: JDBC Connection string?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Pier Paolo Bortone" <pierpaolo.bortone AT netengineering.it>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: JDBC Connection string?
  • Date: Mon, 11 Dec 2000 16:59:19 +0100

Hi,
here is an example to test connection.
 
Remember to modify username, password, hostname, dbname.
 
Good work.
 
Pier Paolo.
 
import java.sql.*;
import java.util.*;
 
public class MSSQLServerTestConnection {
 
    /**/
    static String username = "xxxxxxx";
    static String password = "xxxxxxx";
    static String thinConn = "jdbc:freetds:sqlserver://hostname/dbname";
    static String driverClass = "com.internetcds.jdbc.tds.Driver";
    /**/
 
    public static Connection getConnection() throws SQLException {
 
                Connection cn = null;
 
        try {
            Driver d = (Driver)Class.forName(driverClass).newInstance();
            cn = DriverManager.getConnection(thinConn,username,password);
 
            return cn;
        }  
        catch (Exception e) {
            e.printStackTrace(System.out);
            throw new SQLException("Error Loading JDBC Driver");
        }
    }
 
        public static void main(String argv[]) {
 
                try {
                        Connection conn = getConnection();
 
                        if (conn == null) {
                                System.out.println("Connessione nulla!!!");
                                System.exit(0);
                        }
                        else {
                                boolean b = conn.getAutoCommit();
                                System.out.println("Connessione riuscita!!!");
                                System.out.println("AutoCommit " + b);
                        }
                }
                catch (SQLException e) {
                        e.printStackTrace();
                }
        }
}             
----- Original Message -----
Sent: Monday, December 11, 2000 4:20 PM
Subject: [freetds] JDBC Connection string?

Hi, I'm using FreeTDS JDBC-Driver to connect to a MS SQL-Server 7 DB, but
have one question:

What's the format of the connection string "jdbc:freetds...something" ?

Thank's.

/Daniel

---
You are currently subscribed to freetds as: [pierpaolo.bortone AT netengineering.it]
To unsubscribe, forward this message to leave-freetds-121965M AT franklin.oit.unc.edu



Archive powered by MHonArc 2.6.24.

Top of Page