[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freetds
Subject:    Re: [freetds] Squirrel JDBC-ODBC Bridge and freeTDS ODBC
From:       <VZverev () genesis ! spb ! ru>
Date:       2005-11-08 13:40:36
Message-ID: 2F81A0E4C0BAF54892389F3642BA9DDC499962 () moon ! gen
[Download RAW message or body]

Ok, Frediano, as you wish. 
Squirrel has SQLConnection.java module (a nise setCatalog wrapper), which could outperform my workaround:
	public void setCatalog(String catalogName)
		throws SQLException
	{
		validateConnection();
		final Connection conn = getConnection();
		final String oldValue = conn.getCatalog();
		if (!StringUtilities.areStringsEqual(oldValue, catalogName))
		{
			try
			{
				conn.setCatalog(catalogName);
			}
			catch (SQLException ex)
			{
				// MS SQL Server throws an exception if the catalog name
				// contains a period without it being quoted.
				conn.setCatalog(quote(catalogName));     <-------------------- gotcha! 
			}
			getPropertyChangeReporter().firePropertyChange(IPropertyNames.CATALOG,
												oldValue, catalogName);
		}
	}

	perhaps it should looks like:

	if (!ex.getSQLState().equalsIgnoreCase("01000")) conn.setCatalog(quote(catalogName));
	else throw ex;  

Sincerely yours. 
-------------------------------------------------------
Vitaly Zverev, OCP DBA 8&8i
Oracle E-Business Suite &
Infiniband Linux Cluster Administrator
Genesis Ltd., St.Petersburg, Russia

 

> -----Original Message-----
> From: freetds-bounces@lists.ibiblio.org 
> [mailto:freetds-bounces@lists.ibiblio.org] On Behalf Of 
> ZIGLIO, Frediano, VF-IT
> Sent: Tuesday, November 08, 2005 11:51 AM
> To: FreeTDS Development Group
> Subject: Re: [freetds] Squirrel JDBC-ODBC Bridge and freeTDS ODBC
> 
>  
> > Thanks Frediano,
> > it works pefect now for getSchemas() and getCatalogs().
> > However the setCatalog() probably was broken in Squirrel 2.0
> > rc1 from scratch. 
> > If somebody interesting about workaround it in odbc.c, the 
> next patch 
> > may be suitable:
> > bash-2.03$ diff -c  CVS/odbc.c odbc.c
> > *** CVS/odbc.c  Tue Nov  8 00:08:22 2005
> > --- odbc.c      Tue Nov  8 00:15:28 2005
> > ***************
> > *** 219,224 ****
> > --- 219,230 ----
> >   {
> >         TDSSOCKET *tds = dbc->tds_socket;
> >   
> > +               if (database[0]=='"' &&
> > database[database_len-1]=='"' && database_len>2){
> > +                       database[database_len-1]='\0';
> > +                       database++;
> > +                       database_len--;
> > +                       database_len--;
> > +               };
> >         /* 
> >          * We may not be connected yet and dbc->tds_socket
> >          * may not initialized.
> > bash-2.03$
> > 
> > Sincerely yours. 
> > -------------------------------------------------------
> > Vitaly Zverev, OCP DBA 8&8i
> > Oracle E-Business Suite &
> > Infiniband Linux Cluster Administrator Genesis Ltd., St.Petersburg, 
> > Russia
> > 
> 
> I would prefer a real fix not a workaround. change_database 
> accept a unquoted "catalog" name not a quoted one.
> 
> freddy77
> _______________________________________________
> FreeTDS mailing list
> FreeTDS@lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
> 
_______________________________________________
FreeTDS mailing list
FreeTDS@lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic