1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| /*
* Main.java
*
* Created on 21 mars 2007, 15:30
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
//package javaapplication4;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import org.firebirdsql.management.*;
/**
*
* @author Admin
*/
public class bd {
/** Creates a new instance of Main */
public bd() {
}
/**
* @param args the command line arguments
*/
//public static void main(String[] args) {
// TODO code application logic here
public static void main(String[] args) throws SQLException {
try {
// TODO code application logic here
Class.forName ("org.firebirdsql.jdbc.FBDriver");
//String databaseURL = "jdbc:firebirdsql://3050:c:/ydata/plsouss/Gestion/2007/Data.fdb";
//String databaseURL = "jdbc:firebirdsql://3050:c:/ydata/plsouss/Gestion/2007/Data.fdb";
String databaseURL = "jdbc:firebirdsql:localhost/3050:C:/ydata/Agrilit/Gestion/2007/Data.yag";
String user = "SYSDBA";
String password = "masterkey";
String strQuery = "SELECT * FROM f0011";
Connection conn = DriverManager.getConnection(databaseURL,user,password);
Statement stAddUser = conn.createStatement();
ResultSet rsLogin = stAddUser.executeQuery(strQuery);
while (rsLogin.next()) {
String s = rsLogin.getString(1);
s = rsLogin.getString(1) + " " + rsLogin.getString(2) +" " + rsLogin.getString(3)
+" " + rsLogin.getString(4)+" " + rsLogin.getString(5)+" " + rsLogin.getString(6) ;
System.out.println(s);
}
System.out.println("--- OKI CA MARCHE ---");
}
catch (ClassNotFoundException ex)
{
ex.printStackTrace();
System.err.println("!!! CA MARCHE PAS !!!");
}
}
} |
Partager