db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nobles <noblesit...@yahoo.com>
Subject derby can not set database property in the dir. provided
Date Mon, 12 May 2014 19:20:08 GMT
 I have a the following code to set Database system property  in the
user.home directory. the next code atempt to start the database from the
same directory. but cannot find the database. Then it throws and excemption.
bellow     public static Connection getJServerConnection(){           
Connection dbConnection = null;       String strUrl;          try {             
String[] IP = Inet4Address.getLocalHost().toString().split("/");         
strUrl = "jdbc:derby://"+IP[1]+":1515/Ml_JUDEDB;create=true";        
Properties props = new Properties();         props.put("user",
"jude1_0_user");         props.put("password", "jude1_0_password");        
dbConnection = DriverManager.getConnection(strUrl, props);         }
catch(SQLException sqle) {          sqle.printStackTrace();         } catch
(UnknownHostException ex) {             
Logger.getLogger(JConnect.class.getName()).log(Level.SEVERE, null, ex);         
}    return dbConnection;     }        public static void setDBSystemDir() {           
String userHomeDir = System.getProperty("user.home", ".");    String
systemDir = userHomeDir+"/.judeServer";   
System.setProperty("derby.system.home", systemDir);   
System.out.println("Dir:"+systemDir);      NetworkServerControl  server;             
try {            String[] IP =
server = new NetworkServerControl(Inet4Address.getByName(IP[1]),1515);            
server.start( null );            } catch (UnknownHostException ex) {           
Logger.getLogger(JConnect.class.getName()).log(Level.SEVERE, null, ex);       
} catch (Exception ex) {           
Logger.getLogger(JConnect.class.getName()).log(Level.SEVERE, null, ex);       
}        }                 public static  void StartNetWorkServer(){                     
setDBSystemDir();                   Connection connect =
getJServerConnection();                     System.out.println("CONNECT:    
"+connect);                }  java.sql.SQLNonTransientConnectionException:
java.net.ConnectException : Error connecting to server on port
1515 with message Connection timed out: connect.CONNECT:     null

View this message in context: http://apache-database.10148.n7.nabble.com/derby-can-not-set-database-property-in-the-dir-provided-tp139192.html
Sent from the Apache Derby Developers mailing list archive at Nabble.com.
View raw message