mysql-connector

MySqlParameter as TableName

感情迁移 提交于 2019-11-28 14:12:15
I want to use MySqlParameter to pass tableName into query (to prevent slq injections) MySqlCommand cmd = new MySqlCommand("select * from @table"), cn) cmd.Parameters.AddWithValue("@table",TableName); But this is not working. How can I pass tableName as parameter P.S. I tried to change @ to ? - not working Vimvq1987 You cannot pass table name as parameter. You have to use dynamic SQL to do this, so you have to string concentration to do it, for example MySqlCommand cmd = new MySqlCommand(String.Format("select * from {0}",tableName), cn) But because users input the tableName, so SQL injection is

MySQL Connector/C++ OS X 10.9 Mavericks and XCODE 5.0.2

試著忘記壹切 提交于 2019-11-28 13:02:47
问题 I've upgraded to XCode 5.0.2 along with OS X 10.9 Mavericks and MYSQL 5.6.16 recently. Has anyone had any luck getting the MySQL Connector/C++ to compile and work properly with this setup? I've been linking with the distributed MySQL Connector/C++ library under Snow Leopard with no problem for a few years now, but when I shifted to the above mentioned setup, I have no luck. When I use the sql::Driver->connect I get EXC_BAD_ACCESS (code=EXC_I386_GPFLT) USING: XCode 5.0.2 Mavericks 10.9.2 MYSQL

Connect to mysql 5.0 database using pure vbscript?

风格不统一 提交于 2019-11-28 12:24:18
I've tried the below script but I am getting an error: dim cn, rs set cn = CreateObject("ADODB.Connection") set rs = CreateObject("ADODB.Recordset") cn.connectionstring = "Provider=MysqlProv; Data Source=Adonis; User Id=mysqluser; Password = mysqlpass;" cn.open rs.open "select * from Countries", cn, 3 rs.MoveFirst while not rs.eof wscript.echo rs(0) rs.next wend cn.close wscript.echo "End of program" Its giving the following error: C:\mysql.vbs(6, 1) ADODB.Connection: Provider cannot be found. It may not be pro perly installed. When I googled for an odbc connector I came up to this page where

MySQL Exception - Fatal Error Encountered During Data Read

半腔热情 提交于 2019-11-28 11:14:24
I am working on a C# console program that grabs large numbers of records from a table, runs them through a medical grouper, and then updates each of the records. It uses MySQL Connector/NET 5.2.7. The way it works is that I grab chunks of data at a time (i.e. 20,000 rows) using SQL_BUFFER_RESULT to avoid locks. Each record is run through the grouper, and then an individual update query is done on that one record. There are two connections used, a read connection and a write connection. So as the program executes and it loops through records from the read query, its using result.Read() to do so

Could not load file or assembly 'MySql.Data, Version=6.3.6.0

荒凉一梦 提交于 2019-11-28 10:33:33
I'm at a COMPLETE loss - I'm having super wierd issues with what I still really dont even understand... I'm running Entity Framework 4.1, MySql 5.xx and my MySql Connector is v 6.4.4 - everything works beatifully locally however whenever I upload to the server I receive: Could not load file or assembly 'MySql.Data, Version=6.3.6.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Description: An unhandled exception occurred during the execution of

MySQL C++ Connector crashes my app at ResultSet->getString()

最后都变了- 提交于 2019-11-28 09:40:14
问题 It's me again probably asking noob C++ questions I had MAJOR headaches making the darn (sorry for the language) MySQL C++ connector work. I don't know if it is poorly written or something, but for my experience yet I've never had so much trouble making something to work. Anyhow I got it to connect and throw exceptions on failed connect/query which for me is quite big thing :U :P . The actual problem comes out of me obtaining the result of the query. Regardless of what I do my application

Entity framework with mysql database migrations fail, when creating indexes

冷暖自知 提交于 2019-11-28 08:20:28
问题 what causes this error in MySQL with entity framework? I can generate the migration script and connect to the database but it doesn't like the SQL generated particularly "hash" when trying to create indexes. Example: CREATE index `IX_Facility_ID` on `Contact.Address` (`Facility_ID` DESC) using HASH Error: MySql.Data.MySqlClient.MySqlException (0x80004005): Incorrect usage of spatial/fulltext/hash index and explicit index order Is there any way around this? This is with EF 6 and the latest

com.mysql.jdbc.Driver not found with mysql connector in buildpath

谁都会走 提交于 2019-11-28 06:37:49
问题 I use Eclipse juno. I have mysql-connector-java-5.1.22-bin.jar in my buildpath and i try to establish a DB connection to my mysql database. Here is my code public Connection getConnectionToDB() { try { Class.forName(driver); Connection con = DriverManager.getConnection(url + dbName, userName, password); return con; } catch (Exception e) { e.printStackTrace(); } return null; } When i debug it i found out the problem is at: Class.forName(driver); i also tried replacing it with: Class.forName

What's the difference between MySQLdb, mysqlclient and MySQL connector/Python?

时光总嘲笑我的痴心妄想 提交于 2019-11-28 03:08:21
So I've been trying to do some database update with python and while setting up the whole dev environment, I came across these three things which made me dizzy. There's MySQLdb There's mysqlclient And then there's a mysql connector python What's each of them, the difference and where to use them? Thanks MySQLdb is a thin python wrapper around C module which implements API for MySQL database. There was MySQLDb1 version of wrapper used some time ago and now it is considered to be a legacy. As MySQLDb1 started evolving to MySQLDb2 with bug fixes and Python3 support, a MySQLDb1 was forked and here

Insert using PreparedStatement. How do I auto-increment the ID?

谁都会走 提交于 2019-11-27 22:08:02
I have a PreparedStatement such as: PreparedStatement preparedStatement = connect.prepareStatement("INSERT into employee (id, time, name" + "(?,?,?)",Statement.RETURN_GENERATED_KEYS); ResultSet tableKeys = preparedStatement.getGeneratedKeys(); preparedStatement.executeUpdate(); tableKeys.next(); int autoGeneratedID = tableKeys.getInt(1); preparedStatement.setInt(1,autoGeneratedID); preparedStatement.setTimestamp(2, new java.sql.Timestamp(new java.util.Date().getTime())); preparedStatement.setString(3, "Test"); preparedStatement.executeUpdate(); As you can see, the Employee table has an auto