Java Groovy Grails 2019. 12. 5. 15:54
import groovy.sql.Sql

    def get_chem_id (String formula){

		def results=""
		def productIds=""
		def resultsList=[:]
		def qstring="select * from sigma_aldrich where Formula ='"+formula+"'"
		def sqlrows = Sql.newInstance('jdbc:mysql://'+mysql_server_ip+':3306/apolex', dbuser, dbpass, 'com.mysql.jdbc.Driver')  
		sqlrows.eachRow(qstring){ row ->  
			resultsList << [id:row.Product_number]
			productIds=row.Product_number
		} 		
		sqlrows.close()
		resultsList.each{println it}
		
		return productIds	
	}	
posted by 사용자 kimsooil
TAG ,

댓글을 달아 주세요