I'm having problems connecting to the databse via a java program. I'm using Win 98 and Oracle 9i Personal Edition. The database is on the same machine as the code. Accessing the data via SQL Plus works fine.
The database is mounted and ready. I tried using the following program but get the error listed below. Do I need to create a new datasource using Start -> Settings -> ODBC Data Sources or what is the datasource that has been provided with Oracle 9i.
Also in the url for the getConnection, do I use the sid value in here e.g my sid is Rajesh so do I use "jdbc dbc:Rajesh"
Thanks in advance, Rajesh
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6879) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7036) at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(JdbcOdbc.java:3028) at sun.jdbc.odbc.JdbcOdbcConnection.initialize(JdbcOdbcConnection.java:323) at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:174) at java.sql.DriverManager.getConnection(DriverManager.java:512) at java.sql.DriverManager.getConnection(DriverManager.java:171) at TestConnect.main(TestConnect.java:12)
If you want to use the JDBC/ODBC bridge drive then you'll need to create an ODBC DSN as you suggest. I would personally recommend using an Oracle JDBC driver. There may be one included with your installation. If not you can download one for free from Oracle's website. The bit after jdbcdbc: is the ODBC Data Source Name (DSN), not the Oracle SID.
Joined: May 15, 2003
How do I find out what Oracle drivers has been included in my installation. Also, how do I find out the Oracle Data Source Name and what should I use.
Please excuse my ignorance but I'm new to this side of programming.
Hi certainly JDBC driver is installed in your machine when you install Oracle check for a folder named JDBC in your installation directory inside jdbc you can find a LIB directory which contains all required jar files put [oracle 9i2] %Oracle_home%\jdbc\lib\ojdbc14.jar in your class path when Oracle_home is where u installed Oracle.
DatabaseName is what you entered during installation as SID -AFAIR- for example a connection String could be like this :