NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

[RESOLVED] Running database driven application without server running

 
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users
View previous topic :: View next topic  
Author Message
ni62



Joined: 14 Feb 2011
Posts: 4
Location: UK

PostPosted: Mon Feb 14, 2011 5:51 pm    Post subject: [RESOLVED] Running database driven application without server running Reply with quote

I am a new learner of netbeans IDE. I have started to create small application like personal address book using database. I used java derby database. Perhaps I can use mysql as well. My application does run perfectly within IDE when the server is running. Now If I move this application to different computer where there is no IDE or server, will it run? I checked running jar file outside the IDE and it does not work when the server is not running. What are the options available to run the application without starting server? Thanks

Last edited by ni62 on Tue Feb 22, 2011 9:30 pm; edited 1 time in total
Back to top
areeda



Joined: 28 Aug 2008
Posts: 484
Location: Los Angeles

PostPosted: Mon Feb 14, 2011 6:23 pm    Post subject: Re: Running database driven application without server running Reply with quote

ni62 wrote:
I am a new learner of netbeans IDE. I have started to create small application like personal address book using database. I used java derby database. Perhaps I can use mysql as well. My application does run perfectly within IDE when the server is running. Now If I move this application to different computer where there is no IDE or server, will it run? I checked running jar file outside the IDE and it does not work when the server is not running. What are the options available to run the application without starting server? Thanks
I'm not sure I understand your problem very well but perhaps some discussion will help.

Probably the reason your application won't run is because you exit with an error when you try to connect to the database and fail. If your app does not depend on the database being active you could catch that exception and do something to ignore calls to the database but still provide some functionality.

Another choice would be to embed Derby in your app so you do not rely on an external server. You can even get fancy and have a local address book that works without a server and sync function (manual or automatic) that works with both.

Maybe if you describe what you want to do without the db, we might do a better job addressing your concerns.

Joe
Back to top
ni62



Joined: 14 Feb 2011
Posts: 4
Location: UK

PostPosted: Mon Feb 14, 2011 6:54 pm    Post subject: Reply with quote

Thank you Joe for the reply.

This is a very simple application I created using 'Java Desktop Application' project Where I created derby database which stores name address, etc. I want to use this application in other computers but it does not work perhaps the application needs server running. application allows me to view, add, delete records. I hope this is clear to you. I have not written any code manually. IDE has done everything for me. I see 'try.. catch' in the code.

Are you saying that I should have used derby embedded. I used derby network. I will try that. In the mean time any advice will be appreciated.
Back to top
areeda



Joined: 28 Aug 2008
Posts: 484
Location: Los Angeles

PostPosted: Mon Feb 14, 2011 7:05 pm    Post subject: Reply with quote

ni62 wrote:
Are you saying that I should have used derby embedded. I used derby network. I will try that. In the mean time any advice will be appreciated.

Well "should have" is a little strong, "could have" is more what I'm thinking.

If your application is "single user" embedded will probably solve your problem. In this case your program won't rely on anything else running, like a database server. But the database will be sort of private. I say sort of because another program could access it.

If you use the server then you are in a situation where multiple users can access the same database at the same time. In your address book example you may want everybody in the company to access the same customer/supplier list.

So in the case of a simple program to see how things work and be able to run it on multiple systems without setting up a common server, I would think embedded would be my choice.

Joe
Back to top
emiddio-frontier
Posted via mailing list.





PostPosted: Mon Feb 14, 2011 8:43 pm    Post subject: [SPAM] Re: Running database driven application without server running Reply with quote

you can run the database without running the app server;

app server may need database for deployed apps;
database does not need appserver

gary

----- Original Message -----
From: "areeda" <address-removed>
To: <address-removed>
Sent: Monday, February 14, 2011 11:05 AM
Subject: [nbusers] Running database driven application without server
running


Quote:

ni62 wrote:
Quote:
Are you saying that I should have used derby embedded. I used derby
network. I will try that. In the mean time any advice will be
appreciated.

Well "should have" is a little strong, "could have" is more what I'm
thinking.

If your application is "single user" embedded will probably solve your
problem. In this case your program won't rely on anything else running,
like a database server. But the database will be sort of private. I say
sort of because another program could access it.

If you use the server then you are in a situation where multiple users can
access the same database at the same time. In your address book example
you may want everybody in the company to access the same customer/supplier
list.

So in the case of a simple program to see how things work and be able to
run it on multiple systems without setting up a common server, I would
think embedded would be my choice.

Joe



Back to top
ni62



Joined: 14 Feb 2011
Posts: 4
Location: UK

PostPosted: Mon Feb 14, 2011 10:29 pm    Post subject: Reply with quote

areeda wrote:


If your application is "single user" embedded will probably solve your problem. In this case your program won't rely on anything else running, like a database server. But the database will be sort of private. I say sort of because another program could access it.
....
Joe


I am trying to use derby embeded option but getting connection error (unable to add connection). I have attached the screenshot.

By the way, do I need to recreate the database or I can still use the same database using embeded.

thanks
Back to top
ni62



Joined: 14 Feb 2011
Posts: 4
Location: UK

PostPosted: Wed Feb 16, 2011 7:13 pm    Post subject: Reply with quote

ni62 wrote:
areeda wrote:


If your application is "single user" embedded will probably solve your problem. In this case your program won't rely on anything else running, like a database server. But the database will be sort of private. I say sort of because another program could access it.
....
Joe


I am trying to use derby embeded option but getting connection error (unable to add connection). I have attached the screenshot.

By the way, do I need to recreate the database or I can still use the same database using embeded.

thanks


I have realized that the screenshot of error message did not upload. I wanted to paste it here but it does work. I changed my profile to use HTML to ON but still shows OFF while editing. Anyway the error message was "cannot eastablish a connection to jdbc:derby://localhost:1527/phone_book using org.apache.derby.jdbc.Autoloaded driver (unable to find suitable driver)

It seems that driver is missing or not working. I am using netbeans 6.9.1. I wonder if there is any step by step tutrial for connecting derby embedded database. I have seen few posting about this in this forum but not on netbeans 6.9.1. Please help. thanks

My Findings

I like to share my findings in netbeans 6.9.1. It is true that Derby embedded is the option for creating stand alone DB that does not need any server running. I had problem creating an embedded DB in netbeans. Correct driver is org.apache.derby.jdbc.EmbeddedDriver. For some reason my setup had org.apache.derby.jdbc.Autoloaded. So I uninstalled netbeans and JDK and reinstalled again. It is working now. Here is the procedure to create DB:

If you create a DB using a node ‘Java DB’ (right click), it creates a DB which is derby network based and it shows the DB name under Java DB node. I think by default it creates network based DB. I have not seen any option to change this though.

To create an embedded DB, right click on Java DB (Embedded) under Drivers node. Click on Connect Using. Fill in Database name in the format (e.g. testDB; create=true) and user name, password. When clicked on OK, it gives you an option for schema. Click OK and the DB is created. You will see the connection on the left. Unlike networked DB, its name is not visible under Java DB node.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> NetBeans Users 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
You can attach files in this forum
You can download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo