File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Server Start (SQL2000) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Server Start (SQL2000)" Watch "Server Start (SQL2000)" New topic
Author

Server Start (SQL2000)

Thabo Matjuda
Greenhorn

Joined: Jul 06, 2008
Posts: 29
Hi Guys. Can anyone please give me an Idea on how to Start a server via button. A Server which connects to an SQL Database. Thank you!!


T.Tuch (T.L.M)
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Runtime#exec() ?
Thabo Matjuda
Greenhorn

Joined: Jul 06, 2008
Posts: 29
No. I want to create e GUI, which has a 'START SEVER' & 'STOP SERVER'. when i click my 'SART SERVER BUTTON', it must start a normal Java server & connect to a database i created with SQL2000. Any IDEAS PLEASE?
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Uh, then just use the button component provided by the UI framework you're using and let it invoke Runtime#exec() accordingly.
Thabo Matjuda
Greenhorn

Joined: Jul 06, 2008
Posts: 29
Thanks Man. I wil look into it, ryt nw its 4am where i stay. My eyes are painful together with Fingers too. Thanks, i wil cme again when I get stuck.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
I recommend you to do it step by step (in OO way).
Create a class with methods which starts and stops the server and test it as plain Java Application with main().
Once you got that work, you just have to let the button use this class and invoke the method accordingly.
Satya Maheshwari
Ranch Hand

Joined: Jan 01, 2007
Posts: 368
Runtime.exec is a good idea but may compromise the portability of the application. Is there a java way to start the server i.e. can the server be started by running a class in JVM.


Thanks and Regards
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Thabo Matjuda wrote:Thanks Man. I wil look into it, ryt nw its 4am where i stay. My eyes are painful together with Fingers too. Thanks, i wil cme again when I get stuck.
Read this FAQ. Your sore fingers are causing trouble for other readers, I am afraid.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Satya Maheshwari wrote:Runtime.exec is a good idea but may compromise the portability of the application. Is there a java way to start the server i.e. can the server be started by running a class in JVM.


Needing to run SQL Server as part of the application has already compromised the portability of the application; its Windows only. Which makes me wonder why you would use Java to control SQL Server at all? SQL Server runs as a service which will run at startup by default. Why not just trust the database will be running? Or even better, why not host the database on a server and manage it yourself using the out the box tools?

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Thabo Matjuda
Greenhorn

Joined: Jul 06, 2008
Posts: 29
Wow. Thanks being greenhorn suck. Well this server i am talking about is just a different server in netbeans jst so it may accept multiple clients. The only thing i am doing with sql is just my java application(my own server) must b able to connect to an sql database
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

"a different server in netbeans"? not sure what you mean here. NetBeans is an IDE, it doesn't manage databases. Presumably the server itself is running somewhere and you use NetBeans to connect to it?

If all you need to do is connect to the (already running) server that is just basic JDBC. The JDBC tutorial and our own JDBC FAQs are good places to get an understanding of how to do that.
Thabo Matjuda
Greenhorn

Joined: Jul 06, 2008
Posts: 29
Gee i suck at English too. Okay let me try being clearer. Okay in Netbeans you can create a Client/Server application right? Now in my 3Days Project. I must create a client server application, obviously for my client to retrieve eg...A list of music artists from SQL It must ask my server side. So now that same Java/Server App i created must connect to a an SQL database in order to serve a Client. Now i am ok with The Basic JDBC. May be i should give you a bit of My Summarized Project Specifications which is wantd in 3Days from tomorrow...How about that? Highly appreciated only if you have time to just reply and help me here and there, i am willing and ready to hear out a more experienced Java Programmer.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Server Start (SQL2000)