Java bits and pieces of knowledge

Source: Internet
Author: User
Tags glassfish

How to read a sound file in 1,java:

String wavename = "Voice.wav"; try {inputstream ws = GamePanel.class.getResourceAsStream (wavename); Audiostream as = new Audiostream (WS); AudioPlayer.player.start (AS); catch (Exception e) {System.out.println (E.getmessage ());}

2, configure the GlassFish jndi data source in spring:

The configuration process is simple, first login GlassFish background, resource-jdbc-connection pool, new JDBC connection pool, name casually fill (for example, FLY_JDBC), resource type Select the first DataSource, and then fill in the other property pages in the database username, password, And the access URL of the database. Click to complete, then click Ping Test, if the ping is not successful, a large reason is not a JDBC driver, so to the corresponding database driver file jar under the Domains/domain1/bin/ext file, Domain1 is the current project run the domain.

Then click the Resource-jdbc-jdbc resource, create a new JDBC resource, and the Jndi name can be filled in: for example, Fly_jnditest. Pool name Select Fly_jdbc, then OK.

The final step is to configure Spring DataSource.

  <bean id= "DataSource" class= "Org.springframework.jndi.JndiObjectFactoryBean" >
<property name= "Jndin" Ame "value=" Fly_jnditest "></property>
</bean><!--value fills in the name of the JDBC resource-->

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.