BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

I need something like app.path or project.path (which is not

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> JBuilder Databases
View previous topic :: View next topic  
Author Message
Brunet Djura
Guest





PostPosted: Sun Feb 12, 2006 4:03 pm    Post subject: I need something like app.path or project.path (which is not Reply with quote



I'm working on a database application in Borland JBuilder 2006 on Linux
Fedora Core 4 platform. I choose JDataStore as database, and
JasperReports for reporting part.

My connection code looks like this >

String app_path = "/home/brunetdj/my/source/jbuilder/info2006/";
String db_path = app_path + "data/podaci.jds";

database.setConnection(new ConnectionDescriptor("jdbc:borland:dslocal:"
+ db_path,"SYSDBA", "masterkey", false,
"com.borland.datastore.jdbc.DataStoreDriver"));

So, my problem is in variables app_path and db_path,
which is useless in MS Windows platform, and program stop working.
Application and database path are not the same semantics in both OS.
And where is that transparency of Java in that two small variables ?

I've searched Internet (Google,Sun forums, e.t.c.), but without results.
There is some partial solutions, like >

- to put database in class of project, and get path with getResorce()
method. That is unpractical because of huge database size
- to put all resources in root project folder, which also make chaos
with files
- to use system variable user.dir, which retrieve root user folder on
Linux, and different in MS Windows

Is there a way to use some methods to get app.path or project.path ?
Absolute adresses is untransparent on diferent operating systems.

Please, help, if anybody can.
Back to top
Paul Nichols (TeamB)
Guest





PostPosted: Sun Feb 12, 2006 4:03 pm    Post subject: Re: I need something like app.path or project.path (which is Reply with quote



Brunet Djura wrote:

Quote:
I'm working on a database application in Borland JBuilder 2006 on Linux
Fedora Core 4 platform. I choose JDataStore as database, and
JasperReports for reporting part.

My connection code looks like this

String app_path = "/home/brunetdj/my/source/jbuilder/info2006/";
String db_path = app_path + "data/podaci.jds";

database.setConnection(new ConnectionDescriptor("jdbc:borland:dslocal:"
+ db_path,"SYSDBA", "masterkey", false,
"com.borland.datastore.jdbc.DataStoreDriver"));

I would follow John's suggestion fiurst. An alternative is to make sure that

your paths are not linux/mac/unix specific.

For instance something like /data/pdaci.jsd would work on Windows and Unix,
provided you created a /data (Unix and Mac) or C:\data (Windows)directory
and put the podaci.jds file in that new directory.

Another option is to put the database in the classpath directory of your
database connection class. Then

Url url=this.getClass().getResource("podaci.jds");
Back to top
John Moore (TeamB)
Guest





PostPosted: Mon Feb 13, 2006 12:03 am    Post subject: Re: I need something like app.path or project.path (which is Reply with quote



I would suggest placing those values in a property file in the
executable directory..

Then you can make the appropriate changes based on the OS..

John..

Brunet Djura wrote:

Quote:

My connection code looks like this

String app_path = "/home/brunetdj/my/source/jbuilder/info2006/";
String db_path = app_path + "data/podaci.jds";


--
=============================================
TeamB are volunteer helpers. Please DO NOT REPLY VIA EMAIL!
Post all questions and replies to this newsgroup ONLY
For papers on DataExpress, Applets, JSP, and Web Development go to:
http://www.microps.com/mps/paperFAQ.html
====================================================
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> JBuilder Databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.