Quantcast

connect to mysql databse

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

connect to mysql databse

Bipin Yadav
hello sir........
i am facing a problem a problem in connecting jason to mysql database.
i have with java. but in jason how i can use that java code i am not able to unterstand.
java code i have written is .........


import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;
 
public class example {
 
public static void main(String[] argv) {
 
System.out.println("-------- MySQL JDBC Connection Testing ------------");
 
try {
 
Class.forName("com.mysql.jdbc.Driver");
 
} catch (ClassNotFoundException e) {
 
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
return;
 
}
 
System.out.println("MySQL JDBC Driver Registered!");
Connection conn = null;
 
try {
conn = DriverManager
.getConnection("jdbc:mysql://localhost:3306/book_crossing",
"root", "dumcs");
 
} catch (SQLException e) {
System.out.println("Connection Failed! Check output console");
e.printStackTrace();
return;
}
 
if (conn != null) {
System.out.println("You made it, take control your database now!");
} else {
System.out.println("Failed to make connection!");
}
}
}


above is the java code . i connect to the database through this code. But  for  agent speak language i need to connect this code through jason.
so please help.....and reply as soon as posible

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: connect to mysql databse

Jomi Hubner
Hi Bipin,

the easiest way to use a database is to map the agent's belief base into the database. In the Jason book it is explained in chap 7 (sec 7.4). You also find a demo in the distribution (demos/persistent-belief-base).

another option is to use an internal action (coded in Java) for that. again, you can find examples and explanation in the book and the distribution.

HTH,

Jomi


On 04/10/2011, at 12:36, Bipin Yadav wrote:

hello sir........
i am facing a problem a problem in connecting jason to mysql database.
i have with java. but in jason how i can use that java code i am not able to unterstand.
java code i have written is .........


import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;
 
public class example {
 
public static void main(String[] argv) {
 
System.out.println("-------- MySQL JDBC Connection Testing ------------");
 
try {
 
Class.forName("com.mysql.jdbc.Driver");
 
} catch (ClassNotFoundException e) {
 
System.out.println("Where is your MySQL JDBC Driver?");
e.printStackTrace();
return;
 
}
 
System.out.println("MySQL JDBC Driver Registered!");
Connection conn = null;
 
try {
conn = DriverManager
.getConnection("jdbc:mysql://localhost:3306/book_crossing",
"root", "dumcs");
 
} catch (SQLException e) {
System.out.println("Connection Failed! Check output console");
e.printStackTrace();
return;
}
 
if (conn != null) {
System.out.println("You made it, take control your database now!");
} else {
System.out.println("Failed to make connection!");
}
}
}


above is the java code . i connect to the database through this code. But  for  agent speak language i need to connect this code through jason.
so please help.....and reply as soon as posible
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users

-- 
Jomi Fred Hubner
Federal University of Santa Catarina
Department of Automation and Systems Engineering
PO Box 476, Florianópolis, SC
88040-900 Brazil


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: connect to mysql databse

Kenefosa
Hi Jomi

Your answer was very handy for me as well. I found myself in the same situation trying to connect my PostgreSQL database to my agents. I think I know what to do now.

Cheers,
Kenefosa
Loading...