Home| Progetto| Web| Faq| Acronimi | ||||
Argomenti Documenti pubblicabili:1120
Scripts:1282 Documenti non pubblicabili:162 Categorie tematiche:68 .Net |_C# |_Visual basic.net |_Asp.net Active Server Pages C++ Cascade Style Sheet JavaScript Mysql Php Xml Java |_Java 2 Micro Edition |_Java server pages |_Java Servlet Oracle |_PLSQL PostgreSQL Unix
Java...
Info:
Tipologie comuni di metodi specializzati
Oracle...
Script:
Cercare le colonne in uno schema
Unix...
Tip:
How remove a file named -r
PLSQL...
Script:
for i in 1.. strutture di controllo
Java...
Tip:
Il parametro verbose
Shell scripting...
Script:
Script for archiving and compressing folder and file
Basically, a web session can be defined as the timeframe in which a visitor navigates your web site.
Php Funzione mail()
XPath is a language for addressing parts of an XML document.
It is designed to be used by XSLT and XPointer.
Basically, a web session can be defined as the timeframe in which a visitor navigates your web site.
|
Java
Home >Java > Connessione ad un database ed estrazione dei dati
/******************************************************************** * SEMPLICE APPLICAZIONE: CONNESSIONE A DATABASE(Mysql) via jdbc, Estrazione dei dati * Marco Magnani 2003 Freeware * Java Tutorial JDBC Example adapted to MySQL * MM MySQL Driver Version -> http://www.mysql.com/ scaricare mysql-connector-java-2.0.14.zip * Note: installare il driver per Mysql com.mysql.jdbc oppure scaricare il Driver mm.jdbc e * modificare il codice * Per eseguire il programma sono necessarie le strutture mysql * database: mydatabase * tabella: members (popolata) * cfr. la sezione mysql per le isruzioni necessarie * Può essere necessario settare username e password *******************************************************************/ import java.sql.*; public class mysqlQuery { public static void main(String args[]) { // ---- configure this for your site String username = null; String password = null; // Sintassi: jdbc:TYPE:machine:port/Nome_database String url = "jdbc:mysql://localhost/mydatabase"; // Stringa sql String queryString = "SELECT NAME, CREDITS FROM MEMBERS"; // caricamento del Driver (Codice specifico del Produttore) try { Class.forName("com.mysql.jdbc.Driver"); } catch(java.lang.ClassNotFoundException e) { System.err.print("ClassNotFoundException: "); System.err.println(e.getMessage()); } try { Connection con; Statement stmt; // Connessione al database con = DriverManager.getConnection(url, username, password); System.out.println ("Ok, la connessione e' stata attivata."); System.out.println ("Proviamo ad estrarre i dati con la seguente query: " + queryString); // Creazione dell'oggetto Statement stmt = con.createStatement(); // esecuzione della query and e creazione del resultset ResultSet rs = stmt.executeQuery(queryString); // svolgimento del resultset while (rs.next()) { String s = rs.getString("NAME"); float n = rs.getFloat("CREDITS"); System.out.println(s + " " + n); } // Chiusura delle risorse stmt.close(); con.close(); } // Gestione degli errori catch(SQLException e) { System.err.println("==> SQLException: "); while (e != null) { System.out.println("Message: " + e.getMessage ()); System.out.println("SQLState: " + e.getSQLState ()); System.out.println("ErrorCode: " + e.getErrorCode ()); e = e.getNextException(); System.out.println(""); } } } } Warning: include(ads/text468x15.html): failed to open stream: No such file or directory in D:\inetpub\webs\fishscriptcom\documents\view_document.php on line 131 Warning: include(): Failed opening 'ads/text468x15.html' for inclusion (include_path='.;C:\php\pear') in D:\inetpub\webs\fishscriptcom\documents\view_document.php on line 131 Tutorial ![]() ![]() ![]() ![]() ![]() ![]() ![]() Script ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Comandi ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Cerca
Java...
Info:
Java conceived as an interpreted language
A good scientist is a person with original ideas.
A good engineer is a person who makes a design that works with as few original ideas as possible. There are no prima donnas in engineering. Freeman Dyson A good scientist is a person with original ideas.
A good engineer is a person who makes a design that works with as few original ideas as possible. There are no prima donnas in engineering. Freeman Dyson
Java...
Info:
Tipologie comuni di metodi specializzati
Java...
Definizioni:
Interfaccia
Oracle...
Definizioni:
Variabile bind
Shell scripting...
Script:
Script for archiving and compressing folder and file
fishScript.Com is accessible by Mobile access technology
as mobile phones, Palm and Pocket PC .
Nicoleta e Marco Magnani tutorial, examples, courses, esempi, corsi, esercizi, appunti vari Dottoressa Nicoleta Dragu Formatrice Docente Insegnante Mediatrice Culturale Dott. Marco Magnani Universita La Sapienza Roma Master Computer Science Hunter College New York , Data Base Administrator DBA oracle System architect |