URL string format for connecting to Oracle database with JDBC

前端 未结 7 1441
予麋鹿
予麋鹿 2020-12-02 09:44

I\'m a newbie to Java-related web development, and I can\'t seem to get a simple program with JDBC working. I\'m using off-the-shelf Oracle 10g XE and the Eclipse EE IDE. Fr

相关标签:
7条回答
  • 2020-12-02 10:47

    Look here.

    Your URL is quite incorrect. Should look like this:

    url="jdbc:oracle:thin:@localhost:1521:orcl"
    

    You don't register a driver class, either. You want to download the thin driver JAR, put it in your CLASSPATH, and make your code look more like this.

    UPDATE: The "14" in "ojdbc14.jar" stands for JDK 1.4. You should match your driver version with the JDK you're running. I'm betting that means JDK 5 or 6.

    0 讨论(0)
提交回复
热议问题