Simple demo of accessing DB using JNDI.

 

Using JNDI connecting DBHow to get the connection?  

1. get context;

2. lookup for datasource config;

3. get connection from this datasource;

 

Using JNDI connecting DB How to execute SQL?

1. declear SQL String;

2. transform sql into statment on the connection we have got;

3. execute the statement to get the result set;

 

Using JNDI connecting DBHow to fetch my target field from the result set?

1. for each of the result item;

2. getData(“fieldName”);

 

Using JNDI connecting DBFinally, don’t forget to do close the connection, if necessary.

 

Using JNDI connecting DBWhere is the source code?

please refer to http://www.kodejava.org/examples/131.html

 

Using JNDI connecting DBQuestions:

When does the connection established?

At the same time with the program starts.

相关文章:

  • 2022-12-23
  • 2021-05-26
  • 2021-05-05
  • 2022-12-23
  • 2021-09-25
  • 2021-08-26
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2021-09-02
  • 2022-01-14
  • 2022-01-13
相关资源
相似解决方案