aspose file tools*
The moose likes JDBC and the fly likes unable to connect Sybase using real ip Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "unable to connect Sybase using real ip" Watch "unable to connect Sybase using real ip" New topic
Author

unable to connect Sybase using real ip

hesham katon
Ranch Hand

Joined: Dec 18, 2002
Posts: 82
Hello All,

when i am working using localhost, it works fine

String MM_bassami_DRIVER = "com.sybase.jdbc3.jdbc.SybDriver";
String MM_bassami_USERNAME = "dba";
String MM_bassami_PASSWORD = "sql";
String database="myDB";
String MM_bassami_STRING = "jdbc:sybase:Tds:localhost:2638";

Driver Driverrs_news = (Driver)Class.forName(MM_bassami_DRIVER).newInstance();
Connection Connrs_news = DriverManager.getConnection(MM_bassami_STRING,MM_bassami_USERNAME,MM_bassami_PASSWORD);
........

when i place the real ip instead of "localhost" it gives me this error :

java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings chained to this exception for the reason(s)

should i change port number when i use real ip ?

Please Help


Hesham Katon<br />SCJP 1.2<br />SCWCD 1.4<br />Better to light a candle than to curse the darkness
Remko Strating
Ranch Hand

Joined: Dec 28, 2006
Posts: 893
I don't have problems by connecting to sybase using the real ip.

Only in the standaard configuration sybase is on port 5001 did you change that. Also posting your backtrace of your exception would help.

Try 127.0.0.1 instead of localhost, because I believe your sybase server isn't named localhost.


Remko (My website)
SCJP 1.5, SCWCD 1.4, SCDJWS 1.4, SCBCD 1.5, ITIL(Manager), Prince2(Practitioner), Reading/ gaining experience for SCEA,
hesham katon
Ranch Hand

Joined: Dec 18, 2002
Posts: 82
Thanks Remko for your reply
i have tried to connect using 127.0.0.1 and it works fine when i try to access the database from the same computer

but it seems the problem only happens when i try to access the database using another computer through the internet

also , my default sybase port here is 2638 , and this port works fine from the same computer

a friend told me that this may be security issue , i stopped the firewall on that computer , but it doesnt work yet

also this may be that database doesn't accept outside connections , but i don't know how to change this configuration

wish anyone can help

thanks in advacne
hesham katon
Ranch Hand

Joined: Dec 18, 2002
Posts: 82
i found out the solution of that problem
i was running the Sybase using "Sybase Central"

but i have to run it using "dbserv8.exe"

when i do that i can access it from my computer here

but i have another problem now when i try to run my application on the hosting company, it gives me this error :
java.sql.SQLException: JZ006: Caught IOException: java.net.ConnectException: Connection timed out

it's very strange, because i can run the same application from my pc here , and it access the same db well

wish anyone can help

thank you so much
hesham katon
Ranch Hand

Joined: Dec 18, 2002
Posts: 82
a strange thing also happens :

even when i shutdown the database , the same error still occur

Connection timed out

???
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to connect Sybase using real ip