- Registering the Driver
- Connecting to the Database
- Preparing SQL Statements in java
- Executing the SQL Statements on the Database
- Retrieving the Results.
- Closing the Connections.
If you need to access a database with Java, you need a driver. This is a list of the drivers available, what database they can access, who makes it, and how to contact them.
IBM DB2
jdbc:db2://<HOST>:<PORT>/<DB>
com.ibm.db2.jdbc.app.DB2Driver
JDBC-ODBC Bridge
jdbc:odbc:<DB>
sun.jdbc.odbc.JdbcOdbcDriver
Microsoft SQL Server
jdbc:weblogic:mssqlserver4:<
weblogic.jdbc.mssqlserver4.
Oracle Thin
jdbc:oracle:thin:@<HOST>:<
oracle.jdbc.driver.
PointBase Embedded Server
jdbc:pointbase://embedded[:<
com.pointbase.jdbc.
Cloudscape
jdbc:cloudscape:<DB>
COM.cloudscape.core.JDBCDriver
Cloudscape RMI
jdbc:rmi://<HOST>:<PORT>/jdbc:
RmiJdbc.RJDriver
Firebird (JCA/JDBC Driver)
jdbc:firebirdsql:[//<HOST>[:<
org.firebirdsql.jdbc.FBDriver
IDS Server
jdbc:ids://<HOST>:<PORT>/conn?
ids.sql.IDSDriver
Informix Dynamic Server
jdbc:informix-sqli://<HOST>:<
com.informix.jdbc.IfxDriver
InstantDB (v3.13 and earlier)
jdbc:idb:<DB>
jdbc.idbDriver
InstantDB (v3.14 and later)
jdbc:idb:<DB>
org.enhydra.instantdb.jdbc.
Interbase (InterClient Driver)
jdbc:interbase://<HOST>/<DB>
interbase.interclient.Driver
Hypersonic SQL (v1.2 and earlier)
jdbc:HypersonicSQL:<DB>
hSql.hDriver
Hypersonic SQL (v1.3 and later)
jdbc:HypersonicSQL:<DB>
org.hsql.jdbcDriver
Microsoft SQL Server (JTurbo Driver)
jdbc:JTurbo://<HOST>:<PORT>/<
com.ashna.jturbo.driver.Driver
Microsoft SQL Server (Sprinta Driver)
jdbc:inetdae:<HOST>:<PORT>?
com.inet.tds.TdsDriver
Microsoft SQL Server 2000 (Microsoft Driver)
jdbc:microsoft:sqlserver://<
com.microsoft.sqlserver.jdbc.
MySQL (MM.MySQL Driver)
jdbc:mysql://<HOST>:<PORT>/<
com.mysql.jdbc.Driver
Oracle OCI 8i
jdbc:oracle:oci8:@<SID>
oracle.jdbc.driver.
Oracle OCI 9i
jdbc:oracle:oci:@<SID>
oracle.jdbc.driver.
PostgreSQL (v6.5 and earlier)
jdbc:postgresql://<HOST>:<
postgresql.Driver
PostgreSQL (v7.0 and later)
jdbc:postgresql://<HOST>:<
org.postgresql.Driver
Sybase (jConnect 4.2 and earlier)
jdbc:sybase:Tds:<HOST>:<PORT>
com.sybase.jdbc.SybDriver
Sybase (jConnect 5.2)
jdbc:sybase:Tds:<HOST>:<PORT>
com.sybase.jdbc2.jdbc.
----------------------------------------------
Here i am writing a sample code for JDBC.
try
{
Class.forName("Driver name");
// DriverManager.registerDriver(new Drivername());
Connection con = DriverManager.getConnenction(" jdbcurl","username","password" );
Statement st = con.createStatement();
ResultSet rs= st.executeQuery("select * from Tablename");
While(){}
rs.close();
st.close();
conn.close();
}
catch(Exception e)
{
}
Thanks
Vinay Guntaka
No comments:
Post a Comment