Skip to content

Instantly share code, notes, and snippets.

@coleman-rik
Created August 4, 2019 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coleman-rik/94e76cb62f7890a5fd3039004958971d to your computer and use it in GitHub Desktop.
Save coleman-rik/94e76cb62f7890a5fd3039004958971d to your computer and use it in GitHub Desktop.
public static Connection getConnectionFromURL(String url)
throws SQLCoreException
{
Connection conn;
Debugger.outW("\n getting connection for:" + url);
DataSource ds = DataSourceFactoryImpl.getInstance().getDataSource(url);
conn = ds.getConnection();
if(conn == null)
throw new SQLCoreException("\n Couldn't get connection (null) for:" + url);
if(conn.isClosed())
throw new SQLCoreException("\n Couldn't get connection (closed) for:" + url);
return conn;
Exception e1;
e1; // <- This throws Syntax error, insert "VariableDeclarators" to complete LocalVariableDeclaration in eclipse
throw new SQLCoreException(e1);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment