This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Server Start (SQL2000)

 
Thabo Matjuda
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • 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!!
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Runtime#exec() ?
 
Thabo Matjuda
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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.
 
Satya Maheshwari
Ranch Hand
Posts: 368
  • Mark post as helpful
  • send pies
  • 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.
 
Campbell Ritchie
Sheriff
Posts: 48635
56
  • Mark post as helpful
  • send pies
  • 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.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic