Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 149
  • Last Modified:

Include external text

I need to start keeping my SQL code in a seperate file.  Traditionaly I have been using:

String SQL = "Select * from People";

But now I need to have some thing like:

String SQL = <jsp:include page="sql/PeopleTable.sql">;

PeopleTable.sql is a text file with line breaks.  Any ideas?
0
AlexNYC
Asked:
AlexNYC
  • 3
  • 2
1 Solution
 
kennethxuCommented:
you must write you own file access code, read the file and store it in a string.
0
 
AlexNYCAuthor Commented:
What would that code look like?
0
 
AlexNYCAuthor Commented:
What would that code look like?
0
 
AlexNYCAuthor Commented:
What would that code look like?
0
 
kennethxuCommented:
psudo code:
File file = new File( "file_path_and_name" );
int size = (int) file.length();
byte[] buf = new byte[size];
InputStream in = new FileInputStream( file );
in.read( buf );
in.close();
String sql = new String( buf );
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now