java


Connecting to external database through telnet


I have a java program that connects to a MS SQL database. The program works perfectly when running through eclipse however I get an error when I run it through AIX:
java.sql.SQLException: Network error IOException: A remote host refused an attempted connect operation.
I can successfully ping the server but am not able to telnet into the server. I am also not able to telnet from my windows desktop.
I am using jtds to connect:
String connectionString = "jdbc:jtds:sqlserver://"+dropez_ip_address+"/"+dropez_db_name;
ResultSet rs = null;
Statement stmt = null;
try{
Class.forName("net.sourceforge.jtds.jdbc.Driver");
Connection conn = DriverManager.getConnection(connectionString, dropez_db_username, dropez_db_password);
stmt = conn.createStatement();
}catch(Exception e){}
Here is some documentation from jTDS regarding the issue, but I am still not able to resolve the issue.
Why do I get java.sql.SQLException: "Network error IOException: Connection refused: connect" when trying to get a connection?
The "Connection refused" exception is thrown by jTDS when it is unable to connect to the server. There may be a number of reasons why this could happen:
- The server name is misspelled or the port number is incorrect.
- SQL Server is not configured to use TCP/IP. Either enable TCP/IP from SQL Server's Network Utility app or have jTDS connect via named pipes (see the URL format for information on how to do this).
- There is a firewall blocking port 1433 on the server.
To check whether TCP/IP is enabled and the port is not blocked you can use "telnet 1433". Until telnet doesn't connect, jTDS won't either. If you can't figure out why, ask your network administrator for help.
Your SQL Server database probably doesn't have the TCP/IP protocol enabled, to enable it:
From the Microsoft SQL Server 2005 -> Configuration Tools, open the 'Microsoft SQL Server Configuration Manager'.
Expand ‘SQL Server 2005 Network Configuration’, and then click ‘Protocols for ’.
Right-click ‘TCP/IP’ and then click ‘Enable’. The icon for the protocol will change to show that the protocol is enabled.
For SQL Server 2008:
If you can't telnet on port 1433, you are blocked by a firewall somewhere in the middle between your machine and the server. That's not a java related problem.
May it be that when you say "it runs perfectly under eclipse but not AIX" you are taking about 2 different computers ? If so, the one with eclipse is not firewalled, the one where you deploy your app is blocked.
But again, nothing to do with java. It's a level 3 error (TCP layer) of TCP-IP model.
Regards,
Stéphane

Related Links

Using Java String split() as simple “parser”
spark changing dataframe to rdd : column order changes in RDD
App Crashing when calling a Fragment from an Activity
Returning a substring's content vs. returning the substring itself
Click OK on alert Selenium Webdriver
Query#scroll() was deprecated for what in Hibernate?
Parse Json output from Sonar
Pass unix path from Java properties “-D”
succession of addition, calculator
Java reading text file with delimiter and pushing into an array
trouble understanding implementation of hash table with chaining
synchronized threads not blocking each other
Eclipse/Java (Plug-in Development) - Documenting Error Messages
Using Spring loaded in spring mvc framework
I want to retrieve the saved movies data from database and show it to user android
Date and time not updating

Categories

HOME
bluetooth
urbancode
google-api-php-client
dot
sharepoint-designer
rubygems
twitter-bootstrap-4
callback
gitpitch
elasticsearch-hadoop
kibana-4
nstableview
fallback
clojurescript
after-effects
ml
tar
extjs5
crystal-reports-2010
buildbot
kannel
tooltipster
rst2pdf
maxmind
jaxb2
r-raster
preg-match-all
pim
repo
sequential
hockeyapp
code-search-engine
az-application-insights
android-fingerprint-api
ansible-playbook
particles.js
jvm-languages
http-redirect
websphere-mq-fte
google-datalayer
python-c-api
powercli
gabor-filter
drupal-6
jxcore
composite-key
namecoin
memory-alignment
spring-mongodb
chord-diagram
gnome-shell-extensions
cubes
color-picker
multi-level
mikroc
bstr
storekit
markojs
persist
nessus
jfugue
msys
fouc
ibaction
e10s
geonetwork
camanjs
gadt
wordpress-theme-customize
typo3-neos
centos5
uv-mapping
quartz-graphics
ocunit
jquery-knob
chuck
funscript
buildr
removeclass
semantic-diff
assembly-loading
spyware
locate
mongomapper
floating
datareader
web-application-design
sproutcore-2
libs
boost-smart-ptr
ubuntu-9.04

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App