RE: JTDS Driver Connect Problem - one works, one doesn't



Do you have the same problem with the Microsoft JDBC driver (http://www.microsoft.com/downloads/details.aspx?FamilyId=C47053EB-3B64-4794-950D-
81E1EC91C1BA&displaylang=en) using the code below?

import java.*;

public class Connect{
private java.sql.Connection con = null;
private final String url = "jdbc:sqlserver://";
private final String serverName= "evanbagx620\\sql2007";
private final String portNumber = "4141";
private final String databaseName= "AdventureWorks";
private final String userName = "username";
private final String password = "password";
// Informs the driver to use server a side-cursor,
// which permits more than one active statement
// on a connection.
private final String selectMethod = "cursor";

// Constructor
public Connect(){}

private String getConnectionUrl(){
return url+serverName+":" + portNumber +";databaseName="+databaseName+";selectMethod="+selectMethod+";";
}

private java.sql.Connection getConnection(){
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = java.sql.DriverManager.getConnection(getConnectionUrl(),userName,password);
if(con!=null) System.out.println("Connection Successful!");
}catch(Exception e){
e.printStackTrace();
System.out.println("Error Trace in getConnection() : " + e.getMessage());
}
return con;
}

/*
Display the driver properties, database details
*/

public void displayDbProperties(){
java.sql.DatabaseMetaData dm = null;
java.sql.ResultSet rs = null;
try{
con= this.getConnection();
if(con!=null){
dm = con.getMetaData();
System.out.println("Driver Information");
System.out.println("\tDriver Name: "+ dm.getDriverName());
System.out.println("\tDriver Version: "+ dm.getDriverVersion ());
System.out.println("\nDatabase Information ");
System.out.println("\tDatabase Name: "+ dm.getDatabaseProductName());
System.out.println("\tDatabase Version: "+ dm.getDatabaseProductVersion());
System.out.println("Avalilable Catalogs ");
rs = dm.getCatalogs();
while(rs.next()){
System.out.println("\tcatalog: "+ rs.getString(1));
}
rs.close();
rs = null;
closeConnection();
}else System.out.println("Error: No active Connection");
}catch(Exception e){
e.printStackTrace();
}
dm=null;
}

private void closeConnection(){
try{
if(con!=null)
con.close();
con=null;
}catch(Exception e){
e.printStackTrace();
}
}


public static void main(String[] args) throws Exception
{
Connect myDbTest = new Connect();
myDbTest.displayDbProperties();
}
}

--------------------
Thread-Topic: JTDS Driver Connect Problem - one works, one doesn't
thread-index: Acjiromu11DpsGVOR6ShIAjHkWf9YQ==
X-WBNR-Posting-Host: 207.46.19.197
From: =?Utf-8?B?V1NhbG9tb24=?= <WSalomon@xxxxxxxxxxxxxxxxxxxxxxxxx>
Subject: JTDS Driver Connect Problem - one works, one doesn't
Date: Thu, 10 Jul 2008 10:01:04 -0700
Lines: 55
Message-ID: <8C940B62-C930-4607-A773-6F97804EF9A0@xxxxxxxxxxxxx>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2992
Newsgroups: microsoft.public.sqlserver.jdbcdriver
Path: TK2MSFTNGHUB02.phx.gbl
Xref: TK2MSFTNGHUB02.phx.gbl microsoft.public.sqlserver.jdbcdriver:547
NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
X-Tomcat-NG: microsoft.public.sqlserver.jdbcdriver

I'm having a problem connecting to SQL-Server 2005 using the JTDS 1.22 JDBC
driver.

This occurs for only one of two SQL-Server 2005 instances I have. The
specifics are:

I have two machines, each loaded with SQL-Server 2005, one a 64-bit Server,
and one a 32-bit Laptop for development/demo purposes. The setups are
similar, but obviously not identical.

Server -
WinXP 64-bit SP2
SQL-Server 2005 64-bit - Windows Authorization (WA) and sa/password logins
SouceForge JTBS 1.22 JDBC driver
Oracle SQL-Developer 1.54 (target app which needs JTBS driver - the MS JDBC
doesn't work)

Laptop -
WinXP 32-bit SP3
SQL-Server 2005 32-bit - Windows Authorization and sa/password logins
SouceForge JTBS 1.22 JDBC driver
Oracle SQL-Developer 1.54 (target app which needs JTBS driver - the MS JDBC
doesn't work)

In short - they are very similar and the PATH's and CLASSPATH's are
virtually identical (save for C:\Program Files and C:\Program Files (x68)
which are altered as needed.on the 64-bit machine).

What works: Both the Server and the Laptop can log into the SQL-Server
64-bit instance on the Server without difficulties using the JTBS driver.
From the Server, I can use both WA and SA/password login, and can use a
machine name for either "localhost" or the server-name. From the Laptop, I
can use SA/password login and server-name. The JTBS driver is using port
1433 (default). Also, I can hit the Server database with the SQL-Server
native ODBC driver without difficulty from both machines (as expected).

What doesn't work: Both the Server and the Laptop *cannot* log into the
SQL-Server 32-bit instance on the Laptop using the JTBS driver. From the
Laptop, I've tried using both WA and SA/password login, and have tried using
both the "localhost" and the server-name, all without success. From the
Server, I've tried SA/password login and server-name, again without success.
The JTBS driver is using port 1433 (default). Each time I end up with
"cannot connect to database" errors, presumably from the JTBS driver.
Paradoxically, I can hit the Laptop database with the SQL-Server native ODBC
driver without difficulty from both machines.

This makes no sense to me given that I thought I had set up the SQL-Servers
almost identically, and that I can hit both databases with ODBC, but not
JDBC. One thought is there is some privileging problem, or maybe port 1433
is not the right one.

Any thoughts?

Thanks!



Evan T. Basalik
This posting is provided ?AS IS? with no warranties, and confers no rights.


.



Relevant Pages

  • JTDS Driver Connect Problem - one works, one doesnt
    ... I'm having a problem connecting to SQL-Server 2005 using the JTDS 1.22 JDBC ... I have two machines, each loaded with SQL-Server 2005, one a 64-bit Server, ... SouceForge JTBS 1.22 JDBC driver ... 64-bit instance on the Server without difficulties using the JTBS driver. ...
    (microsoft.public.sqlserver.jdbcdriver)
  • core install of Solaris 9 (sparc) package list can be trimmed ?
    ... This is a server that will have very specific reasons ... system SUNWadmr System & Network Administration Root ... system SUNWeu8os American English/UTF-8 L10N For OS Environment User Files ... system R SUNWfcip Sun FCIP IP/ARP over FibreChannel Device Driver ...
    (comp.unix.solaris)
  • Re: 2008 SBS no longer boots
    ... driver issue initially, the fact that it seems to happen randomly now ... weird with a hardware problem that consistently doesn't get through boot ... other customer, even a 2 week old one, the problem immediately returned. ... There was a time when a server was fired up with a specialized OS and had a battery of tests run against each component to purposefully stress it. ...
    (microsoft.public.windows.server.sbs)
  • Re: 2008 SBS no longer boots
    ... Intel raid card for Server 2003. ... install with one raid driver, or with the other raid driver. ... Any thermal issues and a lot of other hardware problems should show up ... other customer, even a 2 week old one, the problem immediately returned. ...
    (microsoft.public.windows.server.sbs)
  • Re: AD replication not working
    ... Verifying that the local machine cls21, is a Directory Server. ... The DFS Replication Event Log. ... Driver RICOH Aficio 3035 PCL 6 required for printer ... and then clear the Log spooler warning events check box. ...
    (microsoft.public.windows.server.active_directory)

Loading