Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
/**
*
*/
package de.tutorials;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.Statement;
/**
* @author Tom
*
*/
public class RegisterMSAccessDatabaseAsODBCDataSource {
/**
* @param args
*/
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
String dataSourceName = "tutorialsDE";
String dataSourceLocation = "C:/Programme/Microsoft Office/Office/Samples/Nordwind.mdb";
ProcessBuilder processBuilder = new ProcessBuilder(
"c:/windows/system32/odbcconf.exe /a {CONFIGSYSDSN \"Microsoft Access Driver (*.mdb)\" \"DSN=tutorialsDE;DBQ=C:/Programme/Microsoft Office/Office/Samples/Nordwind.mdb\"}"
.split(" "));
Process process = processBuilder.start();
if (0 == process.waitFor()) {
System.out.println("DSN created!");
}
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection connection = DriverManager.getConnection("jdbc:odbc:"
+ dataSourceName, "Administrator", "");
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * FROM Kunden");
ResultSetMetaData resultSetMetaData = resultSet.getMetaData();
int columnCount = resultSetMetaData.getColumnCount();
while (resultSet.next()) {
for (int i = 1; i <= columnCount; i++) {
System.out.print(resultSet.getString(i));
System.out.print(" ");
}
System.out.println();
}
resultSet.close();
statement.close();
connection.close();
}
}
String connect="c:/windows/system32/odbcconf.exe /a {CONFIGSYSDSN \"Microsoft Access Driver (*.mdb)\" \"DSN=movdb;DBQ="+file.getSelectedFile().toString()+"\"}";
ProcessBuilder processBuilder = new ProcessBuilder(connect.split(" "));
Process process = processBuilder.start();
......