Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

JDBC connection

6 posts in General Discussion Last posting was on 2003-05-07 19:02:16.0Z
Gary Posted on 2003-05-07 16:11:16.0Z
Date: Wed, 07 May 2003 09:11:16 -0700
From: Gary <gary002@sbcglobal.net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4a) Gecko/20030401
X-Accept-Language: en-us, en
MIME-Version: 1.0
Subject: JDBC connection
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <uVnPdQLFDHA.222@forums-2-dub>
Newsgroups: ianywhere.public.general
NNTP-Posting-Host: adsl-67-116-49-136.dsl.sntc01.pacbell.net 67.116.49.136
Lines: 14
Path: forums-1-dub!forums-master.sybase.com!forums-2-dub.sybase.com
Xref: forums-1-dub ianywhere.public.general:994
Article PK: 3975

I have created a local database and I can connect to it via Sybase
Central with no problems. Now I am trying to connect to it using JDBC
and I am getting error JZ003 (Incorrect URL format).
As URL I specified following line:
jdbc:sybase:Tds://localhost:2638/<my database name>

I have tried all imaginable combinations for database name - full path
with disk (D:), truncated path, with .db suffix and without it, forward
slashes, back slashes, ?DSN=<my database name>, etc. No success.
Can someone tell me what I am doing wrong?


Shuchit Velkar Posted on 2003-05-07 16:43:03.0Z
Subject: Re: JDBC connection
From: Shuchit Velkar <svelkarNO@SPAMsybase.com>
References: <uVnPdQLFDHA.222@forums-2-dub>
Message-ID: <Xns937480608794CsvelkarNOsybaseSPAMc@10.22.241.106>
User-Agent: Xnews/5.04.25
Newsgroups: ianywhere.public.general
Date: Wed, 07 May 2003 09:43:03 -0700
NNTP-Posting-Host: svelkar-w2k.sybase.com 172.31.142.166
Lines: 22
Path: forums-1-dub!forums-master.sybase.com!forums-2-dub.sybase.com
Xref: forums-1-dub ianywhere.public.general:995
Article PK: 3977


Gary <gary002@sbcglobal.net> wrote in news:uVnPdQLFDHA.222@forums-2-dub:

> I have created a local database and I can connect to it via Sybase
> Central with no problems. Now I am trying to connect to it using JDBC
> and I am getting error JZ003 (Incorrect URL format).
> As URL I specified following line:
> jdbc:sybase:Tds://localhost:2638/<my database name>
>
> I have tried all imaginable combinations for database name - full path
> with disk (D:), truncated path, with .db suffix and without it, forward
> slashes, back slashes, ?DSN=<my database name>, etc. No success.
> Can someone tell me what I am doing wrong?
>
>

Try jdbc:sybase:Tds:localhost:2638/<my database name>


--
Shuchit Velkar
iAnywhere Solutions
Professional Services
Please only post to the newsgroup

EBFs and Whitepapers
http://www.ianywhere.com/developer


Nick Elson Posted on 2003-05-07 17:43:47.0Z
From: "Nick Elson" <no_spam_nicelson@sybase.com>
References: <uVnPdQLFDHA.222@forums-2-dub> <Xns937480608794CsvelkarNOsybaseSPAMc@10.22.241.106>
Subject: Re: JDBC connection
Date: Wed, 7 May 2003 13:43:47 -0400
Lines: 62
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <u0liSEMFDHA.344@forums-2-dub>
Newsgroups: ianywhere.public.general
NNTP-Posting-Host: nicelson-xp.sybase.com 172.31.142.76
Path: forums-1-dub!forums-master.sybase.com!forums-2-dub.sybase.com
Xref: forums-1-dub ianywhere.public.general:996
Article PK: 2975

Actually if you must specify a database name (ie. if you are not picking the
1st <ie. default> database or you want to prevent an accidental connection
to the wrong database) then you'll want to utilize ServiceName parameter
to specify that:

Reference:
Adaptive Server Anywhere Programming Guide
5. Data Access Using JDBC
Using the jConnect JDBC driver
Supplying a URL for the server

Specifying a database on a server

----------------------------------------------------------------------------
----

Each Adaptive Server Anywhere server may have one or more databases loaded
at a time. The URL as described above specifies a server, but does not
specify a database. The connection attempt is made to the default database
on the server.

You can specify a particular database by providing an extended form of the
URL in one of the following ways.

Using the ServiceName parameter
jdbc:sybase:Tds:machine-name:port-number?ServiceName=DBNThe question mark
followed by a series of assignments is a standard way of providing arguments
to a URL. The case of servicename is not significant, and there must be no
spaces around the = sign. The DBN parameter is the database name.

"Shuchit Velkar" <svelkarNO@SPAMsybase.com> wrote in message
news:Xns937480608794CsvelkarNOsybaseSPAMc@10.22.241.106...
> Gary <gary002@sbcglobal.net> wrote in news:uVnPdQLFDHA.222@forums-2-dub:
>
> > I have created a local database and I can connect to it via Sybase
> > Central with no problems. Now I am trying to connect to it using JDBC
> > and I am getting error JZ003 (Incorrect URL format).
> > As URL I specified following line:
> > jdbc:sybase:Tds://localhost:2638/<my database name>
> >
> > I have tried all imaginable combinations for database name - full path
> > with disk (D:), truncated path, with .db suffix and without it, forward
> > slashes, back slashes, ?DSN=<my database name>, etc. No success.
> > Can someone tell me what I am doing wrong?
> >
> >
>
> Try jdbc:sybase:Tds:localhost:2638/<my database name>
>
>
> --
> Shuchit Velkar
> iAnywhere Solutions
> Professional Services
> Please only post to the newsgroup
>
> EBFs and Whitepapers
> http://www.ianywhere.com/developer


Jason Hinsperger Posted on 2003-05-07 18:48:53.0Z
From: "Jason Hinsperger" <NOJason_HinspergerSPAM@hotmail.com>
References: <uVnPdQLFDHA.222@forums-2-dub> <Xns937480608794CsvelkarNOsybaseSPAMc@10.22.241.106> <u0liSEMFDHA.344@forums-2-dub>
Subject: Re: JDBC connection
Date: Wed, 7 May 2003 14:48:53 -0400
Lines: 96
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <Okx1BnMFDHA.331@forums-1-dub>
Newsgroups: ianywhere.public.general
NNTP-Posting-Host: hinsperg-pc1.sybase.com 172.31.143.226
Path: forums-1-dub!forums-master.sybase.com!forums-1-dub.sybase.com
Xref: forums-1-dub ianywhere.public.general:998
Article PK: 3983

Actually, while what Nick says is true, you should use the SetRemotePassword
mechanism to set any of the ASA extended connection options (such as DBN or
DBF) as follows. Using servicename will not work in some cases.

props = new Properties();
props.put( "User", "DBA" );
props.put( "Password", "SQL" );
sybDrvr.setRemotePassword( null, "dbf=asademo.db", props );
Connection con = DriverManager.getConnection( "jdbc:sybase:Tds:localhost",
props );

This is referenced in the docs.
5. Data Access Using JDBC
Using the jConnect JDBC driver
Supplying a URL for the server

--
Jason Hinsperger
International and Sustaining Engineering
iAnywhere Solutions

Whitepapers, TechDocs, and bug fixes are all available through the iAnywhere
Developer Community at www.ianywhere.com/developer
--

"Nick Elson" <no_spam_nicelson@sybase.com> wrote in message
news:u0liSEMFDHA.344@forums-2-dub...
> Actually if you must specify a database name (ie. if you are not picking
the
> 1st <ie. default> database or you want to prevent an accidental connection
> to the wrong database) then you'll want to utilize ServiceName parameter
> to specify that:
>
> Reference:
> Adaptive Server Anywhere Programming Guide
> 5. Data Access Using JDBC
> Using the jConnect JDBC driver
> Supplying a URL for the server
>
> Specifying a database on a server
>
> --------------------------------------------------------------------------
--
> ----
>
> Each Adaptive Server Anywhere server may have one or more databases loaded
> at a time. The URL as described above specifies a server, but does not
> specify a database. The connection attempt is made to the default database
> on the server.
>
> You can specify a particular database by providing an extended form of the
> URL in one of the following ways.
>
> Using the ServiceName parameter
> jdbc:sybase:Tds:machine-name:port-number?ServiceName=DBNThe question mark
> followed by a series of assignments is a standard way of providing
arguments
> to a URL. The case of servicename is not significant, and there must be no
> spaces around the = sign. The DBN parameter is the database name.
>
>
>
> "Shuchit Velkar" <svelkarNO@SPAMsybase.com> wrote in message
> news:Xns937480608794CsvelkarNOsybaseSPAMc@10.22.241.106...
> > Gary <gary002@sbcglobal.net> wrote in news:uVnPdQLFDHA.222@forums-2-dub:
> >
> > > I have created a local database and I can connect to it via Sybase
> > > Central with no problems. Now I am trying to connect to it using JDBC
> > > and I am getting error JZ003 (Incorrect URL format).
> > > As URL I specified following line:
> > > jdbc:sybase:Tds://localhost:2638/<my database name>
> > >
> > > I have tried all imaginable combinations for database name - full path
> > > with disk (D:), truncated path, with .db suffix and without it,
forward
> > > slashes, back slashes, ?DSN=<my database name>, etc. No success.
> > > Can someone tell me what I am doing wrong?
> > >
> > >
> >
> > Try jdbc:sybase:Tds:localhost:2638/<my database name>
> >
> >
> > --
> > Shuchit Velkar
> > iAnywhere Solutions
> > Professional Services
> > Please only post to the newsgroup
> >
> > EBFs and Whitepapers
> > http://www.ianywhere.com/developer
>
>


Gary Greenberg Posted on 2003-05-07 18:41:18.0Z
Date: Wed, 07 May 2003 11:41:18 -0700
From: Gary Greenberg <gary.greenberg@lmco.com>
User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.4a) Gecko/20030401
X-Accept-Language: en-us, en
MIME-Version: 1.0
Subject: Re: JDBC connection
References: <uVnPdQLFDHA.222@forums-2-dub> <Xns937480608794CsvelkarNOsybaseSPAMc@10.22.241.106> <u0liSEMFDHA.344@forums-2-dub>
In-Reply-To: <u0liSEMFDHA.344@forums-2-dub>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <utUaWkMFDHA.222@forums-2-dub>
Newsgroups: ianywhere.public.general
NNTP-Posting-Host: edge2a.lmco.com 192.91.147.194
Lines: 72
Path: forums-1-dub!forums-master.sybase.com!forums-2-dub.sybase.com
Xref: forums-1-dub ianywhere.public.general:997
Article PK: 3985


Nick Elson wrote:

> Actually if you must specify a database name (ie. if you are not picking the
> 1st <ie. default> database or you want to prevent an accidental connection
> to the wrong database) then you'll want to utilize ServiceName parameter
> to specify that:
>
> Reference:
> Adaptive Server Anywhere Programming Guide
> 5. Data Access Using JDBC
> Using the jConnect JDBC driver
> Supplying a URL for the server
>
> Specifying a database on a server
>
> ----------------------------------------------------------------------------
> ----
>
> Each Adaptive Server Anywhere server may have one or more databases loaded
> at a time. The URL as described above specifies a server, but does not
> specify a database. The connection attempt is made to the default database
> on the server.
>
> You can specify a particular database by providing an extended form of the
> URL in one of the following ways.
>
> Using the ServiceName parameter
> jdbc:sybase:Tds:machine-name:port-number?ServiceName=DBNThe question mark
> followed by a series of assignments is a standard way of providing arguments
> to a URL. The case of servicename is not significant, and there must be no
> spaces around the = sign. The DBN parameter is the database name.
>
>
>
> "Shuchit Velkar" <svelkarNO@SPAMsybase.com> wrote in message
> news:Xns937480608794CsvelkarNOsybaseSPAMc@10.22.241.106...
>
>>Gary <gary002@sbcglobal.net> wrote in news:uVnPdQLFDHA.222@forums-2-dub:
>>
>>
>>>I have created a local database and I can connect to it via Sybase
>>>Central with no problems. Now I am trying to connect to it using JDBC
>>>and I am getting error JZ003 (Incorrect URL format).
>>>As URL I specified following line:
>>>jdbc:sybase:Tds://localhost:2638/<my database name>
>>>
>>>I have tried all imaginable combinations for database name - full path
>>>with disk (D:), truncated path, with .db suffix and without it, forward
>>>slashes, back slashes, ?DSN=<my database name>, etc. No success.
>>>Can someone tell me what I am doing wrong?
>>>
>>>
>>
>>Try jdbc:sybase:Tds:localhost:2638/<my database name>
>>
>>
>>--
>>Shuchit Velkar
>>iAnywhere Solutions
>>Professional Services
>>Please only post to the newsgroup
>>
>>EBFs and Whitepapers
>>http://www.ianywhere.com/developer
>
>
>

I tried both suggestions and the result is the same.
I have only one database on this machine.
I am knew to iAnywhere, so forgive my ignorance.
I had no problems to do the same thing with ASE.
But with ASE I have server running all the time.
With iAnywhere it shuts down with disconnect.
Do I need to have it reconfigured.
I just installed it with default settings and I am
practicing for now.
With my database path D:\SDF\Workarea\Db\practice.db
what should I put as DBN?


Nick Elson Posted on 2003-05-07 19:02:16.0Z
From: "Nick Elson" <no_spam_nicelson@sybase.com>
References: <uVnPdQLFDHA.222@forums-2-dub> <Xns937480608794CsvelkarNOsybaseSPAMc@10.22.241.106> <u0liSEMFDHA.344@forums-2-dub> <utUaWkMFDHA.222@forums-2-dub>
Subject: Re: JDBC connection
Date: Wed, 7 May 2003 15:02:16 -0400
Lines: 39
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <u5eRCwMFDHA.344@forums-2-dub>
Newsgroups: ianywhere.public.general
NNTP-Posting-Host: nicelson-xp.sybase.com 172.31.142.76
Path: forums-1-dub!forums-master.sybase.com!forums-2-dub.sybase.com
Xref: forums-1-dub ianywhere.public.general:999
Article PK: 2981


> I have only one database on this machine.
> I am new to iAnywhere, so forgive my ignorance.
> I had no problems to do the same thing with ASE.
. . .
> With my database path D:\SDF\Workarea\Db\practice.db
> what should I put as DBN?

DBN would be just "PRACTICE" in that case.

The use of /DATABSE in the URL is not supported in ASA (the
connectivity model is different from ASE) and aving that in the URL
may confuse things (so make sure you remove that in your tests)..

> But with ASE I have server running all the time.
. . .
> With iAnywhere it shuts down with disconnect.

But if you are trying to start a DBSRV8 process, the TDS protocol
cannot do that for you. Sorry but there is no one listening unless
there is a server running initially.

> Do I need to have it reconfigured.
> I just installed it with default settings and I am
> practicing for now.

You will want to consider autostarting it either as a NT/2000/XP service
(see the docs), or from a startup group (see the platform docs).


Note if you have a running server but need to start another database
on that then read further on that same reference see the section
about

Using the RemotePWD parameter

(which, by the way, IS NOT a URL parameter at all). That takes extra
programming and is not a simple matter of just wiring the URL.