import java.sql.*;                  // JDBC packageString url = "jdbc:inetdae:localhost?sql7=true"; // use your hostname and port number here
String login = "sa";     // use your login here
String password = "";     // use your password here try {
DriverManager.setLogStream(System.out); // to create more info 
  // for technical support

//load the class with the driver
//Class.forName("com.inet.tds.TdsDriver"); // JDK,Netscape
//or
Class.forName("com.inet.tds.TdsDriver").newInstance(); // JDK,Netscape,IE
//or
//new com.inet.tds.TdsDriver(); // JDK,Netscape,IE
//set a timeout for login and query
DriverManager.setLoginTimeout(10);
//open a connection to the database
Connection connection = DriverManager.getConnection(url,login,password); //to get the driver version
        DatabaseMetaData conMD = connection.getMetaData();
        System.out.println("Driver Name:\t"    + conMD.getDriverName());
        System.out.println("Driver Version:\t" + conMD.getDriverVersion()); //select a database
connection.setCatalog( "MyDatabase"); //create a statement
Statement st = connection.createStatement(); //execute a query
ResultSet rs = st.executeQuery("SELECT * FROM tblExample"); // read the data and put it to the console
while (rs.next()){
for(int j=1; j<=rs.getMetaData().getColumnCount(); j++){
System.out.print( rs.getObject(j)+"\t");
}
System.out.println();    
}
//close the objects
st.close();
connection.close(); } catch(Exception e) {
e.printStackTrace();
}