AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Passaggio parametri connessione dbase

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian)
View previous topic :: View next topic  
Author Message
Savf
Guest





PostPosted: Thu Dec 30, 2004 8:46 am    Post subject: Passaggio parametri connessione dbase Reply with quote



Ho l'apertura del database nella seguente maniera:
private void ConnectDBF() {
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =
DriverManager.getConnection("jdbc:odbc:DataBase", "", "");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("select * from Soci order by
Cognome");
while (rs.next()){
System.out.println(rs.getString("Codice")+ "*" +
rs.getString("Cognome") + "*" + rs.getString("Nome"));
}
}
catch (Exception e){
System.out.println("Impossibile connettersi");
}
}
Ovviamente questo e inserito

public class MenuTessere extends javax.swing.JFrame {
java.sql.Connection con;
JFrame frame;
public MenuTessere() {
initComponents();
ConnectDBF();
}
..........

Come posso fare a passare la connessione a un altra classe? e il relativo
recordset?


Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.