[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:       "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio () vodafone ! com>
Date:       2005-11-08 14:00:48
Message-ID: F7F148C986A2A84F930FEB8C3B169EA002FBC338 () OPDMEXO01 ! omnitel ! it
[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
> 

Instead of ignoring 01000 warning you could test if getCatalog return
wanted catalog name.

freddy77
_______________________________________________
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