hello please help me i have a program and i want to connect to the database i don't have any idea on how to connect because im still a begginer on this..help me please how to connect to the database,hoping for your positive responds
if you're still a beginner, connecting to databases might not be the best place to start.
anyway, how to connect depends on several things, what kind of database, is there a password, ... and since you don't tell anything about that, I'm not going on a wild goose chase.
the next link however should give you a good idea about what you need and how you should proceed: JDBC at http://java.sun.com/
Well...this is a code snippet to connect to oracle data base using type-1 driver using your java program:...hope this helps you......
public static void main(String args)
System.out.println("The name of the database you are using is: "+str);
}//end of try
}//end of main
}//end of class
1.Class.forName() method loads and registers the jdbc type-1 driver named sun.jdbc.odbc.JdbcOdbcDriver
2.DriverManager.getConnection() method The attempts to select an appropriate driver from the set of registered JDBC drivers
3.The DatabaseMetaData is an interface and is used to find the details of the
database you are connected to....
I used the DatabaseMetaData to confirm that you are connected to the database.
//"Fardoon" is the dsn name(userdefined) u create to connect to the database using the ODBC connection for oracle
you create an user dsn(data source name) by going to control panel->Administrative tools->Data Sources(ODBC)->Go for Add->select Microsoft ODBC for Oracle->select finish->then you get a dialog box and enter only the dsn name(ignore other text fields) and select ok...you can see the new dsn name in the user dsn list newly created...