Good Post on Clean Code

Using SQL Statements as a String in Class file while working on Android or Java application can be such a pain.

I was checking in the net to find out whether there are any ways in which we can store the SQL Statments separately so that the code can be more readable.

I found some interesting stuff. Please find below the links for the same.

1. Clean Code

2. Java Practices : Keep SQL out of code.

3. Android : Store SQL Queries in an XML File (Stackoverflow answer)

I am working on a way to store all my SQL Statements in an XML File while working with Android.

Found this post on placing XML File with Data on Android in StackOverflow.


  • No subdirectorys are allowed under the specific resource-folders.
  • The R-class indexes all resources and provides simple access.
  • There are some simple methods which help reading files stored in the res-directory


  • Subdirectorys are allowed (as much as you like).
  • No indexing by the R-class
  • Reading resources stored in assets is done using the AssetManager.

Also found a cool post on Working with resources in Android : Link.


SQL Statements in the case of Android can be stored in the strings.xml under the resources–> values  folder.

In case you using a Database class which is a pure java class the this link will be able to help you on how to do the same.

In my case, I created a separate DAO Class called the DBClass which deals with the connecting and disconnecting with the database. I set the context of the DAO class so that the strings can be used here.


Auto Net Connect For BSNL Night Unlimited Plan Users

Auto Internet Connect at 2 AM & Disconnect at 8 AM

Try this method:
First Step:
Create two batch files
Open notepad type the following:
rasdial [connection name] [user name] [password]
for example
rasdial broadband myusername mypassword
save the above file as connect.bat
Open notepad type the following
rasdial [connection name] /disconnect
for example
rasdial broadband /disconnect
save the above file as disconnect.bat
Second Step:
Schedule task wizard will start>click next
2. Click “Browse” and select “connect.bat
3. Type the task name (anything you want) and then select “Daily“.Now to configure how to run it during Night Unlimited.
Click Next.
Now set the start time to something like say….2.05 a.m.
Set Everyday from the Perform this task option right below that and start date to today’s date.
Click Next
Enter your username and pass on the Next page.
Click Finish.

Found this one in broadband forum. By Abhiroop….

I’m definitely gonna give this a try and see what happens.

Update: It does work. I’ve been using it for two weeks now and have no problems at all.