Trouble connecting to database--java.sql.SQLNonTransientConnectionException -


i trying databases , failing miserably..please help!

this code, until point of sqlnontransientconnectionexception:

public class uftest {     public static void main(string[] args) throws classnotfoundexception, sqlexception{      hashtable ht = new hashtable();    ht.put(context.initial_context_factory, "weblogic.jndi.wlinitialcontextfactory");    ht.put(context.provider_url, "t3://localhost:7001");    ht.put(context.security_principal, "user");    ht.put(context.security_credentials, "pw"); system.out.println("cx/ht succesful");           context cx = null;    connection con = null;    statement stmt = null;    resultset rs = null;    string source = "jdbc/lf_jhu_derby";    file file = new file("student_list.txt");      try{ system.out.println("try entered");                   cx = new initialcontext(ht); system.out.println("cx created");         class.forname("org.apache.derby.jdbc.clientdriver");        drivermanager.getconnection("jdbc:derby://localhost:7001/lf_jhu_derby;create=true","user", "pw"); 

at point this:

java.sql.sqlnontransientconnectionexception: insufficient data while reading network - expected minimum of 6 bytes , received 0 bytes.  connection has been terminated. @ org.apache.derby.client.am.sqlexceptionfactory40.getsqlexception(unknown source) @ org.apache.derby.client.am.sqlexception.getsqlexception(unknown source) @ org.apache.derby.jdbc.clientdriver.connect(unknown source) @ java.sql.drivermanager.getconnection(drivermanager.java:571) @ java.sql.drivermanager.getconnection(drivermanager.java:215) @ randomtests.uftest.main(uftest.java:38) caused by: org.apache.derby.client.am.disconnectexception: insufficient data while reading network - expected minimum of 6 bytes , received 0 bytes.  connection has been terminated. @ org.apache.derby.client.net.reply.fill(unknown source) @ org.apache.derby.client.net.reply.ensurealayerdatainbuffer(unknown source) @ org.apache.derby.client.net.reply.readdssheader(unknown source) @ org.apache.derby.client.net.reply.startsameidchainparse(unknown source) @ org.apache.derby.client.net.netconnectionreply.readexchangeserverattributes(unknown source) @ org.apache.derby.client.net.netconnection.readserverattributesandkeyexchange(unknown source) @ org.apache.derby.client.net.netconnection.flowserverattributesandkeyexchange(unknown source) @ org.apache.derby.client.net.netconnection.flowusridpwdconnect(unknown source) @ org.apache.derby.client.net.netconnection.flowconnect(unknown source) @ org.apache.derby.client.net.netconnection.<init>(unknown source) @ org.apache.derby.client.net.netconnection40.<init>(unknown source) @ org.apache.derby.client.net.clientjdbcobjectfactoryimpl40.newnetconnection(unknown source) ... 4 more 

now, running weblogic server @ db should have been created on port 7001. notice if pick random port number, errors tell me "refused." here not case--it accepted…just there no response.

also, @ line:

cx = new initialcontext(ht); 

i following:

problem creating dummy orb: org.omg.corba.comm_failure:   vmcid: sun  minor code: 203  completed: no 

which, in spite of googling, not understand (and don't know how fix). don't know if issues connected or not…please help!

this commandline (about creation of db):

ij> connect 'jdbc:derby:lf_jhu_derby;create=true'; create table student ( first_name varchar(40), last_name varchar(40) , ssn char(11) ,          email varchar(40), address varchar(40), userid varchar(8) , password varchar(8) ); quit;ij> 0 rows inserted/updated/deleted 

and later, tested with:

ij> connect 'jdbc:derby:lf_jhu_derby;create=true'; warning 01j01: database 'lf_jhu_derby' not created, connection made existing database       instead. 

so, seems exist, then...

if have

@transient 

annotation @ top of method used this, try deleting annotation , keep going...


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -