postgreSQL JDBC 驱动程序的 .jar 文件。如何配置?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5603556/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-20 22:57:24  来源:igfitidea点击:

.jar file for postgreSQL JDBC driver. How to configure?

javapostgresqljdbc

提问by prometheuspk

I am trying to create a connection for the JDBC driver in netbeans for windows. THe problem is that i cannot make a domain source name with the .jar file provided from http://jdbc.postgresql.org/download.html

我正在尝试为 windows 的 netbeans 中的 JDBC 驱动程序创建连接。问题是我无法使用提供的 .jar 文件创建域源名称http://jdbc.postgresql.org/download.html

Can anyone help?

任何人都可以帮忙吗?

回答by Stephen C

What you need to do to configure the PostgreSQL JDBC drivers is clearly documented in sections 2 and 3 of The PostgreSQL JDBC Interface.

配置 PostgreSQL JDBC 驱动程序所需执行的操作在The PostgreSQL JDBC Interface 的第 2 和第 3 节中有明确记录。

This covers:

这包括:

  • adding the driver JARs to your project,
  • modifying your source code to use the driver, and
  • creating the "jdbc:" connection URL that tells your Java client code what database to connect to.
  • 将驱动程序 JAR 添加到您的项目中,
  • 修改您的源代码以使用驱动程序,以及
  • 创建“jdbc:”连接 URL,告诉您的 Java 客户端代码要连接到哪个数据库。

If you have a specific question that is not covered by the manual, please update your Question.

如果您有手册未涵盖的特定问题,请更新您的问题。

回答by Harry Joy

If you are making web project then here is a project structure:

如果您正在制作网络项目,那么这里是一个项目结构:

TOMCAT_HOME
    -webapps
        -YourProject
             -WEB_INF
                 -lib

Now in lib folder you can have all the jars file used by that project.

现在在 lib 文件夹中,您可以拥有该项目使用的所有 jars 文件。

By adding files in TOMCAT_HOME/libyou make jars available to all projects on that server. I mean all project deployed on that tomcat.

通过在其中添加文件,TOMCAT_HOME/lib您可以使该服务器上的所有项目都可以使用 jar。我的意思是部署在那个 tomcat 上的所有项目。