Skip to Content.
Sympa Menu

freetds - SV: Re: JDBC Connection string?

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: SV: Re: JDBC Connection string?
  • Date: Mon, 11 Dec 2000 16:55:14 +0100

Thank you very much!!  Finally got it working now.
 
/Daniel
-----Ursprungligt meddelande-----
Från: bounce-freetds-122119 AT franklin.oit.unc.edu [mailto:bounce-freetds-122119 AT franklin.oit.unc.edu]För Pier Paolo Bortone
Skickat: den 11 december 2000 16:59
Till: TDS Development Group
Ämne: [freetds] Re: JDBC Connection string?

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
---
You are currently subscribed to freetds as: [daniel.selin AT home.se]
To unsubscribe, forward this message to $subst('Email.Unsub')



Archive powered by MHonArc 2.6.24.

Top of Page