/** * Creates a new Sql instance given a JDBC connection URL. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url) throws SQLException { Connection connection = DriverManager.getConnection(url); return new Sql(connection); }
/** * Creates a new Sql instance given a JDBC connection URL * and some properties. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param properties a list of arbitrary string tag/value pairs * as connection arguments; normally at least a "user" and * "password" property should be included * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url, Properties properties) throws SQLException { Connection connection = DriverManager.getConnection(url, properties); return new Sql(connection); }
/** * Creates a new Sql instance given a JDBC connection URL, * a username and a password. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param user the database user on whose behalf the connection * is being made * @param password the user's password * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url, String user, String password) throws SQLException { Connection connection = DriverManager.getConnection(url, user, password); return new Sql(connection); }
@Override public Sql get() { return new Sql(ds); }
/** * Creates a new Sql instance given a JDBC connection URL. * * @param url a database url of the form * <code> jdbc:<em>subprotocol</em>:<em>subname</em></code> * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url) throws SQLException { Connection connection = DriverManager.getConnection(url); return new Sql(connection); }
/** * Creates a new Sql instance given a JDBC connection URL. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url) throws SQLException { Connection connection = DriverManager.getConnection(url); return new Sql(connection); }
/** * Creates a new Sql instance given a JDBC connection URL. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url) throws SQLException { Connection connection = DriverManager.getConnection(url); return new Sql(connection); }
/** * Creates a new Sql instance given a JDBC connection URL. * * @param url a database url of the form * <code> jdbc:<em>subprotocol</em>:<em>subname</em></code> * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url) throws SQLException { Connection connection = DriverManager.getConnection(url); return new Sql(connection); }
/** * Creates a new Sql instance given a JDBC connection URL. * * @param url a database url of the form * <code> jdbc:<em>subprotocol</em>:<em>subname</em></code> * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url) throws SQLException { Connection connection = DriverManager.getConnection(url); return new Sql(connection); }
/** * Creates a new Sql instance given a JDBC connection URL * and some properties. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param properties a list of arbitrary string tag/value pairs * as connection arguments; normally at least a "user" and * "password" property should be included * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url, Properties properties) throws SQLException { Connection connection = DriverManager.getConnection(url, properties); return new Sql(connection); }
/** * Creates a new Sql instance given a JDBC connection URL * and some properties. * * @param url a database url of the form * <code> jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param properties a list of arbitrary string tag/value pairs * as connection arguments; normally at least a "user" and * "password" property should be included * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url, Properties properties) throws SQLException { Connection connection = DriverManager.getConnection(url, properties); return new Sql(connection); }
/** * Creates a new Sql instance given a JDBC connection URL * and some properties. * * @param url a database url of the form * <code> jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param properties a list of arbitrary string tag/value pairs * as connection arguments; normally at least a "user" and * "password" property should be included * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url, Properties properties) throws SQLException { Connection connection = DriverManager.getConnection(url, properties); return new Sql(connection); }
/** * Creates a new Sql instance given a JDBC connection URL, * a username and a password. * * @param url a database url of the form * <code> jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param user the database user on whose behalf the connection * is being made * @param password the user's password * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url, String user, String password) throws SQLException { Connection connection = DriverManager.getConnection(url, user, password); return new Sql(connection); }
/** * Creates a new Sql instance given a JDBC connection URL, * a username and a password. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param user the database user on whose behalf the connection * is being made * @param password the user's password * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url, String user, String password) throws SQLException { Connection connection = DriverManager.getConnection(url, user, password); return new Sql(connection); }
/** * Creates a new Sql instance given a JDBC connection URL * and some properties. * * @param url a database url of the form * <code> jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param properties a list of arbitrary string tag/value pairs * as connection arguments; normally at least a "user" and * "password" property should be included * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url, Properties properties) throws SQLException { Connection connection = DriverManager.getConnection(url, properties); return new Sql(connection); }
/** * Creates a new Sql instance given a JDBC connection URL, * a username and a password. * * @param url a database url of the form * <code>jdbc:<em>subprotocol</em>:<em>subname</em></code> * @param user the database user on whose behalf the connection * is being made * @param password the user's password * @return a new Sql instance with a connection * @throws SQLException if a database access error occurs */ public static Sql newInstance(String url, String user, String password) throws SQLException { Connection connection = DriverManager.getConnection(url, user, password); return new Sql(connection); }
public class Exercise { public static void main(String[] args) throws XPathExpressionException { XPath xpath = XPathFactory.newInstance().newXPath(); InputSource in = new InputSource("res/config.xml"); String user = xpath.evaluate("//sql/user/text()", in); String password = xpath.evaluate("//sql/password/text()", in); String path = xpath.evaluate("//sql/dataSource/text()", in); Sql sql = new Sql(path, user, password); } }
public Sql sql(String name) throws NamingException{ DataSource ds = dataSourceCache.get(name); if(ds==null) { name = qualifyName(name); InitialContext ic = new InitialContext(); ds = (DataSource)ic.lookup(name); dataSourceCache.put(name, ds); } return new Sql(ds); }
public Sql sql(String name) throws NamingException{ DataSource ds = dataSourceCache.get(name); if(ds==null) { name = qualifyName(name); InitialContext ic = new InitialContext(); ds = (DataSource)ic.lookup(name); dataSourceCache.put(name, ds); } return new Sql(ds); }
public static string[] LoadImagesFromDB() { Sql sql = new Sql(); string query = "SELECT Location FROM GalleryImages"; MySqlCommand cmd = sql.Command(query); DataTable dt = sql.DataTable(cmd); string[] images = new string[dt.Rows.Count]; for(int i = 0; i < dt.Rows.Count;i++) { images[i] = HttpUtility.UrlDecode(dt.Rows[i]["Location"].ToString()); } return images; }