Files
HeidiSQL/extra/jheidi/initDB.ajl
2008-05-18 02:35:01 +00:00

33 lines
805 B
Plaintext

import com.mysql.jdbc.jdbc2.optional.*;
import javax.sql.DataSource;
import com.rendion.editor.*;
DB db = null;
WindowContext context = argObj("windowContext");
HashObject profile = context.get("profile");
AjlEditor editor = context.get("/consoleTabs/SQL Log/outputWindow");
try
{
MysqlDataSource ds = new MysqlDataSource();
String url = "jdbc:mysql://" + profile.get("host") + ":" + profile.get("port") + "/";
if ( "true".equals(profile.get("compress")) )
{
url+="?useCompression=true";
}
ds.setUrl(url);
ds.setUser(profile.get("user"));
ds.setPassword(profile.get("password"));
ds.setLoginTimeout(Integer.parseInt(profile.get("timeout")));
db = new SQLLoggingDB((DataSource)ds, editor);
} catch (Exception e) {
throw new RuntimeException(e);
}
context.put("db", db);