Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

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

 
   Database Help (Home) -> JDBC Driver RSS
Next:  ResultSet.getTimestamp() truncating trailing zero..  
Author Message
WSalomon

External


Since: Jul 10, 2008
Posts: 2



(Msg. 1) Posted: Thu Jul 10, 2008 10:01 am
Post subject: JTDS Driver Connect Problem - one works, one doesn't
Archived from groups: microsoft>public>sqlserver>jdbcdriver (more info?)

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!

 >> Stay informed about: JTDS Driver Connect Problem - one works, one doesn't 
Back to top
Login to vote
Evan T. Basalik (MSFT)

External


Since: Nov 21, 2006
Posts: 24



(Msg. 2) Posted: Tue Jul 15, 2008 8:44 pm
Post subject: RE: JTDS Driver Connect Problem - one works, one doesn't [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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=?=
>Subject: JTDS Driver Connect Problem - one works, one doesn't
>Date: Thu, 10 Jul 2008 10:01:04 -0700
>Lines: 55
>Message-ID:
>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.

 >> Stay informed about: JTDS Driver Connect Problem - one works, one doesn't 
Back to top
Login to vote
WSalomon

External


Since: Jul 10, 2008
Posts: 2



(Msg. 3) Posted: Tue Jul 15, 2008 10:32 pm
Post subject: RE: JTDS Driver Connect Problem - one works, one doesn't [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Evan -

Thanks for you post.

Problem is solved - I delved in SQL-Server Configuration Manager, and
changed the settings to (which match those on the working Server):

SQL-Server 2005 Network Configuration-- Protocols for SQL$SERVER instance
-- -- TCP/IP Properties
-- -- -- Addresses
-- -- -- -- IP1 - TCP Port 1433
-- -- -- -- IPAll - TCP Port 1433

I'll be keeping your code snippet for future reference.

Thanks!
 >> Stay informed about: JTDS Driver Connect Problem - one works, one doesn't 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Getting zero terminated string through (both jTDS & MS) jd.. - Hi, I am having a curious problem that I verified now with both the MS JDBC Driver 1.2 and jTDS (both show same strange behaviour). The Strangeness is that it looks like I am receiving 0 terminated strings through the jTDS/MS JDBC driver, except the..

Cannot connect to my SQL 2005 server using JDBC - can any .. - Gurus, Running SQL Server 2005 SP2 and using named instances. I have an application which uses JDBC to connect to my SQL server. Connectivity using ODBC works just fine as I can test it successfully using a UDL file. However, this application fails...

New JDBC 1.2 driver runs slower than JDBC 1.1 driver-- exp.. - I have some test programs I run which do repeated simple SQL Select and SQL update statements. These test programs consistently take 5 to 10% longer to run with the new JDBC 1.2 driver than they do with the JDBC 1.1 driver. Is this expected? I..

MDX and JDBC Driver - Hi all, Anybody know if it possible to connect to an as2000 database and run mdx queries using the microsoft jdbc drivers? thanks, Peter

Register JDBC Driver - I'm new to Java and writing a test program to connect to a SQL Server 2000 database. I read and follow the instruction in KB article # Q313100. I have modifed the Classpath statement to include the 3 jar files. How do I register the driver? In the...
   Database Help (Home) -> JDBC Driver All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]