是否有连接Oracle数据库的选项,如(SQLite):
Connection conn = null;
try {
// db parameters
String url = "jdbc:sqlite:C:/sqlite/db/chinook.db";
// create a connection to the database
conn = DriverManager.getConnection(url);
System.out.println("Connection to SQLite has been established.");
我希望我的Oracle数据库位于程序目录中,如下所示:
String url = "jdbc:sqlite:C:/sqlite/db/chinook.db";
Oracle DB Connetion:
try{
Class.forName("oracle.jdbc.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","oracle");
return con;
我不想像
那样运行localhostDriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","oracle");