[Java DB] Problème de connection
Bonjour,
je ne sais pas si je suis dans la bonne section du forum, (j'ai hésité entre JDBC et NetBeans) donc je m'excuse d'avance si c'est le ccas.
J'ai suivi ce tutoriel : http://brabant.developpez.com/tutori...ans/5.0/derby/, et le problème c'est que quand j'essai de me connecter à partir d'un programme Java, j'obtient :
Citation:
run:
java.sql.SQLSyntaxErrorException: Le schéma 'FARID' n'existe pas
BUILD SUCCESSFUL (total time: 1 second)
Pour le schéma, je n'y ai pas accés, l'onglet avancé est inactif...
Voila mon code :
Code:
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
| /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package testedb;
import java.sql.*;
/**
*
* @author farid
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
String dburl = "jdbc:derby://localhost:1527/Base1";
String user = "farid";
String pass = "012345";
try
{
Class.forName("org.apache.derby.jdbc.ClientDriver");
Connection c;
c = DriverManager.getConnection(dburl, user, pass);
Statement s = c.createStatement();
int i = s.executeUpdate("INSERT INTO others VALUES (1, 'Jean')");
ResultSet r = s.executeQuery("SELECT * FROM tests");
while(r.next())
{
System.out.println(r.getString("test_id"));
}
s.close();
}
catch(Exception e)
{
System.out.println(e.toString());
}
}
} |
Merci.