import java.sql.*;
import java.text.ParseException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.logging.Level;
import java.util.logging.Logger;
public class DBVerbindung
{
/**
* @param args the command line arguments
*/
{
try
{
String db_file_name_prefix =
"C:\\Users\\Andreas\\workspace\\TinaProjekt\\src\\Name.sql";
// Load the HSQL Database Engine JDBC driver
// hsqldb.jar should be in the class path or made part of the current jar
Class.forName("com.mysql.jdbc.Driver");
// connect to the database. This will load the db files and start the
// database if it is not alread running.
// db_file_name_prefix is used to open or create files that hold the state
// of the db.
// It can contain directory names relative to the
// current working directory
con =
DriverManager.
getConnection("jdbc:mysql:file:" + db_file_name_prefix,
// filenames "sa", // username
""); // password
//look at " for table name
ResultSet rs = statement.
executeQuery("SELECT * FROM Name");
//print the result set
while (rs.next())
{
System.
out.
print("Schirm: " + rs.
getString("Name"));
}
statement.close();
con.close();
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
ex.printStackTrace();
{
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void schliesseVerbindung()
{
try
{
stmt.close();
con.close();
}
{
System.
out.
println(sqle.
toString());
}
}
}