• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Server Start (SQL2000)

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!!
 
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Runtime#exec() ?
 
Thabo Matjuda
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Thabo Matjuda
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"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
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic