greetings to the gurus, i am having an error problem when i try to test my jdbc connection. at first i got a calling a nonstatic method error when, in the main method, i did the following: try { dbaseConn = makeConnection(); } catch (Exception ex) { log("Sybase Connect Error: "+ex.getMessage()); } (where makeConnection is the method where i link with my database and give the sql commands) then, i changed this to create an instance of the nonstatic method in main by: try { makeConnection testConn=new makeConnection(); // dbaseConn = makeConnection(); } catch (Exception ex) { log("Sybase Connect Error: "+ex.getMessage()); }
now the error it gives is: >Class makeConnection not found in type declaration. > makeConnection testConn=new makeConnection(); what am i doing wrong? jb
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
It seems like you are confused about the difference between a method and a class. We only use new() on classes, not methods. So let's say that makeConnection is a method in class MyConnection, then we would do this: MyConnection mc = new MyConnection(); dbaseConn = mc.makeConnection();
[This message has been edited by Thomas Paul (edited February 12, 2001).]