Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Cannot connect to Sybase DB from

9 views
Skip to first unread message

Dan Ward

unread,
May 10, 2000, 3:00:00 AM5/10/00
to
First I run [ Start Menu \ Programs \ SyBase \ SQL Advantage ] and I choose CONNECT and I fill in these values:
Server:      Rollingstones
Login:       mick
Password:    jaggar
Client:      Rollingstones
and I get connected!  WHO-HOOO!  I can execute SQL and see the tables that I created using BAT files!

But when I try to compile and execute this JAVA code

import java.sql.DriverManager;
import java.sql.Connection;
import java.lang.ClassNotFoundException;
import java.sql.SQLException;
public class SybaseTry
{
        public static void main( String args[] )
        {
                System.out.println("Starting!");
 
                String driver="com.sybase.jdbc2.jdbc.SybDriver";
                String dsn="jdbc:sybase:Tds:rollingstones:5000";
                String dbUserName="mick";
                String dbPassword="jaggar";
                Connection con=null;
 
                try
                {
                        Class.forName(driver);
                        con = DriverManager.getConnection(dsn, dbUserName, dbPassword);
                }
                catch (ClassNotFoundException cnfx)
                {
                        cnfx.printStackTrace();
                        System.exit(0);
                }
                catch (SQLException sqlx)
                {
                        sqlx.printStackTrace();
                        System.exit(0);
                }
 
                System.out.println("Completed!");
        }
 
}//END SybaseTry
I get this:
G:\temp>d:\jdk1.2.2\bin\javac.exe SybaseTry.java

G:\temp>d:\jdk1.2.2\bin\java.exe SybaseTry
Starting!
java.sql.SQLException: JZ006: Caught IOException: java.net.ConnectException: Connection refused: no further
information
        at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:423)
        at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:2780)
        at com.sybase.jdbc2.tds.Tds.login(Tds.java:338)
        at com.sybase.jdbc2.jdbc.SybConnection.tryLogin(SybConnection.java, Compiled Code)
        at com.sybase.jdbc2.jdbc.SybConnection.regularConnect(SybConnection.java:190)
        at com.sybase.jdbc2.jdbc.SybConnection.<init>(SybConnection.java:169)
        at com.sybase.jdbc2.jdbc.SybConnection.<init>(SybConnection.java:122)
        at com.sybase.jdbc2.jdbc.SybDriver.connect(SybDriver.java:175)
        at java.sql.DriverManager.getConnection(DriverManager.java:457)
        at java.sql.DriverManager.getConnection(DriverManager.java:137)
        at SybaseTry.main(SybaseTry.java:29)

G:\temp>


Any suggestions?
 
 

--
Book'em, Dano.
                                                                    What's the charge?
"MURDER ONE"
 
 

Lance Andersen

unread,
May 11, 2000, 3:00:00 AM5/11/00
to
Connection refused indicates the hostname and or port is incorrect.

--
===============================================================================
Lance J. Andersen Email: lan...@sybase.com
Sybase Product Support Engineering Phone:(781) 564-6336
77 South Bedford Street Fax: (781) 564-7001
Burlington, MA 01803

The Dark Knight Returns!!! Let's Go Penguins!!!
===============================================================================

Dan Ward

unread,
May 11, 2000, 3:00:00 AM5/11/00
to
Since I can connect from SQL Advantage, the hostname is correct. I am damned if I
can find any references to where the PORT number is set. I have tried all the PORT
numbers used in the example programs that came with JConnect. What is the default
port number from the INSTALL?


Lance Andersen wrote:

> Connection refused indicates the hostname and or port is incorrect.
>
> Dan Ward wrote:
> >

> --
> ===============================================================================
> Lance J. Andersen Email: lan...@sybase.com
> Sybase Product Support Engineering Phone:(781) 564-6336
> 77 South Bedford Street Fax: (781) 564-7001
> Burlington, MA 01803
>
> The Dark Knight Returns!!! Let's Go Penguins!!!
> ===============================================================================

--


Book'em, Dano.
What's the
charge?
"MURDER ONE"

--
Dan Ward - Software Engineer - XMLSolutions - (704) 849-2704

Eusebio

unread,
May 11, 2000, 3:00:00 AM5/11/00
to Dan Ward
I think the default port is 7100 but there is no rule...
Look your ODBC driver config : SQL advantage use it.

Dan Ward wrote:

> Since I can connect from SQL Advantage, the hostname is correct. I am damned if I
> can find any references to where the PORT number is set. I have tried all the PORT
> numbers used in the example programs that came with JConnect. What is the default
> port number from the INSTALL?
>
> Lance Andersen wrote:
>
> > Connection refused indicates the hostname and or port is incorrect.
> >
> > Dan Ward wrote:
> > >

> > --
> > ===============================================================================
> > Lance J. Andersen Email: lan...@sybase.com
> > Sybase Product Support Engineering Phone:(781) 564-6336
> > 77 South Bedford Street Fax: (781) 564-7001
> > Burlington, MA 01803
> >
> > The Dark Knight Returns!!! Let's Go Penguins!!!
> > ===============================================================================
>

> --
> Book'em, Dano.
> What's the
> charge?
> "MURDER ONE"

Lance Andersen

unread,
May 12, 2000, 3:00:00 AM5/12/00
to
SQL Advantage uses an interface entry which is in the sql.ini file.

- Your ASE must have a tcp listener and if it does you can look at your
sql.ini to determine what port the server is listening on.

Dan Ward wrote:
>
> Since I can connect from SQL Advantage, the hostname is correct. I am damned if I
> can find any references to where the PORT number is set. I have tried all the PORT
> numbers used in the example programs that came with JConnect. What is the default
> port number from the INSTALL?
>
> Lance Andersen wrote:
>
> > Connection refused indicates the hostname and or port is incorrect.
> >
> > Dan Ward wrote:
> > >

> > --
> > ===============================================================================
> > Lance J. Andersen Email: lan...@sybase.com
> > Sybase Product Support Engineering Phone:(781) 564-6336
> > 77 South Bedford Street Fax: (781) 564-7001
> > Burlington, MA 01803
> >
> > The Dark Knight Returns!!! Let's Go Penguins!!!
> > ===============================================================================
>

> --
> Book'em, Dano.
> What's the
> charge?
> "MURDER ONE"

> --
> Dan Ward - Software Engineer - XMLSolutions - (704) 849-2704

--

manas_de45

unread,
Jun 27, 2000, 3:00:00 AM6/27/00
to
Hi there,

I am facing a problem related to servlet.

I have an applet which is making a database connection and
adding records to the table. the database is sql server 6.5 this
applet is running fine from a client site if i am running it
with appletviewer.

when i am emdeding this applet in a servlet and trying to run it
from IE5, it is not adding any records to the table. the servlet
is coming onto the client side IE5 but not updating the records
in the table.

the java web server 2.0 and the sql database server 6.5 are on
the same windows nt 4.0 server. i am using jdk1.2 and jsdk2.0
for development.

please let me know what could be the problem. do we have to
configure the database on the web server. if yes then please let
me know the process.

my email id is manas...@usa.net


thanks and regards,

manas dey.


Got questions? Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com


0 new messages