copyright
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote/* AQUI FICA QUALQUER CONSULTA REALIZADA NA PÁGINA */
Quote from: •ÐG on 30 de April , 2009, 01:50:46 PM
2) Se não se cria guerras, se cria doenças;
Quote from: #ÐλяkFeλя on 30 de March , 2009, 12:11:23 PM
Isso mesmo my friend, c#(sharp)
package schema;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public final class Conexao{
public static Connection getConexao(){
// base de dados é "nome_banco_de_dados"
String url = "jdbc:mysql://localhost/nome_banco_de_dados";
String usuario = "usuario_do_banco";
String senha = "senha_do_banco";
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection conn = DriverManager.getConnection(url, usuario, senha);
return conn;
}
catch(SQLException ex){
System.err.println("SQLException: " + ex.getMessage());
System.err.println("SQLState: " + ex.getSQLState());
System.err.println("VendorError: " + ex.getErrorCode());
return null;
}
catch(Exception e){
System.err.println("Problemas ao tentar conectar com o banco de dados");
return null;
}
}
}
<%@page import="schema.Conexao"%>
<%@page import="java.sql.*"%>
<%
try {
Connection conn = Conexao.getConexao();
PreparedStatement pstmt = null;
ResultSet rs = null;
/* AQUI FICA QUALQUER CONSULTA REALIZADA NA PÁGINA */
} catch (SQLException ex) {
out.println("Excessão na consulta!");
}
%>
QuoteERROR
Due to a violation of our terms of use, the file has been removed from the server.
Quote from: Wagner.R on 27 de April , 2009, 08:41:10 PM
Se você não sabe como salvar a pagina, basta você clicar CTRL + S