You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "OFlaherty, Colm" <Co...@kbcam.com> on 2003/08/01 16:34:38 UTC

RE: Logical Server Name (Sybase database)

Chirag, 

I may be coming in late on this one, but heres what I know on the issue u're experiencing.. 

When u use most native (or ODBC) Sybase drivers, they go through the Sybase Open Client (CTLIB or DBLIB), doing a translation of the logical server name to the physical server name (and port number) though the SQL.INI file, as stored in %sybase%\ini\sql.ini.  

Funnily enough though, when u use the Sybase Jconnect drivers (which u seem to be, based on the JDBC URL below), they do <strong>NOT<strong> seem to do the logical-physical server translation thing, using the SQL.INI... why this is, I'm not sure, but that's my experience with it.  U can prove this using a non-Struts POJO which just uses the driver to connect to the database using the physical server name.  

The upshot of this (unless there is a way around it, which I'm not aware of) is that <strong> u have to pass the physical server name and port number in the JDBC connection URL, instead of just the local server name </strong>

If u really wanted to use the __logical__ server name, u could do the translation yourself before connecting, by looking up the %sybase%/ini/sql.ini file, and parsing it to produce the physical server name and port number.  This would certainly help maintenance (at the cost of some loss of DBMS independence), given that SQL.INI is the traditional method of naming and maintaining Sybase servers.

Hope this helps u understand your issue a little better.. 

Colm
 -----Original Message-----
From: 	Chirag Mehta [mailto:Chirag.Mehta@morganstanley.com] 
Sent:	01 August 2003 09:22
To:	Struts Users Mailing List
Subject:	Re: Logical Server Name

I cannot do that though because the port and the physical server is resolved
automatically from the interface file.

Any more suggestions?

Thanks for help anyway

Chirag

Jimmy Emmanual wrote:

> try adding the port # and a database name.
>
> <set-property property="url" value="jdbc:sybase:Tds:LNT_MAST:4100/testdb"/>
>
> -----Original Message-----
> From: Chirag Mehta [mailto:Chirag.Mehta@morganstanley.com]
> Sent: Thursday, July 31, 2003 1:40 PM
> To: struts-user
> Subject: Logical Server Name
>
> Hello,
>
> Can anyone help?
>
> I am using a BasicDataSource config in my config.xml file to reference a
> sybase database. Using a logical server name, the code gives me a
> IOException.
>
> in my config.xml:
> <set-property property="url" value="jdbc:sybase:Tds:LNT_MAST"/>
> exception::
> javax.servlet.ServletException: java.sql.SQLException: JZ003: Incorrect
> URL format. URL: LNT_MAST
>
> But if I use the physical server name I have no problems setting up the
> DB Connection. (Well I haven't got any exceptions so far)
>
> Has anyone got any idea of any code I may have to change for my app to
> resolve from the logical server name? (The logical server name resolves
> from a interface file which is on my network server)
>
> Thanks a million
>
> Chirag
> --
> NOTICE: If received in error, please destroy and notify sender.  Sender
> does not waive confidentiality or privilege, and use is prohibited.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org

--
NOTICE: If received in error, please destroy and notify sender.  Sender does
not waive confidentiality or privilege, and use is prohibited.





**********************************************************************
This message is sent in confidence for the addressee
only.  The contents are not allowed to be disclosed to
anyone other than the addressee.  Unauthorised 
recipients must preserve this confidentiality and should 
please advise the sender immediately of any error in
transmission.
**********************************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Logical Server Name (Sybase database)

Posted by Chirag Mehta <Ch...@morganstanley.com>.
I think so mate.

Thanks for the help!

Chirag

"OFlaherty, Colm" wrote:

> Chirag,
>
> I may be coming in late on this one, but heres what I know on the issue u're experiencing..
>
> When u use most native (or ODBC) Sybase drivers, they go through the Sybase Open Client (CTLIB or DBLIB), doing a translation of the logical server name to the physical server name (and port number) though the SQL.INI file, as stored in %sybase%\ini\sql.ini.
>
> Funnily enough though, when u use the Sybase Jconnect drivers (which u seem to be, based on the JDBC URL below), they do <strong>NOT<strong> seem to do the logical-physical server translation thing, using the SQL.INI... why this is, I'm not sure, but that's my experience with it.  U can prove this using a non-Struts POJO which just uses the driver to connect to the database using the physical server name.
>
> The upshot of this (unless there is a way around it, which I'm not aware of) is that <strong> u have to pass the physical server name and port number in the JDBC connection URL, instead of just the local server name </strong>
>
> If u really wanted to use the __logical__ server name, u could do the translation yourself before connecting, by looking up the %sybase%/ini/sql.ini file, and parsing it to produce the physical server name and port number.  This would certainly help maintenance (at the cost of some loss of DBMS independence), given that SQL.INI is the traditional method of naming and maintaining Sybase servers.
>
> Hope this helps u understand your issue a little better..
>
> Colm
>  -----Original Message-----
> From:   Chirag Mehta [mailto:Chirag.Mehta@morganstanley.com]
> Sent:   01 August 2003 09:22
> To:     Struts Users Mailing List
> Subject:        Re: Logical Server Name
>
> I cannot do that though because the port and the physical server is resolved
> automatically from the interface file.
>
> Any more suggestions?
>
> Thanks for help anyway
>
> Chirag
>
> Jimmy Emmanual wrote:
>
> > try adding the port # and a database name.
> >
> > <set-property property="url" value="jdbc:sybase:Tds:LNT_MAST:4100/testdb"/>
> >
> > -----Original Message-----
> > From: Chirag Mehta [mailto:Chirag.Mehta@morganstanley.com]
> > Sent: Thursday, July 31, 2003 1:40 PM
> > To: struts-user
> > Subject: Logical Server Name
> >
> > Hello,
> >
> > Can anyone help?
> >
> > I am using a BasicDataSource config in my config.xml file to reference a
> > sybase database. Using a logical server name, the code gives me a
> > IOException.
> >
> > in my config.xml:
> > <set-property property="url" value="jdbc:sybase:Tds:LNT_MAST"/>
> > exception::
> > javax.servlet.ServletException: java.sql.SQLException: JZ003: Incorrect
> > URL format. URL: LNT_MAST
> >
> > But if I use the physical server name I have no problems setting up the
> > DB Connection. (Well I haven't got any exceptions so far)
> >
> > Has anyone got any idea of any code I may have to change for my app to
> > resolve from the logical server name? (The logical server name resolves
> > from a interface file which is on my network server)
> >
> > Thanks a million
> >
> > Chirag
> > --
> > NOTICE: If received in error, please destroy and notify sender.  Sender
> > does not waive confidentiality or privilege, and use is prohibited.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
> --
> NOTICE: If received in error, please destroy and notify sender.  Sender does
> not waive confidentiality or privilege, and use is prohibited.
>
> **********************************************************************
> This message is sent in confidence for the addressee
> only.  The contents are not allowed to be disclosed to
> anyone other than the addressee.  Unauthorised
> recipients must preserve this confidentiality and should
> please advise the sender immediately of any error in
> transmission.
> **********************************************************************
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org

--
NOTICE: If received in error, please destroy and notify sender.  Sender does not waive confidentiality or privilege, and use is prohibited.