use of org.sqlite.SQLiteConfig in project translationstudio8 by heartsome.
the class TMDatabaseImpl method start.
@Override
public void start() throws SQLException, ClassNotFoundException {
File file = new File(metaData.getDataPath() + File.separator + metaData.getDatabaseName());
if (!file.exists()) {
throw new SQLException("File not found");
}
SQLiteConfig conf = new SQLiteConfig();
conf.setSynchronous(SynchronousMode.OFF);
String url = Utils.replaceParams(dbConfig.getDbURL(), metaData);
url = url.replace("__FILE_SEPARATOR__", File.separator);
String driver = dbConfig.getDriver();
Class.forName(driver);
Properties prop = Utils.replaceParams(dbConfig.getConfigProperty(), metaData);
SQLiteConfig config = new SQLiteConfig(prop);
config.setSynchronous(SynchronousMode.OFF);
conn = DriverManager.getConnection(url, config.toProperties());
// conn.setAutoCommit(false);
}
use of org.sqlite.SQLiteConfig in project tika by apache.
the class SQLite3DBParser method getConnection.
@Override
protected Connection getConnection(InputStream stream, Metadata metadata, ParseContext context) throws IOException {
String connectionString = getConnectionString(stream, metadata, context);
Connection connection = null;
try {
Class.forName(getJDBCClassName());
} catch (ClassNotFoundException e) {
throw new IOExceptionWithCause(e);
}
try {
SQLiteConfig config = new SQLiteConfig();
//good habit, but effectively meaningless here
config.setReadOnly(true);
connection = config.createConnection(connectionString);
} catch (SQLException e) {
throw new IOException(e.getMessage());
}
return connection;
}
use of org.sqlite.SQLiteConfig in project selenium_java by sergueik.
the class Editpassw method sqlupdate.
public void sqlupdate(int id, String site, String siteLogin, String sitePass, String ftp, String ftpLogin, String ftpPass, String port, String person, String personEmail, String personPass, String personPhone, String dbName, String dbUser, String dbPass, String dbHost, String hostingUrl, String hostingLogin, String hostingPass, String providerUrl, String providerLogin, String providerPass, String otherUrl, String otherLogin, String otherPass, String notes) {
/*
String updatesql = "UPDATE data SET site=? , " + " siteLogin = ? ,"
+ " sitePass = ? ," + " ftp = ?," + " ftpLogin = ?," + " ftpPass = ?,"
+ "port = ?," + "person = ?," + "personEmail = ?," + "personPass = ?,"
+ "personPhone = ?," + "dbName = ?," + "dbUser = ?," + "dbPass = ?,"
+ "dbHost = ?," + "hostingUrl = ?," + "hostingLogin = ?,"
+ "hostingPass = ?," + "providerUrl = ?," + "providerLogin = ?,"
+ "providerPass = ?," + "otherUrl = ?," + "otherLogin = ?,"
+ "otherPass = ?," + "notes = ? " + "WHERE id = ?";
*/
String updatesql = "UPDATE data SET site=? , " + " siteLogin = ? ," + " sitePass = ? " + "WHERE id = ?";
try {
SQLiteConfig config = new SQLiteConfig();
Connection c = DB.getInstance().getConnection();
PreparedStatement pstmt = c.prepareStatement(updatesql);
pstmt.setString(1, site);
pstmt.setString(2, siteLogin);
pstmt.setString(3, sitePass);
pstmt.setInt(4, id);
System.err.println(String.format("UPDATE data SET site=%s , " + " siteLogin = %s ," + " sitePass = %s " + "WHERE id = %d", site, siteLogin, sitePass, id));
/*
pstmt.setString(4, ftp);
pstmt.setString(5, ftpLogin);
pstmt.setString(6, ftpPass);
pstmt.setString(7, port);
pstmt.setString(8, person);
pstmt.setString(9, personEmail);
pstmt.setString(10, personPass);
pstmt.setString(11, personPhone);
pstmt.setString(12, dbName);
pstmt.setString(13, dbUser);
pstmt.setString(14, dbPass);
pstmt.setString(15, dbHost);
pstmt.setString(16, hostingUrl);
pstmt.setString(17, hostingLogin);
pstmt.setString(18, hostingPass);
pstmt.setString(19, providerUrl);
pstmt.setString(20, providerLogin);
pstmt.setString(21, providerPass);
pstmt.setString(22, otherUrl);
pstmt.setString(23, otherLogin);
pstmt.setString(24, otherPass);
pstmt.setString(25, notes);
*/
// update
pstmt.executeUpdate();
System.err.println("Udate: " + pstmt.toString());
} catch (SQLException ex) {
ex.printStackTrace();
System.out.println("Exception " + ex.toString());
}
}
use of org.sqlite.SQLiteConfig in project selenium_java by sergueik.
the class Addpassw method AddButtonAdd.
@Override
public void AddButtonAdd(ActionEvent actionEvent) {
website.setSite(txtsite.getText());
website.setSiteLogin(txtsitelogin.getText());
website.setSitePass(txtsitepass.getText());
website.setFtp(txtftp.getText());
website.setFtpLogin(txtftplogin.getText());
website.setFtpPass(txtftppass.getText());
website.setPort(txtport.getText());
website.setPerson(txtperson.getText());
website.setPersonEmail(txtpersonEmail.getText());
website.setPersonPass(txtpersonPass.getText());
website.setPersonPhone(txtpersonPhone.getText());
website.setDbName(txtdbName.getText());
website.setDbUser(txtdbUser.getText());
website.setDbPass(txtdbPass.getText());
website.setDbHost(txtdbHost.getText());
website.setHostingUrl(txthostingUrl.getText());
website.setHostingLogin(txthostingLogin.getText());
website.setHostingPass(txthostingPass.getText());
website.setProviderUrl(txtproviderUrl.getText());
website.setProviderLogin(txtproviderLogin.getText());
website.setProviderPass(txtproviderPass.getText());
website.setOtherUrl(txtotherUrl.getText());
website.setOtherLogin(txtotherLogin.getText());
website.setOtherPass(txtotherPass.getText());
website.setNotes(txtnotes.getText());
try {
SQLiteConfig config = new SQLiteConfig();
c = DB.getInstance().getConnection();
PreparedStatement stat = c.prepareStatement("INSERT INTO data (site, siteLogin, sitePass, ftp, ftpLogin, ftpPass, port, person, personEmail, personPass, personPhone, dbName, dbUser, dbPass, dbHost, hostingUrl, hostingLogin, hostingPass, providerUrl, providerLogin, providerPass, otherUrl, otherLogin, otherPass, notes) VALUES ('" + website.getSite() + "','" + website.getSiteLogin() + "','" + website.getSitePass() + "','" + website.getFtp() + "','" + website.getFtpLogin() + "','" + website.getFtpPass() + "','" + website.getPort() + "','" + website.getPerson() + "','" + website.getPersonEmail() + "','" + website.getPersonPass() + "','" + website.getPersonPhone() + "','" + website.getDbName() + "','" + website.getDbUser() + "','" + website.getDbPass() + "','" + website.getDbHost() + "','" + website.getHostingUrl() + "','" + website.getHostingLogin() + "','" + website.getHostingPass() + "','" + website.getProviderUrl() + "','" + website.getProviderLogin() + "','" + website.getProviderPass() + "','" + website.getOtherUrl() + "','" + website.getOtherLogin() + "','" + website.getOtherPass() + "','" + website.getNotes() + "')");
stat.executeUpdate();
} catch (SQLException ex) {
ex.printStackTrace();
}
AddButtonCancel(actionEvent);
}
use of org.sqlite.SQLiteConfig in project universa by UniversaBlockchain.
the class DbTest method testClone.
@Test
public void testClone() throws Exception {
SQLiteConfig config = new SQLiteConfig();
config.setSharedCache(true);
config.enableRecursiveTriggers(true);
String connectionString = "jdbc:sqlite:";
Db a = new Db(connectionString, config.toProperties());
Db b = a.clone();
assertEquals(a, b);
assertEquals(a.getProperties(), b.getProperties());
assertEquals(connectionString, b.getConnectionString());
}
Aggregations