java - Setting up a remote Derby DB: "No suitable driver found" error -


i trying set remote derby database practice. following code works without problem whenever access db on harddrive:

class test{     public static void main(string[] args) {         string protocol = "jdbc:derby:"; //        string dbpath = "c:/java_practice/derbydb";    // dbpath works...         string dbpath = "//108.167.141.127/derbydb";     // , 1 doesn't         string url = protocol + dbpath;         try( connection conn = drivermanager.getconnection(url) )         {             system.out.println(conn);         }         catch(sqlexception e){             system.out.println(e.getmessage());         }     } } 

i uploaded whole derbydb directory hostgator-hosted website, obtained ip pinging server , edited dbpath var accordingly. code stopped working if can't see db. missing?

looks driver class not loaded. try loading before calling drivermanager.getconnection, , see if works.

string driver = "org.apache.derby.jdbc.clientdriver"; class.forname(driver).newinstance(); string protocol = "jdbc:derby:"; string dbpath = "//108.167.141.127/derbydb"+";create=true"; string url = protocol + dbpath; connection conn = drivermanager.getconnection(url); 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -