1
vote
2answers
75 views

How to optimize this code?

So I have this piece of code in Java(Android) to add a list of brokers to a local SQLite database as one single sql instruction. public void Add(List<Broker> brokers) { if(brokers == null ...
2
votes
1answer
87 views

SQL PreparedStatement; Am I doing it right?

I am building a web app with a single (not pooled) full time (jdbc) connection between static classes and the database. This is expected to be a low traffic site and the static methods are ...
1
vote
2answers
188 views

How to optimize this SQL delete

I want to optimize the performance of this SQL query. If I populate this hashtable with one million keys the query will take around minute. How I can optimize this Java method for faster execution? ...
2
votes
1answer
375 views

Android SQL in its simplest form

I thought I would just post a really simple wrapper for those who don't want to implement the retarded SqliteOpenHelper, which is really, really stupid. Below is a class to open/create a database, ...
5
votes
1answer
294 views

Android database interaction logic

I have a database-intensive app. Almost every activity requires access to the database, both reading and writing. I had a lot of problems with separate threads and activities on the stack closing ...
3
votes
1answer
154 views

Execute multiple query from a text file

I am just wondering if this is a correct way to execute multiple query from a text file. Connection conn = Utility.getConnection(); Statement stmt = null; try{ JFileChooser chooser = new ...
3
votes
4answers
601 views

Accessing the only element of Java ResultSet

Does this code look OK? public Map<String, String> getById(long id) { String sql = "select * from " + this._TABLE_NAME + " where id = ?"; PreparedStatement p; Map<String, ...