Serialization big object(100k--2M) into MYSQL database
Hi all !
I have a big object need to be persisted into MYSQL database in my application.
I use two method to meet this request
1 ---- the object implement interface Serializable, but there is serializationVersionID is not same Exception
sometimes.
2 ---- Use XMLEncoder to save my object, the XMLEncoder generate the object XML text about 200k -- 3 M
, but another problem occur :
when I call flush method of XMLEncoder, my application will full ocuppy CPU time, and memory usage will increase to 90M, sometimes will ocurr "Not enough memory" Error.
Why?
can some one help me?
Thanks in advanced
1. You are modifying the signature of one or more of your classes that alters the (system generated) serializationVersionUID and then recompiling. You can declare this for yourself to get control to some extent. See the serialization spec for details.
2. Your object graph is very large, which might be a problem using native or xml formats. Again, the specification details ways in which you can control the serialized form of your objects.
On the information you've provided there's not much more that can be said.
Similar Messages
-
How to update transaction data automatically into MySQL database using PI
Dear All,
With reference to subject matter I want a sincere advice regarding how to update transaction data automatically into MySQL database using PI. Is there any link available where I can get step-by-step process.
Ex: I have a MYSQL database in my organization. Whenever a delivery created in SAP some fields like DO Number, DO quantity, SO/STO number should get updated in MYSQL database automatically.
This scenario is related to updation of transactional data into MYSQL DB and I want your suggestions pertaining to same issue.
Thanks and Regards,
Chandra SekharHi .
Develop a sceanrio between SAP to Database system,When the data updates in SAP Tables read the data and update it in DATA Base using JDBC adapter,but there will be some delay in updating data in MySQL.
serach in sdn for IDOC-TOJDBC sceannario,many documents available for the same.
Regards,
Raja Sekhar -
Upload image into mysql database residing on remote server is not working?
hello to all,
i need ur help,we hav online site .
i have to upload image(which can b from any pc) into mysql database residing on remote server of which we (don't hav actual path of that server).
the solution i'm using is working correctly on local bt when transfer it to server it shows
java.io.FileNotFoundException: (No such file or directory)
i have used multipartRequest to access parameter of file type input.
all variables and related packages r imported properly.no prblm in that.
code is here....................................
try {
MultipartRequest multi = new MultipartRequest(request, ".", 500000 * 1024);
File f = multi.getFile("uploadfile");
out.println(f.getName());
filename = f.getName();
String type = multi.getContentType(f.getName());
fis=new FileInputStream(filename);
byte b[]=new byte[fis.available()];
fis.read(b);
fis.close();
Blob blob=new SerialBlob(b);
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://10.1.52.206:3306/test?user=root&password=delhi");
String query="insert into uploads (FILENAME,BINARYFILE,) values (?,?)";
pstmt=con.prepareStatement(query);
pstmt.setString(1,filename);
pstmt.setBlob(2,blob);
int i=pstmt.executeUpdate();
if(i>0)
out.println("Image Stored in the Database");
else
out.println("Failed");
} catch (Exception ex) {
out.print("*******************"+ex);
ex.printStackTrace();
please suggest me the way to upload image to remote server** not on local server.
its urgent.
Edited by: JavaDevS on Jul 28, 2008 11:41 AMi need ur help,we hav online site .Please don't use these juvenile abbreviations. It's impolite when you're asking for assistance not to make the effort to spell out all of the words. Moreover in a forum with an international readership the use of standard English will reduce the possibility of confusion.
I presume that your file upload is being placed in a different directory from that which you were expecting. I would suggest logging all paths (specifically filename) to see if this is an unexpected value.
Please explain further what you mean by "local" - is this a stand-alone application, or merely running a copy of the server on your local machine and doing the transfer (via the browser) to that? Are there any other differences such as the browser used? -
Is this the fastest way to insert 100k rows into a database?
I'm looking to insert ~100k rows into a database as fast as possible. I'm connected to the database through a small LAN with static IP adresses. The target database is running my SQL. Here's the fastest I've gotten the code so far. Task manager shows that it's only sending like 2.5mbps. If I take the size of the 2D array (64MB) and divide by the time it takes to transfer it currently, I calculate ~160kbps. Is that the best I can hope for with the NI DB Toolkit?
CLD (2014)Hi,
Use DB Tool Insert Data VI to insert the data in the database.
You can insert complete row data at a time. No need to insert single-single element in database this will reduce your code performance.
Thanks and Regards
Himanshu Goyal | LabVIEW Engineer- Power System Automation
Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
It Only gets BETTER!!! -
Hi,
I recently purchased The Dreamweaver developer toolbox, and I thought there was a behavior to import an XML file into a database (because dreamweaver bought interakt software http://www.interaktonline.com/Products/Dreamweaver-Extensions/XMLImport-Export/Statement/ )
But now I see it isn't possible anymore.
Is there someone who can help me to find a decent extention (php/mysql) to import an external xml into mysql database?
Kind Regards,
BertelNot DW extensions, but plenty of classes to do it at...
http://www.google.com/custom?domains=www.phpclasses.org&q=XML+import&sa=Search&sitesearch= www.phpclasses.org&client=pub-2951707118576741&forid=1&channel=5742870948&ie=ISO-8859-1&oe =ISO-8859-1&cof=GALT%3A%23663399%3BGL%3A1%3BDIV%3A%23222222%3BVLC%3A663399%3BAH%3Acenter%3 BBGC%3AA3C5CC%3BLBGC%3AA3C5CC%3BALC%3A0000FF%3BLC%3A0000FF%3BT%3A000000%3BGFNT%3A0000FF%3B GIMP%3A0000FF%3BLH%3A50%3BLW%3A256%3BL%3Ahttp%3A%2F%2Ffiles.phpclasses.org%2Fgraphics%2Fgo oglesearch.jpg%3BS%3Ahttp%3A%2F%2Fwww.phpclasses.org%2Fsearch.html%3BFORID%3A1%3B&hl=en -
Problem with inserting data into mySQL database with jsp
I have a jsp page that collects infromation about a users vehicle and puts the data into a mySQL database. Iv'e been messing around with it for ages & i can't seem to get it to work even though i cannot see anything wrong with the code, which can be seen below.
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="Connections/connection.jsp" %>
<%
// *** Restrict Access To Page: Grant or deny access to this page
String MM_authorizedUsers="";
String MM_authFailedURL="login_form.jsp";
boolean MM_grantAccess=false;
if (session.getValue("MM_Username") != null && !session.getValue("MM_Username").equals("")) {
if (true || (session.getValue("MM_UserAuthorization")=="") ||
(MM_authorizedUsers.indexOf((String)session.getValue("MM_UserAuthorization")) >=0)) {
MM_grantAccess = true;
if (!MM_grantAccess) {
String MM_qsChar = "?";
if (MM_authFailedURL.indexOf("?") >= 0) MM_qsChar = "&";
String MM_referrer = request.getRequestURI();
if (request.getQueryString() != null) MM_referrer = MM_referrer + "?" + request.getQueryString();
MM_authFailedURL = MM_authFailedURL + MM_qsChar + "accessdenied=" + java.net.URLEncoder.encode(MM_referrer);
response.sendRedirect(response.encodeRedirectURL(MM_authFailedURL));
return;
String vehicle_details__registration = null;
if(request.getParameter("txt_registration") != null){ vehicle_details__registration = (String)request.getParameter("txt_registration");}
String vehicle_details__make = null;
if(request.getParameter("txt_make") != null){ vehicle_details__make = (String)request.getParameter("txt_make");}
String vehicle_details__model = null;
if(request.getParameter("txt_model") != null){ vehicle_details__model = (String)request.getParameter("txt_model");}
String vehicle_details__colour = null;
if(request.getParameter("txt_colour") != null){ vehicle_details__colour = (String)request.getParameter("txt_colour");}
String vehicle_details__tax_class = null;
if(request.getParameter("select_tax_class") != null){ vehicle_details__tax_class = (String)request.getParameter("select_tax_class");}
String vehicle_details__chasis_num = null;
if(request.getParameter("chasis_num") != null){ vehicle_details__chasis_num = (String)request.getParameter("chasis_num");}
String vehicle_details__status = null;
if(request.getParameter("radio_status") != null){ vehicle_details__status = (String)request.getParameter("radio_status");}
String owner_details__MMColParam = "1";
if (session.getValue("MM_Username") !=null) {owner_details__MMColParam = (String)session.getValue("MM_Username");}
Driver Drivervehicle_details = (Driver)Class.forName(MM_connection_DRIVER).newInstance();
Connection Connvehicle_details = DriverManager.getConnection(MM_connection_STRING,MM_connection_USERNAME,MM_connection_PASSWORD);
PreparedStatement vehicle_details = Connvehicle_details.prepareStatement("INSERT INTO vehicle_man_db.vehicle_details (registartion, make, model, colour, tax_class, chasis_num) VALUES ('"+ String vehicle_details__registration + "', '"+ String vehicle_details__make + "', '"+ String vehicle_details__model + "', '"+ String vehicle_details__colour + "', '"+ String vehicle_details__tax_class + "', '"+ String vehicle_details__chasis_num + "', '"+ String vehicle_details__status + "')");
vehicle_details.executeUpdate();
%>
<form name="add_vehicle_form" id="add_vehicle_form">
<p>Registration mark:
<input name="txt_registration" type="text" id="txt_registration">
</p>
<p>Make:
<input name="txt_make" type="text" id="txt_make">
</p>
<p>Model:
<input name="txt_model" type="text" id="txt_model">
</p>
<p>Colour:
<input name="txt_colour" type="text" id="txt_colour">
</p>
<p>Tax Class:
<select name="select_tax_class" id="select_tax_class">
<option value="AAA">Band AAA (up to 100g/km)</option>
<option value="AA">Band AA (101 - 120g/km)</option>
<option value="A">Band A (121 - 150g/km)</option>
<option value="B">Band B (151 - 165g/km)</option>
<option value="C">Band C (166 - 185g/km)</option>
<option value="D">Band D (Over 185g/km)</option>
</select>
</p>
<p>Chasis Number:
<input name="txt_chassis_num" type="text" id="txt_chassis_num">
</p>
<p>Status: active:
<input name="radio_status" type="radio" value="1" checked>
off-road
<input name="radio_status" type="radio" value="0">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
<%
Connvehicle_details.close();
%>This is the error I am getting from the server
org.apache.jasper.JasperException: Unable to compile class for JSP
An error occurred at line: 3 in the jsp file: /add_vehicle_form.jsp
Generated servlet error:
C:\Servers\Tomcat 5.0\work\Catalina\localhost\Assignment\org\apache\jsp\add_005fvehicle_005fform_jsp.java:113: ')' expected
PreparedStatement vehicle_details = Connvehicle_details.prepareStatement("INSERT INTO vehicle_man_db.vehicle_details (registartion, make, model, colour, tax_class, chasis_num) VALUES ('"+ String vehicle_details__registration + "', '"+ String vehicle_details__make + "', '"+ String vehicle_details__model + "', '"+ String vehicle_details__colour + "', '"+ String vehicle_details__tax_class + "', '"+ String vehicle_details__chasis_num + "', '"+ String vehicle_details__status + "')");
^
1 error
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
Any help would be much appreciated.
Thanksuse this ...
PreparedStatement vehicle_details =
Connvehicle_details.prepareStatement("INSERT INTO
vehicle_man_db.vehicle_details (registartion, make,
model, colour, tax_class, chasis_num) VALUES
vehicle_details .setString(1,String
vehicle_details__registration );
vehicle_details setString(2,String
vehicle_details__make );
vehicle_details .setString(3,String
vehicle_details__model );
vehicle_details .setString(4,vehicle_details__colour
vehicle_details .setString(5,String
vehicle_details__tax_class);
vehicle_details .setString(6,String
vehicle_details__chasis_num );
vehicle_details .executeQuery();Even you need a screwing up... what's the point putting that String inside. That's the bloody error. -
Inserting user variables into MYSQL database using servlet
I have a servlet that recieves user entered parameters from an html form and inserts them into a user table in MYSQL, or at least is supposed to. I can get it to update the table with specific values but not with the user variables. I know the single quote marks are for inserting specific values but without them it doesn't properly work.
The parameters are parsed correctly into the variables, so I just can't figure out how to ge tthe variables into the database. Any help would be wonderful
register.html:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Register</TITLE>
</HEAD>
<BODY BGCOLOR="#FDF5E6">
<CENTER><IMG SRC="dvdti.jpg" ALIGN=middle > </CENTER>
<HR>
<H1 ALIGN="CENTER">Please enter your registration details:</H1>
<FORM ACTION="http://localhost:8080/examples/servlet/Assignment1.register">
<BR>First Name: <input type="text" NAME="Ufirst_name"><BR>
<BR>Last Name: <input TYPE="TEXT" NAME="Ulast_name"><BR>
<BR>Address: <INPUT TYPE="text" name="Uaddress"><BR>
<BR>E-mail: <INPUT TYPE="TEXT" NAME="Uemail"><BR
<BR>Password: <INPUT TYPE="password" NAME="Upassword"><BR>
<CENTER>
<INPUT TYPE="SUBMIT" VALUE="Register">
</CENTER>
</FORM>
</BODY>
</HTML>
register.java:
package Assignment1;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
// Connects to a database to retrieve music data
public class register extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
// Database connection code starts here
Connection conn = null;
// loading jdbc driver for mysql (help in mysql.jar file in classpath)
try{
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch(Exception e) {
System.out.println(e);
// connecting to database
try{
// connection string for demos database, username demos, password demo-pass
conn = DriverManager.getConnection
("jdbc:mysql://mudfoot.doc.stu.mmu.ac.uk:3306/roddiea?user=roddiea&password=");
System.out.println("Connection to database successful.");
catch(SQLException se) {
System.out.println(se);
// Create select statement and execute it
try { Statement stmt2 = conn.createStatement();
// Get the regdetails from the reg form
String Ufirst_name = request.getParameter("Ufirst_name");
String Ulast_name = request.getParameter("Ulast_name");
String Uaddress = request.getParameter("Uaddress");
String Uemail = request.getParameter("Uemail");
String Upassword = request.getParameter("Upassword");
stmt2.executeUpdate("INSERT INTO customer(first_name, last_name, address, email, password)" + "VALUES('Ufirst_name', 'Ulast_name', 'Uaddress', 'Uemail', 'Upassword')");
System.out.println (stmt2);
out.println(stmt2);
out.println(Ufirst_name + Ulast_name + Uaddress + Uemail + Upassword);
// close the html
out.println("</BODY></HTML>");
stmt2.close();
conn.close();
}catch(SQLException se) {
System.out.println(se);
}Message was edited by:
Altered_Carbon
Message was edited by:
Altered_Carbon
I also realise that this is a more MYSQL titled problem, but those forums look rubbish <_<Investigate PreparedStatement.
Currently you're trying to insert a value "Ufirst_name" instead of the value of the variable called Ufirst_name.
It's possible to do this (you could do something like this: "... '" + UfirstName + "' ...") but DEFINITELLY NOT RECOMMENDED. Instead use a prepared statement.
D. -
How to insert encrypted data by using blowfish into mysql database
Hi
I have encrypted data using blowfish algorithm . And i tried to insert that encrypted data into mysql. it was stored but i dont know that it stores in the same encrypted formate
When i am trying to get the encrypted data from the mysql database and decrypting that data i am getting errors.
Exception are like
input length should be multiple of 8 bits
or Given block are not properly padded
and when i am displaying the data using system.out.println ();
the string is not similar to the string which is in database.
what is the problem how can i solve my problem
thank youIt sounds like your column is a VARCHAR so you need to Base64 or Hex encode the cipertext bytes before putting them in the database.
-
Parsing XML data into MySQL database
I need to parse data from an xml document rsiding on amother
server into a mysql database residing on my server, so that I can
pull data into a php site.
Any help? Mybe there's a commercial script or something?
I would also need to update the data daily
Thanks!!Check this out.
http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_xmlsav.htm#1008593 -
Uploading a file into mySQL database?
Hello, everybody.
Can anyone give me a code snippet or at least a hint, how could I upload a file into the BLOB field of mySQL database using JSP webpage? How do you generally store uploaded files on the server? If anyone could suggest a good algorythm of saving the files in the server's file system and saving only their URLs in the database (this was my initial idea), I would be ready to accept this as well.
Would be appreciated for any help.Hi
Fou uploading the files from client site to server user the utility given by oreilly Go to this site and down the code for uploading the source code for fileupload
For writing this code to database use this code
code
import java.sql.*;
import java.io.*;
class BlobTest {
public static void main(String args[]) {
try {
//File to be created. Original file is duke.gif.
DriverManager.registerDriver( new org.gjt.mm.mysql.Driver());
Connection conn = DriverManager.getConnection("jdbc:mysql://agt_229/test","manoj","manoj");
/*PreparedStatement pstmt = conn.prepareStatement("INSERT INTO BlobTest VALUES( ?, ? )" );
pstmt.setString( 1, "photo1");
File imageFile = new File("duke.gif");
InputStream is = new FileInputStream(imageFile);
pstmt.setBinaryStream( 2, is, (int)(imageFile.length()));
pstmt.executeUpdate();
PreparedStatement pstmt = conn.prepareStatement("SELECT image FROM testblob WHERE Name = ?");
pstmt.setString(1, args[0]);
RandomAccessFile raf = new RandomAccessFile(args[0],"rw");
ResultSet rs = pstmt.executeQuery();
if(rs.next()) {
Blob blob = rs.getBlob(1);
int length = (int)blob.length();
byte [] _blob = blob.getBytes(1, length);
raf.write(_blob);
System.out.println("Completed...");
} catch(Exception e) {
System.out.println(e);
end of code
this code contain both inserting into table and retrieving from table -
How to save values form all row in dynamic table into mysql database?
hello guys..
i got some problem on developing expert system using adobe dreamweaver and mysql.
i've create a dynamic table and have some value from different row. i want to save values from all row to mysql database.. unfortunately.. i'm failed to do that.. for now, i just can save value from first row.
kindly you can help me to solve this problem.. or maybe there is any tutorial i can follow..
thank you in advance.
this is my script for dynamic table
<table border="1" cellpadding="1" cellspacing="1">
<tr>
<td>namaSoalan</td>
<td>jaw</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_Recordset1['namaSoalan']; ?></td>
<td><label for="9"></label>
<select name="9" id="9">
<option value="value" <?php if (!(strcmp("value", $row_Recordset1['namaSoalan']))) {echo "selected=\"selected\"";} ?>>sila</option>
<option value="" <?php if (!(strcmp("", $row_Recordset1['namaSoalan']))) {echo "selected=\"selected\"";} ?>>ya</option>
<option value="0" <?php if (!(strcmp(0, $row_Recordset1['namaSoalan']))) {echo "selected=\"selected\"";} ?>>tidak</option>
</select>
<label for="u"></label></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>dear bregent and SnakEyez02.
i have create 2 table, which is soalan table and temporary table.
user will answer all the question. either 'ya' or 'tidak'..
each answer have different value..
this value store permanently in soalan table..
this value i want save to temporary table too.
for now, i success only save for the first row but i want save for all..
anybody please help me.. -
How to insert data into mysql database using GUI?
HI there,
I have created a GUI application using Netbeans 6.7.1 in which there are three jtextfields. Now from those text fields i have to insert data in the mysql database. I have already connected to mysql using drivers and URL which is used to connect to DB. So what code should i write in the source of these text fields. Please help me and give the code to it.
I actually don't know what code to be written in the source of a text field.
Thank You.Yo buddy i didn't mean that. I wanted to say that if you see my project then it will be easy for you to help me. okay have a look at this code and tell me i have just created my gui
This is Main.java -->
package bookdatabase2;
import java.sql.*;
import java.awt.*;
import javax.swing.*;
* @author Mohd Azeem
public class Main {
* @param args the command line arguments
public static void main(String[] args)throws Exception {
// TODO code application logic here
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/books","root","");
//PreparedStatement state=con.prepareStatement("select * from titles");
//ResultSet result=state.executeQuery();
//while(result.next()){
// System.out.println(result.getString(1)+" "+result.getString(2)+" "+result.getString(3)+" "+result.getString(4));
This the gui i have created
BookDatabase.java -->
package my.bookdatabase;
import java.sql.*;
import javax.swing.*;
public class BookDatabase extends javax.swing.JFrame {
public BookDatabase()throws Exception {
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/books","root","");
initComponents(); }
private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
public static void main(String args[])throws Exception {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
try{
new BookDatabase().setVisible(true);}
catch(Exception e){}
// Variables declaration - do not modify
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
private javax.swing.JTextField jTextField5;
private javax.swing.JTextField jTextField6;
private javax.swing.JTextField jTextField7;
// End of variables declaration
Now tell me what to do?
i have only created the gui but unable to run it
when i click on run only main.java is being executed
but bookdatabase.java is not getting executed?
what should i do please help? -
Loging a user into mysql database example
I'm looking for a clear example or tutorial on loging a user into a mtSQL database. I don't want an automatic login like you get with the Flex Builder's db wizard. What I have is a screen where the user enters a user name and password and then clicks a button to login. I need to be able to handle the user not entering the correct user name or password, that is handling the mySQL rejecting the login. I have done several serches both here and google and don't seem to find anything like I need. Can anybody out there point me in the right direction?
This is actually a faily simple thing to do...at least I think this is what you are trying to do based on what you said:
Here is the code for the MXML to put together the login UI:
<mx:Panel width="446" height="199" layout="absolute" title="Login" id="loginpanel">
<mx:Label x="26" y="58" text="Username:"/>
<mx:Label x="53" y="86" text="Password:"/>
<mx:TextInput x="121" y="56" id="username"/>
<mx:TextInput x="121" y="84" id="password" displayAsPassword="true"/>
<mx:Button x="219" y="114" label="Log In" id="Submit" click="login_user.send()"/>
</mx:Panel>
you need an HTTPService call (which the Submit button above sends) to the PHP file that will check the user's credentials against what is in the DB:
(mind you, I would encrypt the password on the client side too before sending it over to the PHP file)
<mx:HTTPService id="login_user" result="checkLogin(event)" method="POST" url="login.php" useProxy="false">
<mx:request xmlns="">
<username>{username.text}</username>
<password>{password.text}</password>
</mx:request>
</mx:HTTPService>
now, the result of the HTTPService goes to a function called checkLogin(event) which is:
import mx.rpc.events.ResultEvent;
private function checkLogin(evt:ResultEvent):void
if(evt.result.loginsuccess == "yes"){
//user is GOOD, do something now
if(evt.result.loginsuccess == "no"){
mx.controls.Alert.show("Invalid username/password");
and for the PHP file, it checks against the DB and generates an XML which is kicks back to Flex:
<?php
//connect to DB however you do it, I have a function db_connect() that I call
$conn = db_connect();
$username = mysql_real_escape_string($_POST['username']);
$password = mysql_real_escape_string($_POST['password']);
//if you have encryption, then make sure you do that here (md5 or whatever)
//also, make sure you do validation of the input for SQL Injections and XSS attacks, but I'm not covering that here
$query = "SELECT * FROM usertable WHERE username = '$username' AND password = '$password'";
$result = mysql_fetch_array(mysql_query($query));
$output = "<loginsuccess>";
if(!$result) {
$output .= "no";
$output .= "</loginsuccess>";
} else {
$output .= "yes";
$output .= "</loginsuccess>";
print ($output);
?> -
Problem inserting text with special Hungarian characters into MySQL database
When I insert text into my MySQL db the special Hungarian
characters (ő,ű) they change into "?".
When I check the
<cfoutput>#FORM.special_character#</cfoutput> it gives
me the correct text, things go wrong just when writing it into the
db. My hosting provider said the following: "please try to
evidently specify "latin2" charset with "latin2_hungarian_ci"
collation when performing any operations with tables. It is
supported by the server but not used by default." At my former
hosting provider I had no such problem. Anyway how could I do what
my hosting provider has suggested. I read a PHP related article
that said use "SET NAMES latin2". How could I do such thing in
ColdFusion? Any suggestion? Besides I've tried to use UTF8 and
Latin2 character encoding both on my pages and in the db but with
not much success.
I've also read a French language message here in this forum
that suggested to use:
<cfscript>
setEncoding("form", "utf-8");
setEncoding("url", "utf-8");
</cfscript>
<cfcontent type="text/html; charset=utf-8">
I' ve changed the utf-8 to latin2 and even to iso-8859-2 but
didn't help.
Thanks, AronI read that it would be the most straightforward way to do
everything in UTF-8 because it handles well special characters so
I've tried to set up a simple testing environment. Besides I use CF
MX7 and my hosting provider creates the dsn for me so I think the
db driver is JDBC but not sure.
1.) In Dreamweaver I created a page with UTF-8 encoding set
the Unicode Normalization Form to "C" and checked the include
unicode signature (BOM) checkbox. This created a page with the meta
tag: <meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />. I've checked the HTTP header with an online
utility at delorie.com and it gave me the following info:
HTTP/1.1, Content-Type: text/html; charset=utf-8, Server:
Microsoft-IIS/6.0
2.) Then I put the following codes into the top of my page
before everything:
<cfprocessingdirective pageEncoding = "utf-8">
<cfset setEncoding("URL", "utf-8")>
<cfset setEncoding("FORM", "utf-8")>
<cfcontent type="text/html; charset=utf-8">
3.) I wrote some special Hungarian chars
(<p>őű</p>) into the page and they displayed
well all the time.
4.) I've created a simple MySQL db (MySQL Community Edition
5.0.27-community-nt) on my shared hosting server with phpMyAdmin
with default charset of UTF-8 and choosing utf8_hungarian_ci as
default collation. Then I creted a MyISAM table and the collation
was automatically applied to my varchar field into wich I stored
data with special chars. I've checked the properties of the MySQL
server in MySQL-Front prog and found the following settings under
the Variables tab: character_set_client: utf8,
character_set_connection: utf8, character_set_database: latin1,
character_set_results: utf8, character_set_server: latin1,
character_set_system: utf8, collation_connection: utf8_general_ci,
collation_database: latin1_swedish_ci, collation_server:
latin1_swedish_ci.
5.) I wrote a simple insert form into my page and tried it
using both the content of the form field and a hardcoded string
value and even tried to read back the value of the
#FORM.special_char# variable. In each cases the special Hungarian
chars changed to "q" or "p" letters.
Can anybody see something wrong in the above mentioned or
have an idea to test something else?
I am thinking about to try this same page against a db on my
other hosting providers MySQL server.
Here is the to the form:
http://209.85.117.174/pages/proba/chartest/utf8_1/form.cfm
Thanks, Aron -
BOE XI 3.1 Mysql database connection jar
Hi All,
I am new learner for BOE.I installed Business Object Enterpraise 12.0.
I have created the report WebI rich client and saved in local path, and also some value insert into mysql database table.
I need to know how its stored into mysql database.
which jar file is used for creating the connection with mysql database .
Thanks,
Yousuf
Edited by: yousufalam on Dec 31, 2010 12:40 PMThe connection objects are store in the CI_APPOBJECTS repository table with SI_KIND='Metadata.DataConnection' . The connection properties are stored as property bags along with your objects.
Unfortunately I have just found a reference that this kind of access in not fully supported though and you may have to use the Universe Designer SDK (COM based)
Change password of Universe connection using Java SDK?
Since you are working with the SDK it will make sense to post your questions here:
Java SDK Application Development
Regards,
Stratos
Maybe you are looking for
-
My keynote remote will not connect from my iPhone 5s to my iMac after updating to iOS 8.1
I updated my iPhone 5s to iOS 8.1 earlier today and now my remote for Keynote will not connect with my iMac Keynote. I had a presentation tonight and it didn't work. I tried rebooting the phone and it still does not work. Any ideas? (I have Yosemite
-
Alert Inbox and Alert Config does not open in RWB
When I open RWB I am not able to open Alert Inbox and Alert Configuration links. Its says " Internet Explorer cannot display the webpage" . When I exequte the command ALRTINBOX from Abap stack, it opens the Alert Inbox page. Can someone tell me if th
-
Hi experts, I've created a LIS on quality. But I can't create a colomn with the average in the colomn header. In my structure, i've got informations such as below : Quality ratio 10 blank 20 blank 30 Currently in the header, i've got 60. And I would
-
LaserJet Printers mf1213nf MFP driver not found
Sir , Pls Sent me link for download driver of my printer LaserJet Printers mf1213nf MFP for windows 7 32bit thank you Pravin B [Personal Information Removed]
-
Hi PPL, Can anybody help me out in explaining me how to find a menu exit or the Screen exit in a program...I have an requirement where i need to use both of them.. I have already posted this query , but people responded with links which had the infor