I have a problem. I need to create Server of HSQLDB from my code, run it and connect from another application (for e.x. by runManagerSwing.bat) Here are my code
HsqlProperties p = new HsqlProperties();
Server server2 = new Server();
// I even can connect to my server from the same application
Connection conn = DriverManager.getConnection("jdbc:hsqldb:hsql://localhost:9001 /idt_simulatordb", "sa", "");
Statement st = conn.createStatement(); // statements
String expression1 = "DROP SCHEMA IF EXISTS simulators CASCADE;\n";
String expression2 = "CREATE SCHEMA SIMULATORS AUTHORIZATION SA;";
String expression3 = "CREATE TABLE SIMULATORS.dirtyhack();";
st.executeUpdate(expression1); // run the query
st.executeUpdate(expression2); // run the query
st.executeUpdate(expression3); // run the query
But when I put breakpoint after server run and try to connect to my server from runManagerSwing I got timeout error.
But if I launch server from bat-file, then everething ok. How to solve my problem. Isuppose thaat I have to use MainInvoker but I don't know how to pass argument and how to shutwown server after all. thanx
You aren't going to be able to connect to any service before you start the service. This is what is attempted by
But this sample code doesn't even attempt to do anything like your stated goal- to run a Server in one JVM and a client in another JVM. Separate out the two parts (server part and client part) into separate classes loaded by separate Java mains. MainInvoker is for when you want to use the main(String) methods from more than one class in the same JVM. That is nothing like your use case.
(Post updated just to fix my attempted wikitext formatting)
If you want help, it would be better to use the forum labeled "Help" in the future. If somebody wants to provide help, or if other people want to search to see how you have been helped, that is where they will look.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.